From 67e10518277beb68729a9240a8d254100687cfb6 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Wed, 25 Aug 2010 20:50:41 -0300 Subject: [PATCH] Account stack alignment on jit functions with odd number of arguments. The x86_64 correction to keep stack aligned in jit_finish* was only correct for functions being called, but did not correctly handle alignment of stack arguments. --- lightning/i386/core-64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h index ea5384563..48a8996e4 100644 --- a/lightning/i386/core-64.h +++ b/lightning/i386/core-64.h @@ -133,7 +133,7 @@ struct jit_local_state { #define jit_popr_i(rs) POPQr(rs) /* A return address is 8 bytes, plus 5 registers = 40 bytes, total = 48 bytes. */ -#define jit_prolog(n) (_jitl.framesize = 48, _jitl.nextarg_getfp = _jitl.nextarg_geti = 0, _jitl.alloca_offset = 0, \ +#define jit_prolog(n) (_jitl.framesize = ((n) & 1) ? 56 : 48, _jitl.nextarg_getfp = _jitl.nextarg_geti = 0, _jitl.alloca_offset = 0, \ 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))