guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 114/437: Change JIT_REXTMP to not clobber 6th argument.


From: Andy Wingo
Subject: [Guile-commits] 114/437: Change JIT_REXTMP to not clobber 6th argument.
Date: Mon, 2 Jul 2018 05:13:56 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit ec36c1318374adf0233703d3378ce870e60a3a2f
Author: PCPA <address@hidden>
Date:   Wed Aug 25 06:45:42 2010 -0300

    Change JIT_REXTMP to not clobber 6th argument.
    
      To not clobber JIT_R2, JIT_REXTMP is defined to the callee save register
    %r12, instead of the expected, scratch register %r11.
      To have JIT_V_NUM at least at 3, it now also uses %r14, but does not add
    %r15, that could be JIT_V(4) to simplify logic of keeping stack 16 bytes
    aligned.
---
 lightning/i386/core-64.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h
index a3effb2..b10fb5b 100644
--- a/lightning/i386/core-64.h
+++ b/lightning/i386/core-64.h
@@ -36,7 +36,7 @@
 
 /* Used to implement ldc, stc, ... */
 #define JIT_CAN_16 0
-#define JIT_REXTMP             _R9
+#define JIT_REXTMP             _R12
 
 /* Number or integer argument registers */
 #define JIT_ARG_MAX            6
@@ -47,7 +47,7 @@
 #define JIT_R_NUM              3
 #define JIT_R(i)                ((i) == 0 ? _EAX : _R9 + (i))
 #define JIT_V_NUM               3
-#define JIT_V(i)                ((i) == 0 ? _EBX : _R11 + (i))
+#define JIT_V(i)                ((i) == 0 ? _EBX : _R12 + (i))
 
 struct jit_local_state {
   int   long_jumps;
@@ -129,10 +129,9 @@ struct jit_local_state {
 #define jit_pushr_i(rs)                PUSHQr(rs)
 #define jit_popr_i(rs)         POPQr(rs)
 
-/* A return address is 8 bytes, plus 4 registers = 32 byte, total = 40 bytes.
-   The final push of EBX keeps the stack aligned to 16 bytes.  */
+/* A return address is 8 bytes, plus 5 registers = 40 bytes, total = 48 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))
+                      PUSHQr(_EBX), PUSHQr(_R12), PUSHQr(_R13), PUSHQr(_R14), 
PUSHQr(_EBP), MOVQrr(_ESP, _EBP))
 
 #define jit_calli(sub)          (MOVQir((long) (sub), JIT_REXTMP), 
CALLsr(JIT_REXTMP))
 #define jit_callr(reg)         CALLsr((reg))
@@ -189,7 +188,7 @@ static int jit_arg_reg_order[] = { _EDI, _ESI, _EDX, _ECX, 
_R8D, _R9D };
 #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_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()                      (LEAVE_(), POPQr(_R13), POPQr(_R12), 
POPQr(_EBX), RET_())
+#define jit_ret()                      (LEAVE_(), POPQr(_R14), POPQr(_R13), 
POPQr(_R12), POPQr(_EBX), RET_())
 
 /* Memory */
 



reply via email to

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