aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Translation/JitCache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/Translation/JitCache.cs')
-rw-r--r--ARMeilleure/Translation/JitCache.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/ARMeilleure/Translation/JitCache.cs b/ARMeilleure/Translation/JitCache.cs
index 73f04a96..b004cc22 100644
--- a/ARMeilleure/Translation/JitCache.cs
+++ b/ARMeilleure/Translation/JitCache.cs
@@ -13,9 +13,11 @@ namespace ARMeilleure.Translation
private const int CodeAlignment = 4; // Bytes
- private const int CacheSize = 512 * 1024 * 1024;
+ private const int CacheSize = 2047 * 1024 * 1024;
- private static IntPtr _basePointer;
+ private static ReservedRegion _jitRegion;
+
+ private static IntPtr _basePointer => _jitRegion.Pointer;
private static int _offset;
@@ -25,10 +27,11 @@ namespace ARMeilleure.Translation
static JitCache()
{
- _basePointer = MemoryManagement.Allocate(CacheSize);
+ _jitRegion = new ReservedRegion(CacheSize);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
+ _jitRegion.ExpandIfNeeded(PageSize);
JitUnwindWindows.InstallFunctionTableHandler(_basePointer, CacheSize);
// The first page is used for the table based SEH structs.
@@ -97,6 +100,8 @@ namespace ARMeilleure.Translation
_offset += codeSize;
+ _jitRegion.ExpandIfNeeded((ulong)_offset);
+
if ((ulong)(uint)_offset > CacheSize)
{
throw new OutOfMemoryException();