Make memory breakpoint faster

Currently, slowmem is used at any time that memory breakpoints are in use.  This commit makes it so that whenever the DBAT gets updated, if the address is overllaping any memchecks, it forces the use of slowmem.  This allows to keep fastmem for any other cases and noticably increases performance when using memory breakpoints.
This commit is contained in:
aldelaro5
2017-02-24 21:10:22 -05:00
parent 0a8b5b79ef
commit 52fe05af6b
7 changed files with 39 additions and 25 deletions

View File

@ -11,8 +11,10 @@
#include "Common/CommonTypes.h"
#include "Common/DebugInterface.h"
#include "Core/Core.h"
#include "Core/PowerPC/JitCommon/JitBase.h"
#include "Core/PowerPC/JitCommon/JitCache.h"
#include "Core/PowerPC/PowerPC.h"
bool BreakPoints::IsAddressBreakPoint(u32 address) const
{
@ -168,13 +170,18 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mc_strings)
void MemChecks::Add(const TMemCheck& memory_check)
{
bool had_any = HasAny();
if (GetMemCheck(memory_check.start_address) == nullptr)
{
bool had_any = HasAny();
m_mem_checks.push_back(memory_check);
// If this is the first one, clear the JIT cache so it can switch to
// watchpoint-compatible code.
if (!had_any && g_jit)
g_jit->GetBlockCache()->SchedulateClearCacheThreadSafe();
bool lock = Core::PauseAndLock(true);
// If this is the first one, clear the JIT cache so it can switch to
// watchpoint-compatible code.
if (!had_any && g_jit)
g_jit->ClearCache();
PowerPC::DBATUpdated();
Core::PauseAndLock(false, lock);
}
}
void MemChecks::Remove(u32 address)
@ -184,8 +191,11 @@ void MemChecks::Remove(u32 address)
if (i->start_address == address)
{
m_mem_checks.erase(i);
bool lock = Core::PauseAndLock(true);
if (!HasAny() && g_jit)
g_jit->GetBlockCache()->SchedulateClearCacheThreadSafe();
g_jit->ClearCache();
PowerPC::DBATUpdated();
Core::PauseAndLock(false, lock);
return;
}
}