CPU/CodeCache: Always dynamically allocate code buffer
Reduces .bss size.
This commit is contained in:
@ -318,6 +318,34 @@ void System::CheckCacheLineSize()
|
||||
}
|
||||
}
|
||||
|
||||
bool System::Internal::ProcessStartup(Error* error)
|
||||
{
|
||||
Common::Timer timer;
|
||||
|
||||
// Allocate JIT memory as soon as possible.
|
||||
if (!CPU::CodeCache::ProcessStartup(error))
|
||||
return false;
|
||||
|
||||
// Fastmem alloc *must* come after JIT alloc, otherwise it tends to eat the 4GB region after the executable on MacOS.
|
||||
if (!Bus::AllocateMemory(error))
|
||||
{
|
||||
CPU::CodeCache::ProcessShutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
VERBOSE_LOG("Memory allocation took {} ms.", timer.GetTimeMilliseconds());
|
||||
|
||||
CheckCacheLineSize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void System::Internal::ProcessShutdown()
|
||||
{
|
||||
Bus::ReleaseMemory();
|
||||
CPU::CodeCache::ProcessShutdown();
|
||||
}
|
||||
|
||||
bool System::Internal::CPUThreadInitialize(Error* error)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -332,17 +360,9 @@ bool System::Internal::CPUThreadInitialize(Error* error)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!CPU::CodeCache::ProcessStartup(error) || !Bus::AllocateMemory(error))
|
||||
{
|
||||
CPUThreadShutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
// This will call back to Host::LoadSettings() -> ReloadSources().
|
||||
LoadSettings(false);
|
||||
|
||||
CheckCacheLineSize();
|
||||
|
||||
#ifdef ENABLE_RAINTEGRATION
|
||||
if (Host::GetBaseBoolSettingValue("Cheevos", "UseRAIntegration", false))
|
||||
Achievements::SwitchToRAIntegration();
|
||||
@ -377,9 +397,6 @@ void System::Internal::CPUThreadShutdown()
|
||||
|
||||
InputManager::CloseSources();
|
||||
|
||||
CPU::CodeCache::ProcessShutdown();
|
||||
Bus::ReleaseMemory();
|
||||
|
||||
#ifdef _WIN32
|
||||
CoUninitialize();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user