1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-03 13:20:26 +02:00

fix stack alignment for Apple 32-bit ABI

2008-06-11  Paolo Bonzini  <bonzini@gnu.org>

	* lightning/i386/core-32.h: Use separate __APPLE__ and SysV
	prolog/ret macros.  Subtract 12 bytes in __APPLE__ case to
	keep stack aligned, and always use LEAVE in the epilog.
This commit is contained in:
Paolo Bonzini 2008-06-11 12:37:24 -07:00
parent 4bc1260c51
commit e3461957f6
2 changed files with 17 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2008-06-11 Paolo Bonzini <bonzini@gnu.org>
* lightning/i386/core-32.h: Use separate __APPLE__ and SysV
prolog/ret macros. Subtract 12 bytes in __APPLE__ case to
keep stack aligned, and always use LEAVE in the epilog.
2008-06-11 Paolo Bonzini <bonzini@gnu.org>
* lightning/i386/core-i386.h: Fix C++ incompatibility.

View file

@ -46,8 +46,11 @@ struct jit_local_state {
int alloca_slack;
};
#define jit_base_prolog() (PUSHLr(_EBX), PUSHLr(_ESI), PUSHLr(_EDI), PUSHLr(_EBP), MOVLrr(_ESP, _EBP))
#define jit_prolog(n) (_jitl.framesize = 20, _jitl.alloca_offset = 0, jit_base_prolog())
#define jit_base_prolog() (_jitl.framesize = 20, _jitl.alloca_offset = 0, \
PUSHLr(_EBX), PUSHLr(_ESI), PUSHLr(_EDI), PUSHLr(_EBP), MOVLrr(_ESP, _EBP))
#define jit_ret(ofs) \
(((ofs) < 0 ? LEAVE_() : POPLr(_EBP)), \
POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), RET_())
/* Used internally. SLACK is used by the Darwin ABI which keeps the stack
aligned to 16-bytes. */
@ -78,11 +81,17 @@ struct jit_local_state {
#define jit_allocai(n) \
jit_allocai_internal ((n), (_jitl.alloca_slack - (n)) & 15)
#define jit_prolog(n) (jit_base_prolog(), jit_subi_i (JIT_SP, JIT_SP, 12))
#define jit_ret() jit_base_ret (-12)
#else
# define jit_prepare_i(ni) (_jitl.argssize += (ni))
#define jit_allocai(n) \
jit_allocai_internal ((n), 0)
#define jit_prolog(n) jit_base_prolog()
#define jit_ret() jit_base_ret (_jitl.alloca_offset)
#endif
#define jit_calli(label) (CALLm( ((unsigned long) (label))), _jit.x.pc)
@ -105,7 +114,6 @@ struct jit_local_state {
#define jit_movi_p(d, is) (jit_movi_l(d, ((long)(is))), _jit.x.pc)
#define jit_patch_long_at(jump_pc,v) (*_PSL((jump_pc) - sizeof(long)) = _jit_SL((jit_insn *)(v) - (jump_pc)))
#define jit_patch_at(jump_pc,v) jit_patch_long_at(jump_pc, v)
#define jit_ret() ((_jitl.alloca_offset < 0 ? LEAVE_() : POPLr(_EBP)), POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), RET_())
/* Memory */