This provides correct argument passing for x86-64 in STMT_ATHROW.
Signed-off-by: Eduard - Gabriel Munteanu <[email protected]>
---
arch/x86/insn-selector.brg | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 43f6960..759194e 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -2440,9 +2440,10 @@ stmt: STMT_ARRAY_STORE_CHECK(freg, reg) 1
select_exception_test(s, tree);
}
+%ifdef CONFIG_X86_32
stmt: STMT_ATHROW(reg)
{
- struct var_info *reg_eax = get_fixed_var(s->b_parent, MACH_REG_xAX);
+ struct var_info *reg_eax = get_fixed_var(s->b_parent, MACH_REG_EAX);
select_insn(s, tree, reg_insn(INSN_PUSH_REG, state->left->reg1));
select_insn(s, tree, imm_insn(INSN_PUSH_IMM, (unsigned
long)s->b_parent));
@@ -2453,6 +2454,28 @@ stmt: STMT_ATHROW(reg)
select_insn(s, tree, reg_insn(INSN_PUSH_REG, reg_eax));
select_insn(s, tree, insn(INSN_RET));
}
+%else
+stmt: STMT_ATHROW(reg)
+{
+ struct var_info *rax, *rdi, *rsi;
+
+ rax = get_fixed_var(s->b_parent, MACH_REG_RAX);
+ rdi = get_fixed_var(s->b_parent, MACH_REG_RDI);
+ rsi = get_fixed_var(s->b_parent, MACH_REG_RSI);
+
+ select_insn(s, tree,
+ imm_reg_insn(INSN_MOV_IMM_REG,
+ (unsigned long) s->b_parent, rdi));
+ select_insn(s, tree,
+ reg_reg_insn(INSN_MOV_REG_REG, state->left->reg1, rsi));
+ select_insn(s, tree, rel_insn(INSN_CALL_REL,
+ (unsigned long) throw_exception));
+
+ /* Jump where throw_exception() told us to jump */
+ select_insn(s, tree, reg_insn(INSN_PUSH_REG, rax));
+ select_insn(s, tree, insn(INSN_RET));
+}
+%endif
array_check: EXPR_ARRAY_DEREF(reg, reg) 2
{
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel