From da62ec56f9619937872a3743f005ecb6d66fbe57 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 25 May 2013 00:41:01 -0700 Subject: [PATCH] Adding the ret required for tail calls. --- src/xenia/cpu/x64/x64_emitter.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xenia/cpu/x64/x64_emitter.cc b/src/xenia/cpu/x64/x64_emitter.cc index 506dae37a..77064eda0 100644 --- a/src/xenia/cpu/x64/x64_emitter.cc +++ b/src/xenia/cpu/x64/x64_emitter.cc @@ -645,16 +645,13 @@ int X64Emitter::CallFunction(FunctionSymbol* target_symbol, c.alloc(lr, rdx); // TODO(benvanik): just use jmp when fixed: https://code.google.com/p/asmjit/issues/detail?id=67 // c.jmp(target_ptr); - c.push(imm(target_ptr)); - c.ret(); #else // Calling convetion: kX86FuncConvX64U // Arguments passed as RDI, RSI, RDX, RCX, R8, R9 c.alloc(c.getGpArg(0), rdi); c.alloc(lr, rsi); // TODO(benvanik): just use jmp when fixed: https://code.google.com/p/asmjit/issues/detail?id=67 - c.push(imm((uint64_t)target_ptr)); - c.ret(); + // c.jmp(target_ptr); #endif // ASMJIT_WINDOWS } else { #else @@ -667,6 +664,9 @@ int X64Emitter::CallFunction(FunctionSymbol* target_symbol, FuncBuilder2()); call->setArgument(0, c.getGpArg(0)); call->setArgument(1, lr); + if (tail) { + c.ret(); + } } return 0;