diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 1f85560234..53a0c49998 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -246,7 +246,7 @@ void Jit64::Init() // important: do this *after* generating the global asm routines, because we can't use farcode in // them. // it'll crash because the farcode functions get cleared on JIT clears. - farcode.Init(jo.memcheck ? FARCODE_SIZE_MMU : FARCODE_SIZE); + m_far_code.Init(jo.memcheck ? FARCODE_SIZE_MMU : FARCODE_SIZE); Clear(); code_block.m_stats = &js.st; @@ -259,7 +259,7 @@ void Jit64::ClearCache() { blocks.Clear(); trampolines.ClearCodeSpace(); - farcode.ClearCodeSpace(); + m_far_code.ClearCodeSpace(); ClearCodeSpace(); Clear(); UpdateMemoryOptions(); @@ -273,7 +273,7 @@ void Jit64::Shutdown() blocks.Shutdown(); trampolines.Shutdown(); asm_routines.Shutdown(); - farcode.Shutdown(); + m_far_code.Shutdown(); } void Jit64::FallBackToInterpreter(UGeckoInstruction inst) @@ -542,8 +542,8 @@ void Jit64::Jit(u32 em_address) #endif } - if (IsAlmostFull() || farcode.IsAlmostFull() || trampolines.IsAlmostFull() || blocks.IsFull() || - SConfig::GetInstance().bJITNoBlockCache) + if (IsAlmostFull() || m_far_code.IsAlmostFull() || trampolines.IsAlmostFull() || + blocks.IsFull() || SConfig::GetInstance().bJITNoBlockCache) { ClearCache(); } @@ -877,12 +877,12 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc SwitchToFarCode(); if (!js.fastmemLoadStore) { - exceptionHandlerAtLoc[js.fastmemLoadStore] = nullptr; + m_exception_handler_at_loc[js.fastmemLoadStore] = nullptr; SetJumpTarget(js.fixupExceptionHandler ? js.exceptionHandler : memException); } else { - exceptionHandlerAtLoc[js.fastmemLoadStore] = GetWritableCodePtr(); + m_exception_handler_at_loc[js.fastmemLoadStore] = GetWritableCodePtr(); } BitSet32 gprToFlush = BitSet32::AllTrue(32); diff --git a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp index 0705058e1d..a5c488758d 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.cpp @@ -72,14 +72,14 @@ void EmuCodeBlock::MemoryExceptionCheck() void EmuCodeBlock::SwitchToFarCode() { - nearcode = GetWritableCodePtr(); - SetCodePtr(farcode.GetWritableCodePtr()); + m_near_code = GetWritableCodePtr(); + SetCodePtr(m_far_code.GetWritableCodePtr()); } void EmuCodeBlock::SwitchToNearCode() { - farcode.SetCodePtr(GetWritableCodePtr()); - SetCodePtr(nearcode); + m_far_code.SetCodePtr(GetWritableCodePtr()); + SetCodePtr(m_near_code); } FixupBranch EmuCodeBlock::CheckIfSafeAddress(const OpArg& reg_value, X64Reg reg_addr, @@ -110,7 +110,7 @@ FixupBranch EmuCodeBlock::CheckIfSafeAddress(const OpArg& reg_value, X64Reg reg_ if (scratch == reg_addr) POP(scratch); - return J_CC(CC_Z, farcode.Enabled()); + return J_CC(CC_Z, m_far_code.Enabled()); } void EmuCodeBlock::UnsafeLoadRegToReg(X64Reg reg_addr, X64Reg reg_value, int accessSize, s32 offset, @@ -344,7 +344,7 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg& opAddress, MovInfo mov; bool offsetAddedToAddress = UnsafeLoadToReg(reg_value, opAddress, accessSize, offset, signExtend, &mov); - TrampolineInfo& info = backPatchInfo[mov.address]; + TrampolineInfo& info = m_back_patch_info[mov.address]; info.pc = jit->js.compilerPC; info.nonAtomicSwapStoreSrc = mov.nonAtomicSwapStore ? mov.nonAtomicSwapStoreSrc : INVALID_REG; info.start = backpatchStart; @@ -391,7 +391,7 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg& opAddress, { FixupBranch slow = CheckIfSafeAddress(R(reg_value), reg_addr, registersInUse); UnsafeLoadToReg(reg_value, R(reg_addr), accessSize, 0, signExtend); - if (farcode.Enabled()) + if (m_far_code.Enabled()) SwitchToFarCode(); else exit = J(true); @@ -429,7 +429,7 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg& opAddress, if (fast_check_address) { - if (farcode.Enabled()) + if (m_far_code.Enabled()) { exit = J(true); SwitchToNearCode(); @@ -502,7 +502,7 @@ void EmuCodeBlock::SafeWriteRegToReg(OpArg reg_value, X64Reg reg_addr, int acces u8* backpatchStart = GetWritableCodePtr(); MovInfo mov; UnsafeWriteRegToReg(reg_value, reg_addr, accessSize, offset, swap, &mov); - TrampolineInfo& info = backPatchInfo[mov.address]; + TrampolineInfo& info = m_back_patch_info[mov.address]; info.pc = jit->js.compilerPC; info.nonAtomicSwapStoreSrc = mov.nonAtomicSwapStore ? mov.nonAtomicSwapStoreSrc : INVALID_REG; info.start = backpatchStart; @@ -546,7 +546,7 @@ void EmuCodeBlock::SafeWriteRegToReg(OpArg reg_value, X64Reg reg_addr, int acces { FixupBranch slow = CheckIfSafeAddress(reg_value, reg_addr, registersInUse); UnsafeWriteRegToReg(reg_value, reg_addr, accessSize, 0, swap); - if (farcode.Enabled()) + if (m_far_code.Enabled()) SwitchToFarCode(); else exit = J(true); @@ -592,7 +592,7 @@ void EmuCodeBlock::SafeWriteRegToReg(OpArg reg_value, X64Reg reg_addr, int acces if (fast_check_address) { - if (farcode.Enabled()) + if (m_far_code.Enabled()) { exit = J(true); SwitchToNearCode(); @@ -1142,6 +1142,6 @@ void EmuCodeBlock::SetFPRF(Gen::X64Reg xmm) void EmuCodeBlock::Clear() { - backPatchInfo.clear(); - exceptionHandlerAtLoc.clear(); + m_back_patch_info.clear(); + m_exception_handler_at_loc.clear(); } diff --git a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h index 066d6b446d..69e6359947 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h +++ b/Source/Core/Core/PowerPC/Jit64Common/EmuCodeBlock.h @@ -22,9 +22,6 @@ class Mapping; class EmuCodeBlock : public Gen::X64CodeBlock { public: - FarCodeCache farcode; - u8* nearcode; // Backed up when we switch to far code. - void MemoryExceptionCheck(); // Simple functions to switch between near and far code emitting @@ -108,6 +105,9 @@ public: void Clear(); protected: - std::unordered_map backPatchInfo; - std::unordered_map exceptionHandlerAtLoc; + FarCodeCache m_far_code; + u8* m_near_code; // Backed up when we switch to far code. + + std::unordered_map m_back_patch_info; + std::unordered_map m_exception_handler_at_loc; }; diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp b/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp index e8bb0c8504..a0d1b00d30 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64Base.cpp @@ -44,8 +44,8 @@ bool Jitx86Base::BackPatch(u32 emAddress, SContext* ctx) if (!IsInSpace(codePtr)) return false; // this will become a regular crash real soon after this - auto it = backPatchInfo.find(codePtr); - if (it == backPatchInfo.end()) + auto it = m_back_patch_info.find(codePtr); + if (it == m_back_patch_info.end()) { PanicAlert("BackPatch: no register use entry for address %p", codePtr); return false; @@ -56,8 +56,8 @@ bool Jitx86Base::BackPatch(u32 emAddress, SContext* ctx) u8* exceptionHandler = nullptr; if (jit->jo.memcheck) { - auto it2 = exceptionHandlerAtLoc.find(codePtr); - if (it2 != exceptionHandlerAtLoc.end()) + auto it2 = m_exception_handler_at_loc.find(codePtr); + if (it2 != m_exception_handler_at_loc.end()) exceptionHandler = it2->second; } diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp index 0ec2375896..051cf6a5a2 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp @@ -266,7 +266,7 @@ void JitIL::Init() blocks.Init(); asm_routines.Init(nullptr); - farcode.Init(jo.memcheck ? FARCODE_SIZE_MMU : FARCODE_SIZE); + m_far_code.Init(jo.memcheck ? FARCODE_SIZE_MMU : FARCODE_SIZE); Clear(); code_block.m_stats = &js.st; @@ -283,7 +283,7 @@ void JitIL::ClearCache() { blocks.Clear(); trampolines.ClearCodeSpace(); - farcode.ClearCodeSpace(); + m_far_code.ClearCodeSpace(); ClearCodeSpace(); Clear(); } @@ -300,7 +300,7 @@ void JitIL::Shutdown() blocks.Shutdown(); trampolines.Shutdown(); asm_routines.Shutdown(); - farcode.Shutdown(); + m_far_code.Shutdown(); } void JitIL::FallBackToInterpreter(UGeckoInstruction _inst) @@ -465,8 +465,8 @@ void JitIL::Trace() void JitIL::Jit(u32 em_address) { - if (IsAlmostFull() || farcode.IsAlmostFull() || trampolines.IsAlmostFull() || blocks.IsFull() || - SConfig::GetInstance().bJITNoBlockCache) + if (IsAlmostFull() || m_far_code.IsAlmostFull() || trampolines.IsAlmostFull() || + blocks.IsFull() || SConfig::GetInstance().bJITNoBlockCache) { ClearCache(); }