Schedule an event to clear the jit cache when adding the first and last

memory check

Also fix an oddity in the case when the last memory check is deleted,
the jit cache was supposed to be cleared in that case, but it was out of
the for loop that finds the one to delete so it was never run.
Naturally, the same fix for the adding the first memory check was
applied.
This commit is contained in:
aldelaro5 2016-08-20 23:59:18 -04:00
parent 0480ca48fb
commit a39e331aad
1 changed files with 3 additions and 3 deletions

View File

@ -171,7 +171,7 @@ void MemChecks::Add(const TMemCheck& _rMemoryCheck)
// If this is the first one, clear the JIT cache so it can switch to // If this is the first one, clear the JIT cache so it can switch to
// watchpoint-compatible code. // watchpoint-compatible code.
if (!had_any && jit) if (!had_any && jit)
jit->ClearCache(); jit->GetBlockCache()->SchedulateClearCacheThreadSafe();
} }
void MemChecks::Remove(u32 _Address) void MemChecks::Remove(u32 _Address)
@ -181,11 +181,11 @@ void MemChecks::Remove(u32 _Address)
if (i->StartAddress == _Address) if (i->StartAddress == _Address)
{ {
m_MemChecks.erase(i); m_MemChecks.erase(i);
if (!HasAny() && jit)
jit->GetBlockCache()->SchedulateClearCacheThreadSafe();
return; return;
} }
} }
if (!HasAny() && jit)
jit->ClearCache();
} }
TMemCheck* MemChecks::GetMemCheck(u32 address) TMemCheck* MemChecks::GetMemCheck(u32 address)