From ebf50edb79be896199a792c4c2813ac54bc9fad8 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 26 Jun 2024 16:41:47 +1000 Subject: [PATCH] System: Allocate JIT space before fastmem area On Intel MacOS 14, the fastmem area gets allocated close to the executable base, leaving no region free +/- 2GB for the JIT area. --- src/core/system.cpp | 2 +- src/util/jit_code_buffer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index 36e13118c..900bd5a27 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -332,7 +332,7 @@ bool System::Internal::CPUThreadInitialize(Error* error) } #endif - if (!Bus::AllocateMemory(error) || !CPU::CodeCache::ProcessStartup(error)) + if (!CPU::CodeCache::ProcessStartup(error) || !Bus::AllocateMemory(error)) { CPUThreadShutdown(); return false; diff --git a/src/util/jit_code_buffer.cpp b/src/util/jit_code_buffer.cpp index a463bf813..2e4976a31 100644 --- a/src/util/jit_code_buffer.cpp +++ b/src/util/jit_code_buffer.cpp @@ -60,7 +60,7 @@ bool JitCodeBuffer::Allocate(u32 size /* = 64 * 1024 * 1024 */, u32 far_code_siz reinterpret_cast(std::numeric_limits::max()) : (base + max_displacement); const u8* min_address = ((base - max_displacement) > base) ? nullptr : (base - max_displacement); - const u32 step = 256 * 1024 * 1024; + const u32 step = 64 * 1024 * 1024; const u32 steps = static_cast(max_address - min_address) / step; for (u32 offset = 0; offset < steps; offset++) {