diff --git a/ChangeLog b/ChangeLog index 21e1bfc..78bcf61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-05 Aleksey Demakov + + * configure.in: make new register allocator the default. + + * jit/jit-reg-alloc.c (is_register_alive, compute_spill_cost): fix + problem with destroying the end register of a long pair. + 2006-07-03 Aleksey Demakov * jit/jit-rules-x86.ins: add JIT_OP_LOW_WORD, JIT_OP_EXPAND_INT, diff --git a/configure.in b/configure.in index cde9c2d..2f6040c 100644 --- a/configure.in +++ b/configure.in @@ -70,7 +70,7 @@ AC_ARG_ENABLE(new-reg-alloc, yes) new_reg_alloc=true ;; no) new_reg_alloc=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-new-reg-alloc) ;; -esac],[new_reg_alloc=false]) +esac],[new_reg_alloc=true]) if test x$new_reg_alloc = xtrue; then AC_DEFINE(USE_NEW_REG_ALLOC, 1, [Define if you want to use new register allocator]) fi diff --git a/jit/jit-reg-alloc.c b/jit/jit-reg-alloc.c index b91d399..efb23e6 100644 --- a/jit/jit-reg-alloc.c +++ b/jit/jit-reg-alloc.c @@ -1713,6 +1713,23 @@ get_stack_top(jit_gencode_t gen, int stack_start) return (gen->stack_map[stack_start]); } +/* + * Find the start register of a long pair given the end register. + */ +static int +get_long_pair_start(int other_reg) +{ + int reg; + for(reg = 0; reg < JIT_NUM_REGS; reg++) + { + if(other_reg == OTHER_REG(reg)) + { + return reg; + } + } + return -1; +} + /* * Determine the type of register that we need. */ @@ -1889,6 +1906,10 @@ is_register_alive(jit_gencode_t gen, _jit_regs_t *regs, int reg) { return 1; } + if(gen->contents[reg].is_long_end) + { + reg = get_long_pair_start(reg); + } for(index = 0; index < gen->contents[reg].num_values; index++) { usage = value_usage(regs, gen->contents[reg].values[index]); @@ -2359,7 +2380,7 @@ set_regdesc_flags(jit_gencode_t gen, _jit_regs_t *regs, int index) } /* - * Check to see if loading one input value into the given register + * Check to see if an input value loaded into the given register * clobbers any other input values. */ static int @@ -2493,6 +2514,11 @@ compute_spill_cost(jit_gencode_t gen, _jit_regs_t *regs, int reg, int other_reg) int cost, index, usage; jit_value_t value; + if(gen->contents[reg].is_long_end) + { + reg = get_long_pair_start(reg); + } + cost = 0; for(index = 0; index < gen->contents[reg].num_values; index++) { @@ -3469,7 +3495,7 @@ save_value(jit_gencode_t gen, jit_value_t value, int reg, int other_reg, int fre } /* - * Spill regualar (non-stack) register. + * Spill regular (non-stack) register. */ static void spill_reg(jit_gencode_t gen, _jit_regs_t *regs, int reg) @@ -3489,13 +3515,7 @@ spill_reg(jit_gencode_t gen, _jit_regs_t *regs, int reg) else if(gen->contents[reg].is_long_end) { other_reg = reg; - for(reg = 0; reg < JIT_NUM_REGS; ++reg) - { - if(other_reg == OTHER_REG(reg)) - { - break; - } - } + reg = get_long_pair_start(reg); } else {