>From 23cdb86b593d35555f74aa93e9b6261f2d330c56 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Mon, 23 Aug 2010 18:44:17 -0300 Subject: [PATCH 4/6] Increase JIT_V_NUM to 5 and add save/restore of %r14 and %r15 to jit_prolog and jit_ret. --- lightning/i386/core-64.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h index 8bd52d3..4fb6adc 100644 --- a/lightning/i386/core-64.h +++ b/lightning/i386/core-64.h @@ -40,7 +40,7 @@ #define JIT_R_NUM 3 #define JIT_R(i) ((i) == 0 ? _EAX : _R9D + (i)) -#define JIT_V_NUM 3 +#define JIT_V_NUM 5 #define JIT_V(i) ((i) == 0 ? _EBX : _R11D + (i)) struct jit_local_state { @@ -123,10 +123,10 @@ 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. +/* A return address is 8 bytes, plus 6 registers = 32 byte, total = 56 bytes. 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)) + PUSHQr(_EBX), PUSHQr(_R12), PUSHQr(_R13), PUSHQr(_R14), PUSHQr(_R15), PUSHQr(_EBP), MOVQrr(_ESP, _EBP), PUSHQr(_EBX)) #define jit_calli(sub) (MOVQir((long) (sub), JIT_REXTMP), CALLsr(JIT_REXTMP)) #define jit_callr(reg) CALLsr((reg)) @@ -178,7 +178,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(_R15), POPQr(_R14), POPQr(_R13), POPQr(_R12), POPQr(_EBX), RET_()) /* Memory */ -- 1.7.2.1