1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-07 18:30:25 +02:00

fix x86-64 jit_movi_l (x, 0) and 16-byte stack alignment in the prolog

2008-06-14  Laurent Michel  <ldm@thorgal.homelinux.org>

	* lightning/i386/core-64.h (jit_movi_l): When the operand is 0,
	the XOR should be on a quadword.
	* lightning/i386/core-64.h (jit_prolog): Keep 16-byte stack
	alignment.
	(jit_ret): Always use LEAVE.
This commit is contained in:
Laurent Michel 2008-06-16 08:04:18 +02:00 committed by Paolo Bonzini
parent 297ed204de
commit 0b676371fa
2 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2008-06-14 Laurent Michel <ldm@thorgal.homelinux.org>
* lightning/i386/core-64.h (jit_movi_l): When the operand is 0,
the XOR should be on a quadword.
* lightning/i386/core-64.h (jit_prolog): Keep 16-byte stack
alignment.
(jit_ret): Always use LEAVE.
2008-06-13 Laurent Michel <ldm@thorgal.homelinux.org> 2008-06-13 Laurent Michel <ldm@thorgal.homelinux.org>
* lightning/i386/core-64.h: Add (void) casts for C++ compatibility. * lightning/i386/core-64.h: Add (void) casts for C++ compatibility.

View file

@ -118,8 +118,10 @@ struct jit_local_state {
#define jit_pushr_i(rs) PUSHQr(rs) #define jit_pushr_i(rs) PUSHQr(rs)
#define jit_popr_i(rs) POPQr(rs) #define jit_popr_i(rs) POPQr(rs)
#define jit_base_prolog() (PUSHQr(_EBX), PUSHQr(_R12), PUSHQr(_R13), PUSHQr(_EBP), MOVQrr(_ESP, _EBP)) /* A return address is 8 bytes, plus 4 registers = 32 byte, total = 40 bytes.
#define jit_prolog(n) (_jitl.nextarg_getfp = _jitl.nextarg_geti = 0, _jitl.alloca_offset = 0, jit_base_prolog()) The final push of EBX keeps the stack aligned to 16 bytes. */
#define jit_prolog(n) (_jitl.nextarg_getfp = _jitl.nextarg_geti = 0, _jitl.alloca_offset = 0, \
PUSHQr(_EBX), PUSHQr(_R12), PUSHQr(_R13), PUSHQr(_EBP), MOVQrr(_ESP, _EBP), PUSHQr(_EBX))
#define jit_calli(sub) (MOVQir((long) (sub), JIT_REXTMP), CALLsr(JIT_REXTMP)) #define jit_calli(sub) (MOVQir((long) (sub), JIT_REXTMP), CALLsr(JIT_REXTMP))
#define jit_callr(reg) CALLsr((reg)) #define jit_callr(reg) CALLsr((reg))
@ -167,7 +169,7 @@ static int jit_arg_reg_order[] = { _EDI, _ESI, _EDX, _ECX };
? (_u32P((long)(is)) \ ? (_u32P((long)(is)) \
? MOVLir((is), (d)) \ ? MOVLir((is), (d)) \
: MOVQir((is), (d))) \ : MOVQir((is), (d))) \
: XORLrr ((d), (d)) ) : XORQrr ((d), (d)) )
#define jit_bmsr_l(label, s1, s2) (TESTQrr((s1), (s2)), JNZm(label), _jit.x.pc) #define jit_bmsr_l(label, s1, s2) (TESTQrr((s1), (s2)), JNZm(label), _jit.x.pc)
#define jit_bmcr_l(label, s1, s2) (TESTQrr((s1), (s2)), JZm(label), _jit.x.pc) #define jit_bmcr_l(label, s1, s2) (TESTQrr((s1), (s2)), JZm(label), _jit.x.pc)
@ -184,7 +186,7 @@ static int jit_arg_reg_order[] = { _EDI, _ESI, _EDX, _ECX };
#define jit_patch_long_at(jump_pc,v) (*_PSL((jump_pc) - sizeof(long)) = _jit_SL((jit_insn *)(v))) #define jit_patch_long_at(jump_pc,v) (*_PSL((jump_pc) - sizeof(long)) = _jit_SL((jit_insn *)(v)))
#define jit_patch_short_at(jump_pc,v) (*_PSI((jump_pc) - sizeof(int)) = _jit_SI((jit_insn *)(v) - (jump_pc))) #define jit_patch_short_at(jump_pc,v) (*_PSI((jump_pc) - sizeof(int)) = _jit_SI((jit_insn *)(v) - (jump_pc)))
#define jit_patch_at(jump_pc,v) (_jitl.long_jumps ? jit_patch_long_at((jump_pc)-3, v) : jit_patch_short_at(jump_pc, v)) #define jit_patch_at(jump_pc,v) (_jitl.long_jumps ? jit_patch_long_at((jump_pc)-3, v) : jit_patch_short_at(jump_pc, v))
#define jit_ret() ((_jitl.alloca_offset < 0 ? LEAVE_() : POPQr(_EBP)), POPQr(_R13), POPQr(_R12), POPQr(_EBX), RET_()) #define jit_ret() (LEAVE_(), POPQr(_R13), POPQr(_R12), POPQr(_EBX), RET_())
/* Memory */ /* Memory */