guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 81/437: fix stack alignment for Apple 32-bit ABI


From: Andy Wingo
Subject: [Guile-commits] 81/437: fix stack alignment for Apple 32-bit ABI
Date: Mon, 2 Jul 2018 05:13:50 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit e3461957f62d11904ff8c17aab584fbb4510824a
Author: Paolo Bonzini <address@hidden>
Date:   Wed Jun 11 12:37:24 2008 -0700

    fix stack alignment for Apple 32-bit ABI
    
    2008-06-11  Paolo Bonzini  <address@hidden>
    
        * 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.
---
 ChangeLog                |  6 ++++++
 lightning/i386/core-32.h | 14 +++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d75ae75..0d87a2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-06-11  Paolo Bonzini  <address@hidden>
 
+       * 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  <address@hidden>
+
        * lightning/i386/core-i386.h: Fix C++ incompatibility.
 
 2008-06-10  Laurent Michel  <address@hidden>
diff --git a/lightning/i386/core-32.h b/lightning/i386/core-32.h
index 2176589..52015d9 100644
--- a/lightning/i386/core-32.h
+++ b/lightning/i386/core-32.h
@@ -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 */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]