diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp index 34f7d51593..eca1afd32d 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp +++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp @@ -311,7 +311,6 @@ void CachedInterpreter::Jit(u32 address) js.numFloatingPointInst = 0; js.curBlock = b; - b->checkedEntry = GetCodePtr(); b->normalEntry = GetCodePtr(); for (u32 i = 0; i < code_block.m_num_instructions; i++) @@ -374,7 +373,7 @@ void CachedInterpreter::Jit(u32 address) } m_code.emplace_back(); - b->codeSize = (u32)(GetCodePtr() - b->checkedEntry); + b->codeSize = static_cast(GetCodePtr() - b->normalEntry); b->originalSize = code_block.m_num_instructions; m_block_cache.FinalizeBlock(*b, jo.enableBlocklink, code_block.m_physical_addresses); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index 313b840132..1f4e86ffbf 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -830,9 +830,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) js.numFloatingPointInst = 0; // TODO: Test if this or AlignCode16 make a difference from GetCodePtr - u8* const start = AlignCode4(); - b->checkedEntry = start; - b->normalEntry = start; + b->normalEntry = AlignCode4(); // Used to get a trace of the last few blocks before a crash, sometimes VERY useful if (m_im_here_debug) @@ -1140,7 +1138,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) return false; } - b->codeSize = (u32)(GetCodePtr() - start); + b->codeSize = static_cast(GetCodePtr() - b->normalEntry); b->originalSize = code_block.m_num_instructions; #ifdef JIT_LOG_GENERATED_CODE diff --git a/Source/Core/Core/PowerPC/Jit64Common/BlockCache.cpp b/Source/Core/Core/PowerPC/Jit64Common/BlockCache.cpp index 3b0b7e5471..351c6e1c09 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/BlockCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/BlockCache.cpp @@ -14,8 +14,7 @@ JitBlockCache::JitBlockCache(JitBase& jit) : JitBaseBlockCache{jit} void JitBlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest) { u8* location = source.exitPtrs; - const u8* address = - dest ? dest->checkedEntry : m_jit.GetAsmRoutines()->dispatcher_no_timing_check; + const u8* address = dest ? dest->normalEntry : m_jit.GetAsmRoutines()->dispatcher_no_timing_check; if (source.call) { Gen::XEmitter emit(location, location + 5); @@ -42,11 +41,9 @@ void JitBlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const JitBl void JitBlockCache::WriteDestroyBlock(const JitBlock& block) { - // Only clear the entry points as we might still be within this block. - Gen::XEmitter emit(block.checkedEntry, block.checkedEntry + 1); + // Only clear the entry point as we might still be within this block. + Gen::XEmitter emit(block.normalEntry, block.normalEntry + 1); emit.INT3(); - Gen::XEmitter emit2(block.normalEntry, block.normalEntry + 1); - emit2.INT3(); } void JitBlockCache::Init() diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index f8b2a99f72..8bf5178616 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -848,9 +848,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) js.numLoadStoreInst = 0; js.numFloatingPointInst = 0; - u8* const start = GetWritableCodePtr(); - b->checkedEntry = start; - b->normalEntry = start; + b->normalEntry = GetWritableCodePtr(); // Conditionally add profiling code. if (jo.profile_blocks) @@ -1117,7 +1115,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) return false; } - b->codeSize = (u32)(GetCodePtr() - start); + b->codeSize = static_cast(GetCodePtr() - b->normalEntry); b->originalSize = code_block.m_num_instructions; FlushIcache(); diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp index f0e6922df8..2fcefa019c 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp @@ -96,11 +96,10 @@ void JitArm64BlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const void JitArm64BlockCache::WriteDestroyBlock(const JitBlock& block) { - // Only clear the entry points as we might still be within this block. - ARM64XEmitter emit(block.checkedEntry, block.normalEntry + 4); + // Only clear the entry point as we might still be within this block. + ARM64XEmitter emit(block.normalEntry, block.normalEntry + 4); const Common::ScopedJITPageWriteAndNoExecute enable_jit_page_writes; - while (emit.GetWritableCodePtr() <= block.normalEntry) - emit.BRK(0x123); + emit.BRK(0x123); emit.FlushIcache(); } diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index 6b746d94d1..a41ebb71b2 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -163,12 +163,12 @@ void JitBaseBlockCache::FinalizeBlock(JitBlock& block, bool block_link, if (Common::JitRegister::IsEnabled() && (symbol = g_symbolDB.GetSymbolFromAddr(block.effectiveAddress)) != nullptr) { - Common::JitRegister::Register(block.checkedEntry, block.codeSize, "JIT_PPC_{}_{:08x}", + Common::JitRegister::Register(block.normalEntry, block.codeSize, "JIT_PPC_{}_{:08x}", symbol->function_name.c_str(), block.physicalAddress); } else { - Common::JitRegister::Register(block.checkedEntry, block.codeSize, "JIT_PPC_{:08x}", + Common::JitRegister::Register(block.normalEntry, block.codeSize, "JIT_PPC_{:08x}", block.physicalAddress); } } diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/PowerPC/JitCommon/JitCache.h index 61b5966a14..fb72cbe07e 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.h @@ -30,9 +30,6 @@ struct JitBlockData u8* far_begin; u8* far_end; - // A special entry point for block linking; usually used to check the - // downcount. - u8* checkedEntry; // The normal entry point for the block, returned by Dispatch(). u8* normalEntry; diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index 5e369067f6..0aed99b225 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -187,7 +187,7 @@ JitInterface::GetHostCode(u32 address) const } GetHostCodeResult result; - result.code = block->checkedEntry; + result.code = block->normalEntry; result.code_size = block->codeSize; result.entry_address = block->effectiveAddress; return result;