JitCache: Only call DestroyBlock on valid blocks.

This commit is contained in:
degasus 2017-01-16 22:55:21 +01:00
parent 113d6b3b84
commit 9b77a39767
2 changed files with 6 additions and 6 deletions

View File

@ -72,7 +72,8 @@ void JitBaseBlockCache::Clear()
m_jit.js.pairedQuantizeAddresses.clear(); m_jit.js.pairedQuantizeAddresses.clear();
for (int i = 1; i < num_blocks; i++) for (int i = 1; i < num_blocks; i++)
{ {
DestroyBlock(blocks[i], false); if (!block.invalid)
DestroyBlock(blocks[i]);
} }
links_to.clear(); links_to.clear();
block_map.clear(); block_map.clear();
@ -213,7 +214,7 @@ void JitBaseBlockCache::InvalidateICache(u32 address, const u32 length, bool for
auto it = block_map.lower_bound(std::make_pair(pAddr, 0)); auto it = block_map.lower_bound(std::make_pair(pAddr, 0));
while (it != block_map.end() && it->first.second < pAddr + length) while (it != block_map.end() && it->first.second < pAddr + length)
{ {
DestroyBlock(*it->second, true); DestroyBlock(*it->second);
it = block_map.erase(it); it = block_map.erase(it);
} }
@ -302,12 +303,11 @@ void JitBaseBlockCache::UnlinkBlock(const JitBlock& block)
} }
} }
void JitBaseBlockCache::DestroyBlock(JitBlock& block, bool invalidate) void JitBaseBlockCache::DestroyBlock(JitBlock& block)
{ {
if (block.invalid) if (block.invalid)
{ {
if (invalidate) PanicAlert("Invalidating invalid block %p", &block);
PanicAlert("Invalidating invalid block %p", &block);
return; return;
} }
block.invalid = true; block.invalid = true;

View File

@ -159,7 +159,7 @@ private:
void LinkBlockExits(JitBlock& block); void LinkBlockExits(JitBlock& block);
void LinkBlock(JitBlock& block); void LinkBlock(JitBlock& block);
void UnlinkBlock(const JitBlock& block); void UnlinkBlock(const JitBlock& block);
void DestroyBlock(JitBlock& block, bool invalidate); void DestroyBlock(JitBlock& block);
void MoveBlockIntoFastCache(u32 em_address, u32 msr); void MoveBlockIntoFastCache(u32 em_address, u32 msr);