mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
@ -604,6 +604,8 @@ void CompileBlock(ARM* cpu)
|
|||||||
// they are going to be hashed
|
// they are going to be hashed
|
||||||
u32 literalValues[Config::JIT_MaxBlockSize];
|
u32 literalValues[Config::JIT_MaxBlockSize];
|
||||||
u32 instrValues[Config::JIT_MaxBlockSize];
|
u32 instrValues[Config::JIT_MaxBlockSize];
|
||||||
|
// due to instruction merging i might not reflect the amount of actual instructions
|
||||||
|
u32 numInstrs = 0;
|
||||||
|
|
||||||
cpu->FillPipeline();
|
cpu->FillPipeline();
|
||||||
u32 nextInstr[2] = {cpu->NextInstr[0], cpu->NextInstr[1]};
|
u32 nextInstr[2] = {cpu->NextInstr[0], cpu->NextInstr[1]};
|
||||||
@ -623,13 +625,13 @@ void CompileBlock(ARM* cpu)
|
|||||||
instrs[i].SetFlags = 0;
|
instrs[i].SetFlags = 0;
|
||||||
instrs[i].Instr = nextInstr[0];
|
instrs[i].Instr = nextInstr[0];
|
||||||
nextInstr[0] = nextInstr[1];
|
nextInstr[0] = nextInstr[1];
|
||||||
|
|
||||||
instrs[i].Addr = nextInstrAddr[0];
|
instrs[i].Addr = nextInstrAddr[0];
|
||||||
nextInstrAddr[0] = nextInstrAddr[1];
|
nextInstrAddr[0] = nextInstrAddr[1];
|
||||||
nextInstrAddr[1] = r15;
|
nextInstrAddr[1] = r15;
|
||||||
JIT_DEBUGPRINT("instr %08x %x\n", instrs[i].Instr & (thumb ? 0xFFFF : ~0), instrs[i].Addr);
|
JIT_DEBUGPRINT("instr %08x %x\n", instrs[i].Instr & (thumb ? 0xFFFF : ~0), instrs[i].Addr);
|
||||||
|
|
||||||
instrValues[i] = instrs[i].Instr;
|
instrValues[numInstrs++] = instrs[i].Instr;
|
||||||
|
|
||||||
u32 translatedAddr = LocaliseCodeAddress(cpu->Num, instrs[i].Addr);
|
u32 translatedAddr = LocaliseCodeAddress(cpu->Num, instrs[i].Addr);
|
||||||
assert(translatedAddr >> 27);
|
assert(translatedAddr >> 27);
|
||||||
@ -741,12 +743,13 @@ void CompileBlock(ARM* cpu)
|
|||||||
if (thumb && instrs[i].Info.Kind == ARMInstrInfo::tk_BL_LONG_2 && i > 0
|
if (thumb && instrs[i].Info.Kind == ARMInstrInfo::tk_BL_LONG_2 && i > 0
|
||||||
&& instrs[i - 1].Info.Kind == ARMInstrInfo::tk_BL_LONG_1)
|
&& instrs[i - 1].Info.Kind == ARMInstrInfo::tk_BL_LONG_1)
|
||||||
{
|
{
|
||||||
instrs[i - 1].Info.Kind = ARMInstrInfo::tk_BL_LONG;
|
|
||||||
instrs[i - 1].Instr = (instrs[i - 1].Instr & 0xFFFF) | (instrs[i].Instr << 16);
|
|
||||||
instrs[i - 1].Info.DstRegs = 0xC000;
|
|
||||||
instrs[i - 1].Info.SrcRegs = 0;
|
|
||||||
instrs[i - 1].Info.EndBlock = true;
|
|
||||||
i--;
|
i--;
|
||||||
|
instrs[i].Info.Kind = ARMInstrInfo::tk_BL_LONG;
|
||||||
|
instrs[i].Instr = (instrs[i].Instr & 0xFFFF) | (instrs[i + 1].Instr << 16);
|
||||||
|
instrs[i].Info.DstRegs = 0xC000;
|
||||||
|
instrs[i].Info.SrcRegs = 0;
|
||||||
|
instrs[i].Info.EndBlock = true;
|
||||||
|
JIT_DEBUGPRINT("merged BL\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instrs[i].Info.Branches() && Config::JIT_BranchOptimisations)
|
if (instrs[i].Info.Branches() && Config::JIT_BranchOptimisations)
|
||||||
@ -829,7 +832,7 @@ void CompileBlock(ARM* cpu)
|
|||||||
} while(!instrs[i - 1].Info.EndBlock && i < Config::JIT_MaxBlockSize && !cpu->Halted && (!cpu->IRQ || (cpu->CPSR & 0x80)));
|
} while(!instrs[i - 1].Info.EndBlock && i < Config::JIT_MaxBlockSize && !cpu->Halted && (!cpu->IRQ || (cpu->CPSR & 0x80)));
|
||||||
|
|
||||||
u32 literalHash = (u32)XXH3_64bits(literalValues, numLiterals * 4);
|
u32 literalHash = (u32)XXH3_64bits(literalValues, numLiterals * 4);
|
||||||
u32 instrHash = (u32)XXH3_64bits(instrValues, i * 4);
|
u32 instrHash = (u32)XXH3_64bits(instrValues, numInstrs * 4);
|
||||||
|
|
||||||
auto prevBlockIt = RestoreCandidates.find(instrHash);
|
auto prevBlockIt = RestoreCandidates.find(instrHash);
|
||||||
JitBlock* prevBlock = NULL;
|
JitBlock* prevBlock = NULL;
|
||||||
|
@ -275,7 +275,7 @@ void Compiler::T_Comp_BL_Merged()
|
|||||||
target |= 1;
|
target |= 1;
|
||||||
|
|
||||||
MOV(32, MapReg(14), Imm32((R15 - 2) | 1));
|
MOV(32, MapReg(14), Imm32((R15 - 2) | 1));
|
||||||
|
|
||||||
Comp_JumpTo(target);
|
Comp_JumpTo(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user