mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
CPU/CodeCache: Don't compile invalid jumps via block links
This commit is contained in:
parent
d69d25431e
commit
ffef0c2e38
@ -61,6 +61,7 @@ static void ClearBlocks();
|
|||||||
|
|
||||||
static Block* LookupBlock(u32 pc);
|
static Block* LookupBlock(u32 pc);
|
||||||
static Block* CreateBlock(u32 pc, const BlockInstructionList& instructions, const BlockMetadata& metadata);
|
static Block* CreateBlock(u32 pc, const BlockInstructionList& instructions, const BlockMetadata& metadata);
|
||||||
|
static bool HasBlockLUT(u32 pc);
|
||||||
static bool IsBlockCodeCurrent(const Block* block);
|
static bool IsBlockCodeCurrent(const Block* block);
|
||||||
static bool RevalidateBlock(Block* block);
|
static bool RevalidateBlock(Block* block);
|
||||||
static PageProtectionMode GetProtectionModeForPC(u32 pc);
|
static PageProtectionMode GetProtectionModeForPC(u32 pc);
|
||||||
@ -362,6 +363,12 @@ CPU::CodeCache::Block* CPU::CodeCache::LookupBlock(u32 pc)
|
|||||||
return s_block_lut[table][idx];
|
return s_block_lut[table][idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CPU::CodeCache::HasBlockLUT(u32 pc)
|
||||||
|
{
|
||||||
|
const u32 table = pc >> LUT_TABLE_SHIFT;
|
||||||
|
return (s_block_lut[table] != nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
CPU::CodeCache::Block* CPU::CodeCache::CreateBlock(u32 pc, const BlockInstructionList& instructions,
|
CPU::CodeCache::Block* CPU::CodeCache::CreateBlock(u32 pc, const BlockInstructionList& instructions,
|
||||||
const BlockMetadata& metadata)
|
const BlockMetadata& metadata)
|
||||||
{
|
{
|
||||||
@ -1372,7 +1379,7 @@ const void* CPU::CodeCache::CreateBlockLink(Block* block, void* code, u32 newpc)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dst = g_compile_or_revalidate_block;
|
dst = HasBlockLUT(newpc) ? g_compile_or_revalidate_block : g_interpret_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockLinkMap::iterator iter = s_block_links.emplace(newpc, code);
|
BlockLinkMap::iterator iter = s_block_links.emplace(newpc, code);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user