more fixes for literal invalidation
This commit is contained in:
parent
8d2746e517
commit
55ec724fee
|
@ -628,6 +628,9 @@ void CompileBlock(ARM* cpu)
|
||||||
// due to instruction merging i might not reflect the amount of actual instructions
|
// due to instruction merging i might not reflect the amount of actual instructions
|
||||||
u32 numInstrs = 0;
|
u32 numInstrs = 0;
|
||||||
|
|
||||||
|
u32 writeAddrs[Config::JIT_MaxBlockSize];
|
||||||
|
u32 numWriteAddrs = 0, writeAddrsTranslated = 0;
|
||||||
|
|
||||||
cpu->FillPipeline();
|
cpu->FillPipeline();
|
||||||
u32 nextInstr[2] = {cpu->NextInstr[0], cpu->NextInstr[1]};
|
u32 nextInstr[2] = {cpu->NextInstr[0], cpu->NextInstr[1]};
|
||||||
u32 nextInstrAddr[2] = {blockAddr, r15};
|
u32 nextInstrAddr[2] = {blockAddr, r15};
|
||||||
|
@ -753,6 +756,8 @@ void CompileBlock(ARM* cpu)
|
||||||
{
|
{
|
||||||
printf("literal in non executable memory?\n");
|
printf("literal in non executable memory?\n");
|
||||||
}
|
}
|
||||||
|
if (InvalidLiterals.Find(translatedAddr) == -1)
|
||||||
|
{
|
||||||
u32 translatedAddrRounded = translatedAddr & ~0x1FF;
|
u32 translatedAddrRounded = translatedAddr & ~0x1FF;
|
||||||
|
|
||||||
u32 j = 0;
|
u32 j = 0;
|
||||||
|
@ -766,8 +771,10 @@ void CompileBlock(ARM* cpu)
|
||||||
cpu->DataRead32(literalAddr, &literalValues[numLiterals]);
|
cpu->DataRead32(literalAddr, &literalValues[numLiterals]);
|
||||||
literalLoadAddrs[numLiterals++] = translatedAddr;
|
literalLoadAddrs[numLiterals++] = translatedAddr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (thumb && instrs[i].Info.Kind == ARMInstrInfo::tk_BL_LONG_2 && i > 0
|
else if (instrs[i].Info.SpecialKind == ARMInstrInfo::special_WriteMem)
|
||||||
|
writeAddrs[numWriteAddrs++] = instrs[i].DataRegion;
|
||||||
|
else 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)
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
|
@ -860,6 +867,26 @@ void CompileBlock(ARM* cpu)
|
||||||
FloodFillSetFlags(instrs, i - 2, !secondaryFlagReadCond ? instrs[i - 1].Info.ReadFlags : 0xF);
|
FloodFillSetFlags(instrs, i - 2, !secondaryFlagReadCond ? instrs[i - 1].Info.ReadFlags : 0xF);
|
||||||
} 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)));
|
||||||
|
|
||||||
|
if (numLiterals)
|
||||||
|
{
|
||||||
|
for (u32 j = 0; j < numWriteAddrs; j++)
|
||||||
|
{
|
||||||
|
u32 translatedAddr = LocaliseCodeAddress(cpu->Num, writeAddrs[j]);
|
||||||
|
if (translatedAddr)
|
||||||
|
{
|
||||||
|
for (u32 k = 0; k < numLiterals; k++)
|
||||||
|
{
|
||||||
|
if (literalLoadAddrs[k] == translatedAddr)
|
||||||
|
{
|
||||||
|
if (InvalidLiterals.Find(translatedAddr) == -1)
|
||||||
|
InvalidLiterals.Add(translatedAddr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u32 literalHash = (u32)XXH3_64bits(literalValues, numLiterals * 4);
|
u32 literalHash = (u32)XXH3_64bits(literalValues, numLiterals * 4);
|
||||||
u32 instrHash = (u32)XXH3_64bits(instrValues, numInstrs * 4);
|
u32 instrHash = (u32)XXH3_64bits(instrValues, numInstrs * 4);
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ bool Compiler::Comp_MemLoadLiteral(int size, bool signExtend, int rd, u32 addr)
|
||||||
int invalidLiteralIdx = InvalidLiterals.Find(localAddr);
|
int invalidLiteralIdx = InvalidLiterals.Find(localAddr);
|
||||||
if (invalidLiteralIdx != -1)
|
if (invalidLiteralIdx != -1)
|
||||||
{
|
{
|
||||||
InvalidLiterals.Remove(invalidLiteralIdx);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@ bool Compiler::Comp_MemLoadLiteral(int size, bool signExtend, int rd, u32 addr)
|
||||||
int invalidLiteralIdx = InvalidLiterals.Find(localAddr);
|
int invalidLiteralIdx = InvalidLiterals.Find(localAddr);
|
||||||
if (invalidLiteralIdx != -1)
|
if (invalidLiteralIdx != -1)
|
||||||
{
|
{
|
||||||
InvalidLiterals.Remove(invalidLiteralIdx);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue