Merge pull request #2898 from degasus/linking
JitArm64: Faster linking of continuous blocks
This commit is contained in:
commit
80fa9af9b1
|
@ -160,24 +160,14 @@ void JitArm64::WriteExit(u32 destination)
|
||||||
linkData.exitPtrs = GetWritableCodePtr();
|
linkData.exitPtrs = GetWritableCodePtr();
|
||||||
linkData.linkStatus = false;
|
linkData.linkStatus = false;
|
||||||
|
|
||||||
// Link opportunity!
|
// the code generated in JitArm64BlockCache::WriteDestroyBlock must fit in this block
|
||||||
int block;
|
ARM64Reg WA = gpr.GetReg();
|
||||||
if (jo.enableBlocklink && (block = blocks.GetBlockNumberFromStartAddress(destination)) >= 0)
|
ARM64Reg XA = EncodeRegTo64(WA);
|
||||||
{
|
MOVI2R(WA, destination);
|
||||||
// It exists! Joy of joy!
|
STR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(pc));
|
||||||
B(blocks.GetBlock(block)->checkedEntry);
|
MOVI2R(XA, (u64)asm_routines.dispatcher);
|
||||||
linkData.linkStatus = true;
|
BR(XA);
|
||||||
}
|
gpr.Unlock(WA);
|
||||||
else
|
|
||||||
{
|
|
||||||
ARM64Reg WA = gpr.GetReg();
|
|
||||||
ARM64Reg XA = EncodeRegTo64(WA);
|
|
||||||
MOVI2R(WA, destination);
|
|
||||||
STR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(pc));
|
|
||||||
MOVI2R(XA, (u64)asm_routines.dispatcher);
|
|
||||||
BR(XA);
|
|
||||||
gpr.Unlock(WA);
|
|
||||||
}
|
|
||||||
|
|
||||||
b->linkData.push_back(linkData);
|
b->linkData.push_back(linkData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,24 @@
|
||||||
void JitArm64BlockCache::WriteLinkBlock(u8* location, const u8* address)
|
void JitArm64BlockCache::WriteLinkBlock(u8* location, const u8* address)
|
||||||
{
|
{
|
||||||
ARM64XEmitter emit(location);
|
ARM64XEmitter emit(location);
|
||||||
emit.B(address);
|
s64 offset = address - location;
|
||||||
|
|
||||||
|
// different size of the dispatcher call, so they are still continuous
|
||||||
|
if (offset > 0 && offset <= 28 && offset % 4 == 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < offset / 4; i++)
|
||||||
|
emit.HINT(HINT_NOP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit.B(address);
|
||||||
|
}
|
||||||
emit.FlushIcache();
|
emit.FlushIcache();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitArm64BlockCache::WriteDestroyBlock(const u8* location, u32 address)
|
void JitArm64BlockCache::WriteDestroyBlock(const u8* location, u32 address)
|
||||||
{
|
{
|
||||||
|
// must fit within the code generated in JitArm64::WriteExit
|
||||||
ARM64XEmitter emit((u8 *)location);
|
ARM64XEmitter emit((u8 *)location);
|
||||||
emit.MOVI2R(W0, address);
|
emit.MOVI2R(W0, address);
|
||||||
emit.MOVI2R(X30, (u64)jit->GetAsmRoutines()->dispatcher);
|
emit.MOVI2R(X30, (u64)jit->GetAsmRoutines()->dispatcher);
|
||||||
|
|
Loading…
Reference in New Issue