fixup for aarch64 JIT

This commit is contained in:
RSDuck 2020-02-07 00:08:29 +01:00
parent 2725429727
commit d2acceb367
2 changed files with 8 additions and 3 deletions

View File

@ -83,7 +83,6 @@ Compiler::Compiler()
JitMemUseableSize = JitMemSize; JitMemUseableSize = JitMemSize;
Reset(); Reset();
#else #else
#else
u64 pageSize = sysconf(_SC_PAGE_SIZE); u64 pageSize = sysconf(_SC_PAGE_SIZE);
u8* pageAligned = (u8*)(((u64)JitMem & ~(pageSize - 1)) + pageSize); u8* pageAligned = (u8*)(((u64)JitMem & ~(pageSize - 1)) + pageSize);
u64 alignedSize = (((u64)JitMem + sizeof(JitMem)) & ~(pageSize - 1)) - (u64)pageAligned; u64 alignedSize = (((u64)JitMem + sizeof(JitMem)) & ~(pageSize - 1)) - (u64)pageAligned;

View File

@ -18,11 +18,15 @@ public:
RegisterCache() RegisterCache()
{} {}
RegisterCache(T* compiler, FetchedInstr instrs[], int instrsCount) RegisterCache(T* compiler, FetchedInstr instrs[], int instrsCount, bool pcAllocatableAsSrc = false)
: Compiler(compiler), Instrs(instrs), InstrsCount(instrsCount) : Compiler(compiler), Instrs(instrs), InstrsCount(instrsCount)
{ {
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
Mapping[i] = (Reg)-1; Mapping[i] = (Reg)-1;
PCAllocatableAsSrc = ~(pcAllocatableAsSrc
? 0
: (1 << 15));
} }
void UnloadRegister(int reg) void UnloadRegister(int reg)
@ -120,7 +124,7 @@ public:
for (int reg : neverNeededAgain) for (int reg : neverNeededAgain)
UnloadRegister(reg); UnloadRegister(reg);
u16 necessaryRegs = ((instr.Info.SrcRegs & ~(1 << 15)) | instr.Info.DstRegs) & ~instr.Info.NotStrictlyNeeded; u16 necessaryRegs = ((instr.Info.SrcRegs & PCAllocatableAsSrc) | instr.Info.DstRegs) & ~instr.Info.NotStrictlyNeeded;
u16 writeRegs = instr.Info.DstRegs & ~instr.Info.NotStrictlyNeeded; u16 writeRegs = instr.Info.DstRegs & ~instr.Info.NotStrictlyNeeded;
BitSet16 needToBeLoaded(necessaryRegs & ~LoadedRegs); BitSet16 needToBeLoaded(necessaryRegs & ~LoadedRegs);
if (needToBeLoaded != BitSet16(0)) if (needToBeLoaded != BitSet16(0))
@ -184,6 +188,8 @@ public:
u16 LoadedRegs = 0; u16 LoadedRegs = 0;
u16 DirtyRegs = 0; u16 DirtyRegs = 0;
u16 PCAllocatableAsSrc = 0;
T* Compiler; T* Compiler;
FetchedInstr* Instrs; FetchedInstr* Instrs;