Skip to content

Commit

Permalink
Jit: Remove checkedEntry
Browse files Browse the repository at this point in the history
It's now always identical to normalEntry.
  • Loading branch information
JosJuice committed Oct 22, 2022
1 parent 2c5fe5a commit cfe9c1a
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 20 deletions.
Expand Up @@ -256,7 +256,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++)
Expand Down Expand Up @@ -318,7 +317,7 @@ void CachedInterpreter::Jit(u32 address)
}
m_code.emplace_back();

b->codeSize = (u32)(GetCodePtr() - b->checkedEntry);
b->codeSize = (u32)(GetCodePtr() - b->normalEntry);
b->originalSize = code_block.m_num_instructions;

m_block_cache.FinalizeBlock(*b, jo.enableBlocklink, code_block.m_physical_addresses);
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/PowerPC/Jit64/Jit.cpp
Expand Up @@ -910,7 +910,6 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)

// TODO: Test if this or AlignCode16 make a difference from GetCodePtr
u8* const start = AlignCode4();
b->checkedEntry = start;
b->normalEntry = start;

// Used to get a trace of the last few blocks before a crash, sometimes VERY useful
Expand Down
9 changes: 3 additions & 6 deletions Source/Core/Core/PowerPC/Jit64Common/BlockCache.cpp
Expand Up @@ -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);
Expand All @@ -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()
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/PowerPC/JitArm64/Jit.cpp
Expand Up @@ -805,7 +805,6 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.numFloatingPointInst = 0;

u8* const start = GetWritableCodePtr();
b->checkedEntry = start;
b->normalEntry = start;

// Conditionally add profiling code.
Expand Down
7 changes: 3 additions & 4 deletions Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp
Expand Up @@ -92,11 +92,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();
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/PowerPC/JitCommon/JitCache.cpp
Expand Up @@ -132,12 +132,12 @@ void JitBaseBlockCache::FinalizeBlock(JitBlock& block, bool block_link,
if (JitRegister::IsEnabled() &&
(symbol = g_symbolDB.GetSymbolFromAddr(block.effectiveAddress)) != nullptr)
{
JitRegister::Register(block.checkedEntry, block.codeSize, "JIT_PPC_{}_{:08x}",
JitRegister::Register(block.normalEntry, block.codeSize, "JIT_PPC_{}_{:08x}",
symbol->function_name.c_str(), block.physicalAddress);
}
else
{
JitRegister::Register(block.checkedEntry, block.codeSize, "JIT_PPC_{:08x}",
JitRegister::Register(block.normalEntry, block.codeSize, "JIT_PPC_{:08x}",
block.physicalAddress);
}
}
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/Core/PowerPC/JitCommon/JitCache.h
Expand Up @@ -29,9 +29,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;

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/JitInterface.cpp
Expand Up @@ -179,7 +179,7 @@ int GetHostCode(u32* address, const u8** code, u32* code_size)
}
}

*code = block->checkedEntry;
*code = block->normalEntry;
*code_size = block->codeSize;
*address = block->effectiveAddress;
return 0;
Expand Down

0 comments on commit cfe9c1a

Please sign in to comment.