JitArm64: Optimize a few tail calls

Maybe "tail call" isn't quite the right term for what this code
is doing, since it's jumping to the dispatcher rather than
returning, but it's the same optimization as for a tail call.
This commit is contained in:
JosJuice 2021-08-20 15:21:24 +02:00
parent dbf5dca11c
commit 351d095fff
1 changed files with 7 additions and 5 deletions

View File

@ -344,8 +344,9 @@ void JitArm64::IntializeSpeculativeConstants()
STR(IndexType::Unsigned, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc)); STR(IndexType::Unsigned, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc));
MOVP2R(ARM64Reg::X8, &JitInterface::CompileExceptionCheck); MOVP2R(ARM64Reg::X8, &JitInterface::CompileExceptionCheck);
MOVI2R(ARM64Reg::W0, static_cast<u32>(JitInterface::ExceptionType::SpeculativeConstants)); MOVI2R(ARM64Reg::W0, static_cast<u32>(JitInterface::ExceptionType::SpeculativeConstants));
BLR(ARM64Reg::X8); // Write dispatcher_no_check to LR for tail call
B(dispatcher_no_check); MOVP2R(ARM64Reg::X30, dispatcher_no_check);
BR(ARM64Reg::X8);
SwitchToNearCode(); SwitchToNearCode();
} }
@ -837,10 +838,11 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
SetJumpTarget(fail); SetJumpTarget(fail);
MOVI2R(DISPATCHER_PC, js.blockStart); MOVI2R(DISPATCHER_PC, js.blockStart);
STR(IndexType::Unsigned, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc)); STR(IndexType::Unsigned, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc));
MOVP2R(ARM64Reg::X8, &JitInterface::CompileExceptionCheck);
MOVI2R(ARM64Reg::W0, static_cast<u32>(JitInterface::ExceptionType::PairedQuantize)); MOVI2R(ARM64Reg::W0, static_cast<u32>(JitInterface::ExceptionType::PairedQuantize));
MOVP2R(ARM64Reg::X1, &JitInterface::CompileExceptionCheck); // Write dispatcher_no_check to LR for tail call
BLR(ARM64Reg::X1); MOVP2R(ARM64Reg::X30, dispatcher_no_check);
B(dispatcher_no_check); BR(ARM64Reg::X8);
SwitchToNearCode(); SwitchToNearCode();
SetJumpTarget(no_fail); SetJumpTarget(no_fail);
js.assumeNoPairedQuantize = true; js.assumeNoPairedQuantize = true;