JitArm64: Increase farcode & nearcode cache size

This is a JitArm64 version of 219610d8a0.

Due to limitations on how far you can jump with a single AArch64 branch
instruction, going above the former limit of 128 MiB of code (counting
nearcode and farcode combined) requires a bit of restructuring. With the
restructuring in place, the limit now is 256 MiB. See the new large
comment in Jit.h for a description of the new memory layout.
This commit is contained in:
JosJuice
2024-03-24 11:49:47 +01:00
parent b6f0e8876e
commit e8154a529f
3 changed files with 148 additions and 47 deletions

View File

@ -82,6 +82,10 @@ public:
}
bool IsInSpace(const u8* ptr) const { return ptr >= region && ptr < (region + region_size); }
bool IsInSpaceOrChildSpace(const u8* ptr) const
{
return ptr >= region && ptr < (region + total_region_size);
}
void WriteProtect(bool allow_execute)
{
Common::WriteProtectMemory(region, region_size, allow_execute);
@ -106,7 +110,7 @@ public:
bool HasChildren() const { return region_size != total_region_size; }
u8* AllocChildCodeSpace(size_t child_size)
{
ASSERT_MSG(DYNA_REC, child_size < GetSpaceLeft(), "Insufficient space for child allocation.");
ASSERT_MSG(DYNA_REC, child_size <= GetSpaceLeft(), "Insufficient space for child allocation.");
u8* child_region = region + region_size - child_size;
region_size -= child_size;
ResetCodePtr();