Jit: Remove checkedEntry

It's now always identical to normalEntry.
This commit is contained in:
JosJuice 2022-10-22 14:09:03 +02:00
parent f78ba9ac55
commit 1813f0fdb5
8 changed files with 14 additions and 26 deletions

View File

@ -311,7 +311,6 @@ void CachedInterpreter::Jit(u32 address)
js.numFloatingPointInst = 0; js.numFloatingPointInst = 0;
js.curBlock = b; js.curBlock = b;
b->checkedEntry = GetCodePtr();
b->normalEntry = GetCodePtr(); b->normalEntry = GetCodePtr();
for (u32 i = 0; i < code_block.m_num_instructions; i++) for (u32 i = 0; i < code_block.m_num_instructions; i++)
@ -374,7 +373,7 @@ void CachedInterpreter::Jit(u32 address)
} }
m_code.emplace_back(); m_code.emplace_back();
b->codeSize = (u32)(GetCodePtr() - b->checkedEntry); b->codeSize = static_cast<u32>(GetCodePtr() - b->normalEntry);
b->originalSize = code_block.m_num_instructions; b->originalSize = code_block.m_num_instructions;
m_block_cache.FinalizeBlock(*b, jo.enableBlocklink, code_block.m_physical_addresses); m_block_cache.FinalizeBlock(*b, jo.enableBlocklink, code_block.m_physical_addresses);

View File

@ -830,9 +830,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.numFloatingPointInst = 0; js.numFloatingPointInst = 0;
// TODO: Test if this or AlignCode16 make a difference from GetCodePtr // TODO: Test if this or AlignCode16 make a difference from GetCodePtr
u8* const start = AlignCode4(); b->normalEntry = AlignCode4();
b->checkedEntry = start;
b->normalEntry = start;
// Used to get a trace of the last few blocks before a crash, sometimes VERY useful // Used to get a trace of the last few blocks before a crash, sometimes VERY useful
if (m_im_here_debug) if (m_im_here_debug)
@ -1140,7 +1138,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
return false; return false;
} }
b->codeSize = (u32)(GetCodePtr() - start); b->codeSize = static_cast<u32>(GetCodePtr() - b->normalEntry);
b->originalSize = code_block.m_num_instructions; b->originalSize = code_block.m_num_instructions;
#ifdef JIT_LOG_GENERATED_CODE #ifdef JIT_LOG_GENERATED_CODE

View File

@ -14,8 +14,7 @@ JitBlockCache::JitBlockCache(JitBase& jit) : JitBaseBlockCache{jit}
void JitBlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest) void JitBlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest)
{ {
u8* location = source.exitPtrs; u8* location = source.exitPtrs;
const u8* address = const u8* address = dest ? dest->normalEntry : m_jit.GetAsmRoutines()->dispatcher_no_timing_check;
dest ? dest->checkedEntry : m_jit.GetAsmRoutines()->dispatcher_no_timing_check;
if (source.call) if (source.call)
{ {
Gen::XEmitter emit(location, location + 5); 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) void JitBlockCache::WriteDestroyBlock(const JitBlock& block)
{ {
// Only clear the entry points as we might still be within this block. // Only clear the entry point as we might still be within this block.
Gen::XEmitter emit(block.checkedEntry, block.checkedEntry + 1); Gen::XEmitter emit(block.normalEntry, block.normalEntry + 1);
emit.INT3(); emit.INT3();
Gen::XEmitter emit2(block.normalEntry, block.normalEntry + 1);
emit2.INT3();
} }
void JitBlockCache::Init() void JitBlockCache::Init()

View File

@ -848,9 +848,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.numLoadStoreInst = 0; js.numLoadStoreInst = 0;
js.numFloatingPointInst = 0; js.numFloatingPointInst = 0;
u8* const start = GetWritableCodePtr(); b->normalEntry = GetWritableCodePtr();
b->checkedEntry = start;
b->normalEntry = start;
// Conditionally add profiling code. // Conditionally add profiling code.
if (jo.profile_blocks) if (jo.profile_blocks)
@ -1117,7 +1115,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
return false; return false;
} }
b->codeSize = (u32)(GetCodePtr() - start); b->codeSize = static_cast<u32>(GetCodePtr() - b->normalEntry);
b->originalSize = code_block.m_num_instructions; b->originalSize = code_block.m_num_instructions;
FlushIcache(); FlushIcache();

View File

@ -96,11 +96,10 @@ void JitArm64BlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const
void JitArm64BlockCache::WriteDestroyBlock(const JitBlock& block) void JitArm64BlockCache::WriteDestroyBlock(const JitBlock& block)
{ {
// Only clear the entry points as we might still be within this block. // Only clear the entry point as we might still be within this block.
ARM64XEmitter emit(block.checkedEntry, block.normalEntry + 4); ARM64XEmitter emit(block.normalEntry, block.normalEntry + 4);
const Common::ScopedJITPageWriteAndNoExecute enable_jit_page_writes; const Common::ScopedJITPageWriteAndNoExecute enable_jit_page_writes;
while (emit.GetWritableCodePtr() <= block.normalEntry) emit.BRK(0x123);
emit.BRK(0x123);
emit.FlushIcache(); emit.FlushIcache();
} }

View File

@ -163,12 +163,12 @@ void JitBaseBlockCache::FinalizeBlock(JitBlock& block, bool block_link,
if (Common::JitRegister::IsEnabled() && if (Common::JitRegister::IsEnabled() &&
(symbol = g_symbolDB.GetSymbolFromAddr(block.effectiveAddress)) != nullptr) (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); symbol->function_name.c_str(), block.physicalAddress);
} }
else else
{ {
Common::JitRegister::Register(block.checkedEntry, block.codeSize, "JIT_PPC_{:08x}", Common::JitRegister::Register(block.normalEntry, block.codeSize, "JIT_PPC_{:08x}",
block.physicalAddress); block.physicalAddress);
} }
} }

View File

@ -30,9 +30,6 @@ struct JitBlockData
u8* far_begin; u8* far_begin;
u8* far_end; 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(). // The normal entry point for the block, returned by Dispatch().
u8* normalEntry; u8* normalEntry;

View File

@ -187,7 +187,7 @@ JitInterface::GetHostCode(u32 address) const
} }
GetHostCodeResult result; GetHostCodeResult result;
result.code = block->checkedEntry; result.code = block->normalEntry;
result.code_size = block->codeSize; result.code_size = block->codeSize;
result.entry_address = block->effectiveAddress; result.entry_address = block->effectiveAddress;
return result; return result;