Merge pull request #20571 from hrydgard/more-atrac-refactor

More Atrac3 refactor
This commit is contained in:
Henrik Rydgård committed 2025-07-09 16:34:13 +02:00
1 parent db5ef6fb87
commit cc83071c2f
15 files changed
+681 -371

No files matched your search

+3 -1
View File
@@ -120,10 +120,11 @@ void JitBlockCache::Shutdown() {
// This clears the JIT cache. It's called from JitCache.cpp when the JIT cache
// is full and when saving and loading states.
void JitBlockCache::Clear() {
// Note: We intentionally clear the block_map_ first to avoid O(N^2) behavior in RemoveBlockMap
block_map_.clear();
for (int i = 0; i < num_blocks_; i++) {
DestroyBlock(i, DestroyType::CLEAR);
}
block_map_.clear();
proxyBlockMap_.clear();
links_to_.clear();
num_blocks_ = 0;
@@ -238,6 +239,7 @@ void JitBlockCache::RemoveBlockMap(int block_num) {
// TODO: This is O(n), so O(n^2) when called for every block.
for (auto it = block_map_.begin(); it != block_map_.end(); ++it) {
if (it->second == (u32)block_num) {
_dbg_assert_(false);
block_map_.erase(it);
break;
}