From b84f6a55ab848e41f23d9f712a116a276a6d0bda Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 23 Apr 2015 00:05:31 -0400 Subject: Automatically disable fastmem and enable memcheck when there are any watchpoints. - Move JitState::memcheck to JitOptions because it's an option. - Add JitOptions::fastmem; switch JIT code to checking that rather than bFastmem directly. - Add JitBase::UpdateMemoryOptions(), which sets both two JIT options (replacing the duplicate lines in Jit64 and JitIL that set memcheck from bMMU). - (!) The ARM JITs both had some lines that checked js.memcheck despite it being uninitialized in their cases. I've added UpdateMemoryOptions to both. There is a chance this could make something slower compared to the old behavior if the uninitialized value happened to be nonzero... hdkr should check this. - UpdateMemoryOptions forces jo.fastmem and jo.memcheck off and on, respectively, if there are any watchpoints set. - Also call that function from ClearCache. - Have MemChecks call ClearCache when the {first,last} watchpoint is {added,removed}. Enabling jo.memcheck (bah, confusing names) is currently pointless because hitting a watchpoint does not interrupt the basic block. That will change in the next commit. --- Source/Core/Common/BreakPoints.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Source/Core/Common/BreakPoints.cpp') diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp index 74dcb45030..2ee89389d3 100644 --- a/Source/Core/Common/BreakPoints.cpp +++ b/Source/Core/Common/BreakPoints.cpp @@ -165,8 +165,13 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs) void MemChecks::Add(const TMemCheck& _rMemoryCheck) { + bool had_any = HasAny(); if (GetMemCheck(_rMemoryCheck.StartAddress) == nullptr) m_MemChecks.push_back(_rMemoryCheck); + // If this is the first one, clear the JIT cache so it can switch to + // watchpoint-compatible code. + if (!had_any) + jit->ClearCache(); } void MemChecks::Remove(u32 _Address) @@ -179,6 +184,8 @@ void MemChecks::Remove(u32 _Address) return; } } + if (!HasAny()) + jit->ClearCache(); } TMemCheck *MemChecks::GetMemCheck(u32 address) -- cgit v1.2.3