Jit: Allow BLR optimization without fastmem
While both fastmem and the BLR optimization depend on fault handling, the BLR optimization doesn't depend on fastmem, and there are cases where you might want the BLR optimization but not fastmem. For me personally, it's useful when I try to use a debugger on Android and have to disable fastmem so I don't get SIGSEGVs all the time, but it would be especially useful for iOS users.
This commit is contained in:
parent
af2c32635a
commit
4131dffae9
|
@ -391,9 +391,10 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
|
|||
static_cast<void>(IDCache::GetEnvForThread());
|
||||
#endif
|
||||
|
||||
const bool fastmem_enabled = Config::Get(Config::MAIN_FASTMEM);
|
||||
if (fastmem_enabled)
|
||||
EMM::InstallExceptionHandler(); // Let's run under memory watch
|
||||
// The JIT need to be able to intercept faults, both for fastmem and for the BLR optimization.
|
||||
const bool exception_handler = EMM::IsExceptionHandlerSupported();
|
||||
if (exception_handler)
|
||||
EMM::InstallExceptionHandler();
|
||||
|
||||
#ifdef USE_MEMORYWATCHER
|
||||
s_memory_watcher = std::make_unique<MemoryWatcher>();
|
||||
|
@ -441,7 +442,7 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
|
|||
|
||||
s_is_started = false;
|
||||
|
||||
if (fastmem_enabled)
|
||||
if (exception_handler)
|
||||
EMM::UninstallExceptionHandler();
|
||||
|
||||
if (GDBStub::IsActive())
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HW/CPU.h"
|
||||
#include "Core/MemTools.h"
|
||||
#include "Core/PowerPC/PPCAnalyst.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/System.h"
|
||||
|
@ -132,7 +133,8 @@ void JitBase::RefreshConfig()
|
|||
analyzer.SetDivByZeroExceptionsEnabled(m_enable_div_by_zero_exceptions);
|
||||
|
||||
bool any_watchpoints = m_system.GetPowerPC().GetMemChecks().HasAny();
|
||||
jo.fastmem = m_fastmem_enabled && jo.fastmem_arena && (m_ppc_state.msr.DR || !any_watchpoints);
|
||||
jo.fastmem = m_fastmem_enabled && jo.fastmem_arena && (m_ppc_state.msr.DR || !any_watchpoints) &&
|
||||
EMM::IsExceptionHandlerSupported();
|
||||
jo.memcheck = m_system.IsMMUMode() || m_system.IsPauseOnPanicMode() || any_watchpoints;
|
||||
jo.fp_exceptions = m_enable_float_exceptions;
|
||||
jo.div_by_zero_exceptions = m_enable_div_by_zero_exceptions;
|
||||
|
@ -140,7 +142,8 @@ void JitBase::RefreshConfig()
|
|||
|
||||
void JitBase::InitBLROptimization()
|
||||
{
|
||||
m_enable_blr_optimization = jo.enableBlocklink && m_fastmem_enabled && !m_enable_debugging;
|
||||
m_enable_blr_optimization =
|
||||
jo.enableBlocklink && !m_enable_debugging && EMM::IsExceptionHandlerSupported();
|
||||
m_cleanup_after_stackfault = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue