Signed-off-by: Tomek Grabiec <[email protected]>
---
arch/x86/insn-selector.brg | 27 +++++++++++++++++++++++----
include/jit/compiler.h | 2 +-
jit/trace-jit.c | 7 +++----
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 204b5d5..c255438 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -2781,13 +2781,32 @@ static void select_trace_return_value(struct
basic_block *s,
struct var_info *eax = get_fixed_var(s->b_parent, MACH_REG_xAX);
struct var_info *esp = get_fixed_var(s->b_parent, MACH_REG_xSP);
- select_insn(s, tree, reg_insn(INSN_PUSH_REG, eax));
+ enum vm_type ret_vm_type = method_return_type(vmm);
+
+ if (ret_vm_type == J_FLOAT) {
+ select_insn(s, tree, imm_reg_insn(INSN_SUB_IMM_REG, 4, esp));
+ select_insn(s, tree, membase_insn(INSN_FSTP_MEMBASE, esp, 0));
+ } else if (ret_vm_type == J_DOUBLE) {
+ select_insn(s, tree, imm_reg_insn(INSN_SUB_IMM_REG, 8, esp));
+ select_insn(s, tree, membase_insn(INSN_FSTP_64_MEMBASE, esp,
0));
+ } else {
+ select_insn(s, tree, reg_insn(INSN_PUSH_REG, eax));
+ }
+
select_insn(s, tree, imm_insn(INSN_PUSH_IMM, (unsigned long) vmm));
select_insn(s, tree, rel_insn(INSN_CALL_REL,
(unsigned long) trace_return_value));
- select_insn(s, tree, imm_reg_insn(INSN_ADD_IMM_REG, sizeof(void *),
- esp));
- select_insn(s, tree, reg_insn(INSN_POP_REG, eax));
+ select_insn(s, tree, imm_reg_insn(INSN_ADD_IMM_REG, sizeof(void *),
esp));
+
+ if (ret_vm_type == J_FLOAT) {
+ select_insn(s, tree, membase_insn(INSN_FLD_MEMBASE, esp, 0));
+ select_insn(s, tree, imm_reg_insn(INSN_ADD_IMM_REG, 4, esp));
+ } else if (ret_vm_type == J_DOUBLE) {
+ select_insn(s, tree, membase_insn(INSN_FLD_64_MEMBASE, esp, 0));
+ select_insn(s, tree, imm_reg_insn(INSN_ADD_IMM_REG, 8, esp));
+ } else {
+ select_insn(s, tree, reg_insn(INSN_POP_REG, eax));
+ }
}
static void select_vm_native_call(struct basic_block *s, struct tree_node
*tree,
diff --git a/include/jit/compiler.h b/include/jit/compiler.h
index 9bf2ea2..0c65253 100644
--- a/include/jit/compiler.h
+++ b/include/jit/compiler.h
@@ -120,6 +120,6 @@ void trace_exception_handler(struct compilation_unit *,
unsigned char *);
void trace_exception_unwind(struct jit_stack_frame *);
void trace_exception_unwind_to_native(struct jit_stack_frame *);
void trace_bytecode(struct vm_method *);
-void trace_return_value(struct vm_method *, unsigned long);
+void trace_return_value(struct vm_method *, unsigned long long);
#endif
diff --git a/jit/trace-jit.c b/jit/trace-jit.c
index b8c2e0c..fe615c6 100644
--- a/jit/trace-jit.c
+++ b/jit/trace-jit.c
@@ -673,7 +673,7 @@ void trace_bytecode(struct vm_method *method)
trace_printf("\n");
}
-void trace_return_value(struct vm_method *vmm, unsigned long value)
+void trace_return_value(struct vm_method *vmm, unsigned long long value)
{
enum vm_type type;
int dummy;
@@ -683,11 +683,10 @@ void trace_return_value(struct vm_method *vmm, unsigned
long value)
trace_printf("trace return: %s.%s%s\n", vmm->class->name, vmm->name,
vmm->type);
- if (type == J_VOID || type == J_LONG || type == J_FLOAT ||
- type == J_DOUBLE)
+ if (type == J_VOID || type == J_LONG)
return;
trace_printf("%12s: ", get_vm_type_name(type));
- print_arg(type, &value, &dummy);
+ print_arg(type,(unsigned long *) &value, &dummy);
trace_flush();
}
--
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