]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
fix problem with destroying the end register of a long pair;
authorAleksey Demakov <ademakov@gmail.com>
Tue, 4 Jul 2006 17:28:07 +0000 (17:28 +0000)
committerAleksey Demakov <ademakov@gmail.com>
Tue, 4 Jul 2006 17:28:07 +0000 (17:28 +0000)
make new register allocator the default.

ChangeLog
configure.in
jit/jit-reg-alloc.c

index 21e1bfc9201f330f86b258330edaa5c1bac97b10..78bcf619ff6a0453c21898fb2db862faa46a7304 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-07-05  Aleksey Demakov  <ademakov@gmail.com>
+
+       * 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  <ademakov@gmail.com>
 
        * jit/jit-rules-x86.ins: add JIT_OP_LOW_WORD, JIT_OP_EXPAND_INT,
index cde9c2d9ff56db03c305848a743de760ab901c24..2f6040ca22fa253be82688ef7283e988cb6c7169 100644 (file)
@@ -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
index b91d399e2eb528c9c05fe3cc1d349a60dead2b2c..efb23e6eedc1b2fc4c796b1d0be11c7fbbdd557f 100644 (file)
@@ -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
        {