The previous implementation passed an incorrect object reference to fixup_vtable() from code generated by emit_trampoline(). That was because *this gets passed by %rdi, not stack, on x86-64. Therefore, we now make use of the saved %rdi to pass it to fixup_vtable().
Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro> --- arch/x86/emit-code.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 5dd4e68..b333337 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -2920,6 +2920,21 @@ void emit_trampoline(struct compilation_unit *cu, MACH_REG_RCX); __emit64_test_membase_reg(buf, MACH_REG_RCX, 0, MACH_REG_RCX); + if (method_is_virtual(cu->method)) { + __emit64_push_reg(buf, MACH_REG_RAX); + + /* + * 0x30(%rsp) contains the %rdi passed + * to the trampoline, which we pushed earlier. + */ + __emit64_mov_imm_reg(buf, (unsigned long) cu, MACH_REG_RDI); + __emit64_mov_membase_reg(buf, MACH_REG_RSP, 0x30, MACH_REG_RSI); + __emit64_mov_reg_reg(buf, MACH_REG_RAX, MACH_REG_RDX); + __emit_call(buf, fixup_vtable); + + __emit64_pop_reg(buf, MACH_REG_RAX); + } + __emit64_pop_reg(buf, MACH_REG_R9); __emit64_pop_reg(buf, MACH_REG_R8); __emit64_pop_reg(buf, MACH_REG_RCX); -- 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