yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

macro_jit_x64: Eliminate variable shadowing in Compile_ProcessResult()

We can reduce the capture scope so that it's not possible for both "reg"
variables to clash with one another.

While we're at it, we can prevent unnecessary copies while we're at it.
This commit is contained in:
Lioncash 2020-06-19 21:57:41 -04:00
parent 4514b80b3e
commit 811bff009e
1 changed files with 2 additions and 2 deletions

View File

@ -546,7 +546,7 @@ Xbyak::Reg32 MacroJITx64Impl::Compile_GetRegister(u32 index, Xbyak::Reg32 dst) {
} }
void MacroJITx64Impl::Compile_ProcessResult(Macro::ResultOperation operation, u32 reg) { void MacroJITx64Impl::Compile_ProcessResult(Macro::ResultOperation operation, u32 reg) {
auto SetRegister = [=](u32 reg, Xbyak::Reg32 result) { const auto SetRegister = [this](u32 reg, const Xbyak::Reg32& result) {
// Register 0 is supposed to always return 0. NOP is implemented as a store to the zero // Register 0 is supposed to always return 0. NOP is implemented as a store to the zero
// register. // register.
if (reg == 0) { if (reg == 0) {
@ -554,7 +554,7 @@ void MacroJITx64Impl::Compile_ProcessResult(Macro::ResultOperation operation, u3
} }
mov(dword[STATE + offsetof(JITState, registers) + reg * sizeof(u32)], result); mov(dword[STATE + offsetof(JITState, registers) + reg * sizeof(u32)], result);
}; };
auto SetMethodAddress = [=](Xbyak::Reg32 reg) { mov(METHOD_ADDRESS, reg); }; const auto SetMethodAddress = [this](const Xbyak::Reg32& reg) { mov(METHOD_ADDRESS, reg); };
switch (operation) { switch (operation) {
case Macro::ResultOperation::IgnoreAndFetch: case Macro::ResultOperation::IgnoreAndFetch: