Previous implementation attempted to access the argument map for local
variables as well. We now determine if the local index refers to a local
variable and act accordingly.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro>
---
 arch/x86/insn-selector.brg |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 65bc5d1..c86362a 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -2195,15 +2195,22 @@ stmt:  STMT_STORE(EXPR_TEMPORARY, EXPR_LOCAL) 1
 
        method = s->b_parent->method;
 
-       reg = method->args_map[exprsrc->local_index].reg;
-       if (reg == MACH_REG_UNASSIGNED) {
-               index = method->args_map[exprsrc->local_index].stack_index;
+       if (exprsrc->local_index < (unsigned long) method->args_count) {
+               reg = method->args_map[exprsrc->local_index].reg;
+               if (reg == MACH_REG_UNASSIGNED) {
+                       index = 
method->args_map[exprsrc->local_index].stack_index;
+                       slot = get_local_slot(s->b_parent->stack_frame, index);
+                       select_insn(s, tree, 
memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
+                                                              slot, dest));
+               } else {
+                       src = get_fixed_var(s->b_parent, reg);
+                       select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG, 
src, dest));
+               }
+       } else {
+               index = exprsrc->local_index - method->reg_args_count;
                slot = get_local_slot(s->b_parent->stack_frame, index);
                select_insn(s, tree, memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
                                                       slot, dest));
-       } else {
-               src = get_fixed_var(s->b_parent, reg);
-               select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG, src, dest));
        }
 }
 
-- 
1.6.0.6


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to