From 1dd87638205e8e6edcb59d0a041fa521e3a45153 Mon Sep 17 00:00:00 2001 From: Klaus Treichel Date: Tue, 4 Nov 2008 19:49:12 +0000 Subject: [PATCH] Fix calling variadic functions ih jit_apply. Spill values with sizes less than sizeof jit_int as jit_int on the stack. --- ChangeLog | 9 +++++++++ jit/jit-apply-x86-64.h | 5 +++-- jit/jit-rules-x86-64.c | 8 +++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f57fb8..2985e9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-04 Klaus Treichel + + * jit/jit-apply-x86-64.h (jit_builtin_apply): Use r11 for calling + the function and pass the constant 8 in rax for the number of SSE + registers used to pass values for variadic functions. + + * jit/jit-rules-x86-64.c (_spill_reg): Spill values with sizes + less than 4 as jit_type_int on the stack. + 2008-10-12 Aleksey Demakov * jit/jit-unwind.c: fix typos. diff --git a/jit/jit-apply-x86-64.h b/jit/jit-apply-x86-64.h index cbcbfb5..3c39154 100644 --- a/jit/jit-apply-x86-64.h +++ b/jit/jit-apply-x86-64.h @@ -175,8 +175,9 @@ _jit_classify_struct(jit_param_passing_t *passing, "movaps 0x90(%%rax), %%xmm5\n\t" \ "movaps 0xA0(%%rax), %%xmm6\n\t" \ "movaps 0xB0(%%rax), %%xmm7\n\t" \ - "movq %0, %%rax\n\t" \ - "callq *%%rax\n\t" \ + "movq %0, %%r11\n\t" \ + "movl $8, %%eax\n\t" \ + "callq *%%r11\n\t" \ "movq %3, %%rcx\n\t" \ "movq %%rax, (%%rcx)\n\t" \ "movq %%rdx, 0x08(%%rcx)\n\t" \ diff --git a/jit/jit-rules-x86-64.c b/jit/jit-rules-x86-64.c index 487c2e2..e514f7e 100644 --- a/jit/jit-rules-x86-64.c +++ b/jit/jit-rules-x86-64.c @@ -899,6 +899,7 @@ _spill_reg(unsigned char **inst_ptr, jit_type_t type, { switch(type->kind) { +#if 0 case JIT_TYPE_SBYTE: case JIT_TYPE_UBYTE: { @@ -914,7 +915,12 @@ _spill_reg(unsigned char **inst_ptr, jit_type_t type, _jit_reg_info[reg].cpu_reg, 2); } break; - +#else + case JIT_TYPE_SBYTE: + case JIT_TYPE_UBYTE: + case JIT_TYPE_SHORT: + case JIT_TYPE_USHORT: +#endif case JIT_TYPE_INT: case JIT_TYPE_UINT: case JIT_TYPE_FLOAT32: -- 2.47.3