We determine if the local index refers to a local variable and do not
access the argument map if we shouldn't.

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

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 69e03cb..376ea0d 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -244,15 +244,23 @@ reg:      EXPR_LOCAL      1
 
        method = cu->method;
 
-       reg = method->args_map[expr->local_index].reg;
-       if (reg == MACH_REG_UNASSIGNED) {
-               index = method->args_map[expr->local_index].stack_index;
+       if (expr->local_index < (unsigned long) method->args_count) {
+               reg = method->args_map[expr->local_index].reg;
+               if (reg == MACH_REG_UNASSIGNED) {
+                       index = method->args_map[expr->local_index].stack_index;
+                       slot = get_local_slot(s->b_parent->stack_frame, index);
+                       result = get_var(s->b_parent, J_LONG);
+                       select_insn(s, tree, 
memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
+                                                              slot, result));
+               } else
+                       result = get_fixed_var(s->b_parent, reg);
+       } else {
+               index = expr->local_index - method->reg_args_count;
                slot = get_local_slot(s->b_parent->stack_frame, index);
                result = get_var(s->b_parent, J_LONG);
                select_insn(s, tree, memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
                                                       slot, result));
-       } else
-               result = get_fixed_var(s->b_parent, reg);
+       }
 
        state->reg1 = result;
 }
-- 
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