From 003ff11377e09a7de2756f7a7548ca624f9065c3 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Tue, 8 Jun 2004 06:40:53 +0000 Subject: [PATCH] Minor register assignment bugs. --- ChangeLog | 3 +++ jit/jit-reg-alloc.c | 1 + jit/jit-rules-arm.c | 4 ++-- jit/jit-rules-arm.sel | 2 +- jit/jit-rules-x86.sel | 8 ++++---- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8eabc2f..5915afd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,9 @@ * jit/jit-rules-arm.c (_jit_gen_spill_reg): spill properly to global registers for ARM. + * jit/jit-reg-alloc.c, jit/jit-rules-arm.c, jit/jit-rules-arm.sel, + jit/jit-rules-x86.sel: minor register assignment bugs. + 2004-06-08 Miroslaw Dobrzanski-Neumann * jit/jit-alloc.c: fix ROUND_END_PTR so that it adds the size diff --git a/jit/jit-reg-alloc.c b/jit/jit-reg-alloc.c index 629bc11..465cf55 100644 --- a/jit/jit-reg-alloc.c +++ b/jit/jit-reg-alloc.c @@ -1499,6 +1499,7 @@ void _jit_regs_alloc_global(jit_gencode_t gen, jit_function_t func) candidates[index]->global_reg = (short)reg; jit_reg_set_used(gen->touched, reg); jit_reg_set_used(gen->permanent, reg); + --reg; } #endif diff --git a/jit/jit-rules-arm.c b/jit/jit-rules-arm.c index c64c0c5..4138df3 100644 --- a/jit/jit-rules-arm.c +++ b/jit/jit-rules-arm.c @@ -357,7 +357,7 @@ int _jit_create_call_setup_insns size = jit_type_get_size(jit_value_get_type(args[num_args])); size = ROUND_STACK(size) / sizeof(void *); word_regs -= size; - if(!jit_insn_outgoing_reg(func, args[num_args], (int)size)) + if(!jit_insn_outgoing_reg(func, args[num_args], (int)word_regs)) { return 0; } @@ -529,7 +529,7 @@ void *_jit_gen_prolog(jit_gencode_t gen, jit_function_t func, void *buf) /* Allocate space for the local variable frame. Subtract off the space for the registers that we just saved. The pc, lr, and fp registers are always saved, so account for them too */ - frame_size = func->builder->frame_size - (saved + 3); + frame_size = func->builder->frame_size - (saved + 3 * sizeof(void *)); if(frame_size > 0) { arm_alu_reg_imm(inst, ARM_SUB, ARM_SP, ARM_SP, frame_size); diff --git a/jit/jit-rules-arm.sel b/jit/jit-rules-arm.sel index 810cf08..4de15a5 100644 --- a/jit/jit-rules-arm.sel +++ b/jit/jit-rules-arm.sel @@ -582,7 +582,7 @@ JIT_OP_RETURN: inst = jump_to_epilog(gen, inst, block); } -JIT_OP_RETURN_INT: unary_note +JIT_OP_RETURN_INT: unary_branch [reg] -> { int cpu_reg = $1; if(cpu_reg != ARM_R0) diff --git a/jit/jit-rules-x86.sel b/jit/jit-rules-x86.sel index 9ec1d8d..253e913 100644 --- a/jit/jit-rules-x86.sel +++ b/jit/jit-rules-x86.sel @@ -1462,7 +1462,7 @@ JIT_OP_RETURN: inst = jump_to_epilog(gen, inst, block); } -JIT_OP_RETURN_INT: unary_note +JIT_OP_RETURN_INT: unary_branch [reg] -> { int cpu_reg = $1; if(cpu_reg != X86_EAX) @@ -1492,17 +1492,17 @@ JIT_OP_RETURN_LONG: spill_before inst = jump_to_epilog(gen, inst, block); } -JIT_OP_RETURN_FLOAT32: unary_note, stack, only +JIT_OP_RETURN_FLOAT32: unary_branch, stack, only [freg] -> { inst = jump_to_epilog(gen, inst, block); } -JIT_OP_RETURN_FLOAT64: unary_note, stack, only +JIT_OP_RETURN_FLOAT64: unary_branch, stack, only [freg] -> { inst = jump_to_epilog(gen, inst, block); } -JIT_OP_RETURN_NFLOAT: unary_note, stack, only +JIT_OP_RETURN_NFLOAT: unary_branch, stack, only [freg] -> { inst = jump_to_epilog(gen, inst, block); } -- 2.47.3