Jit: Always initialize fastmem arena

If dcache is enabled when the game starts, initializing the fastmem
arena is still useful in case the user changes the dcache setting.
And initializing it doesn't really cost anything.
This commit is contained in:
JosJuice 2023-09-30 19:38:09 +02:00
parent 0606433404
commit 8686536d7d
5 changed files with 14 additions and 20 deletions

View File

@ -82,7 +82,7 @@ CachedInterpreter::~CachedInterpreter() = default;
void CachedInterpreter::Init()
{
RefreshConfig(InitFastmemArena::No);
RefreshConfig();
m_code.reserve(CODE_SIZE / sizeof(Instruction));
@ -384,5 +384,5 @@ void CachedInterpreter::ClearCache()
{
m_code.clear();
m_block_cache.Clear();
RefreshConfig(InitFastmemArena::No);
RefreshConfig();
}

View File

@ -251,7 +251,10 @@ bool Jit64::BackPatch(SContext* ctx)
void Jit64::Init()
{
RefreshConfig(InitFastmemArena::Yes);
auto& memory = m_system.GetMemory();
jo.fastmem_arena = memory.InitFastmemArena();
RefreshConfig();
EnableBlockLink();
@ -304,7 +307,7 @@ void Jit64::ClearCache()
m_const_pool.Clear();
ClearCodeSpace();
Clear();
RefreshConfig(InitFastmemArena::No);
RefreshConfig();
asm_routines.Regenerate();
ResetFreeMemoryRanges();
}

View File

@ -47,7 +47,10 @@ JitArm64::~JitArm64() = default;
void JitArm64::Init()
{
RefreshConfig(InitFastmemArena::Yes);
auto& memory = m_system.GetMemory();
jo.fastmem_arena = memory.InitFastmemArena();
RefreshConfig();
const size_t child_code_size = jo.memcheck ? FARCODE_SIZE_MMU : FARCODE_SIZE;
AllocCodeSpace(CODE_SIZE + child_code_size);
@ -155,7 +158,7 @@ void JitArm64::ClearCache()
const Common::ScopedJITPageWriteAndNoExecute enable_jit_page_writes;
ClearCodeSpace();
m_far_code.ClearCodeSpace();
RefreshConfig(InitFastmemArena::No);
RefreshConfig();
GenerateAsm();

View File

@ -115,7 +115,7 @@ bool JitBase::DoesConfigNeedRefresh()
});
}
void JitBase::RefreshConfig(InitFastmemArena init_fastmem_arena)
void JitBase::RefreshConfig()
{
for (const auto& [member, config_info] : JIT_SETTINGS)
this->*member = Config::Get(*config_info);
@ -132,12 +132,6 @@ void JitBase::RefreshConfig(InitFastmemArena init_fastmem_arena)
analyzer.SetFloatExceptionsEnabled(m_enable_float_exceptions);
analyzer.SetDivByZeroExceptionsEnabled(m_enable_div_by_zero_exceptions);
if (init_fastmem_arena != InitFastmemArena::No)
{
auto& memory = m_system.GetMemory();
jo.fastmem_arena = m_fastmem_enabled && memory.InitFastmemArena();
}
bool any_watchpoints = m_system.GetPowerPC().GetMemChecks().HasAny();
jo.fastmem = m_fastmem_enabled && jo.fastmem_arena && (m_ppc_state.msr.DR || !any_watchpoints) &&
EMM::IsExceptionHandlerSupported();

View File

@ -163,14 +163,8 @@ protected:
static const std::array<std::pair<bool JitBase::*, const Config::Info<bool>*>, 22> JIT_SETTINGS;
enum class InitFastmemArena
{
No,
Yes,
};
bool DoesConfigNeedRefresh();
void RefreshConfig(InitFastmemArena init_fastmem_arena);
void RefreshConfig();
void InitBLROptimization();
void ProtectStack();