mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
CPU/CodeCache: Add InvalidateAll() method
This commit is contained in:
parent
fe2062ff9f
commit
c440593788
|
@ -836,12 +836,8 @@ void InvalidCodeFunction()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void InvalidateBlocksWithPageIndex(u32 page_index)
|
static void InvalidateBlock(CodeBlock* block)
|
||||||
{
|
{
|
||||||
DebugAssert(page_index < Bus::RAM_8MB_CODE_PAGE_COUNT);
|
|
||||||
auto& blocks = m_ram_block_map[page_index];
|
|
||||||
for (CodeBlock* block : blocks)
|
|
||||||
{
|
|
||||||
// Invalidate forces the block to be checked again.
|
// Invalidate forces the block to be checked again.
|
||||||
Log_DebugPrintf("Invalidating block at 0x%08X", block->GetPC());
|
Log_DebugPrintf("Invalidating block at 0x%08X", block->GetPC());
|
||||||
block->invalidated = true;
|
block->invalidated = true;
|
||||||
|
@ -867,13 +863,34 @@ void InvalidateBlocksWithPageIndex(u32 page_index)
|
||||||
#ifdef WITH_RECOMPILER
|
#ifdef WITH_RECOMPILER
|
||||||
SetFastMap(block->GetPC(), FastCompileBlockFunction);
|
SetFastMap(block->GetPC(), FastCompileBlockFunction);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InvalidateBlocksWithPageIndex(u32 page_index)
|
||||||
|
{
|
||||||
|
DebugAssert(page_index < Bus::RAM_8MB_CODE_PAGE_COUNT);
|
||||||
|
auto& blocks = m_ram_block_map[page_index];
|
||||||
|
for (CodeBlock* block : blocks)
|
||||||
|
InvalidateBlock(block);
|
||||||
|
|
||||||
// Block will be re-added next execution.
|
// Block will be re-added next execution.
|
||||||
blocks.clear();
|
blocks.clear();
|
||||||
Bus::ClearRAMCodePage(page_index);
|
Bus::ClearRAMCodePage(page_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InvalidateAll()
|
||||||
|
{
|
||||||
|
for (auto& it : s_blocks)
|
||||||
|
{
|
||||||
|
CodeBlock* block = it.second;
|
||||||
|
if (block && !block->invalidated)
|
||||||
|
InvalidateBlock(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bus::ClearRAMCodePageFlags();
|
||||||
|
for (auto& it : m_ram_block_map)
|
||||||
|
it.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void RemoveReferencesToBlock(CodeBlock* block)
|
void RemoveReferencesToBlock(CodeBlock* block)
|
||||||
{
|
{
|
||||||
BlockMap::iterator iter = s_blocks.find(block->key.GetPC());
|
BlockMap::iterator iter = s_blocks.find(block->key.GetPC());
|
||||||
|
|
|
@ -140,6 +140,9 @@ void Reinitialize();
|
||||||
/// Invalidates all blocks which are in the range of the specified code page.
|
/// Invalidates all blocks which are in the range of the specified code page.
|
||||||
void InvalidateBlocksWithPageIndex(u32 page_index);
|
void InvalidateBlocksWithPageIndex(u32 page_index);
|
||||||
|
|
||||||
|
/// Invalidates all blocks in the cache.
|
||||||
|
void InvalidateAll();
|
||||||
|
|
||||||
template<PGXPMode pgxp_mode>
|
template<PGXPMode pgxp_mode>
|
||||||
void InterpretCachedBlock(const CodeBlock& block);
|
void InterpretCachedBlock(const CodeBlock& block);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue