JitArm64: Check downcount on block linking.
This skips one B() call.
This commit is contained in:
parent
10e716c623
commit
b6f16352e4
|
@ -414,6 +414,9 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
|
||||||
SetJumpTarget(bail);
|
SetJumpTarget(bail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normal entry doesn't need to check for downcount.
|
||||||
|
b->normalEntry = GetCodePtr();
|
||||||
|
|
||||||
// Conditionally add profiling code.
|
// Conditionally add profiling code.
|
||||||
if (Profiler::g_ProfileBlocks)
|
if (Profiler::g_ProfileBlocks)
|
||||||
{
|
{
|
||||||
|
@ -452,9 +455,6 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 *normalEntry = GetCodePtr();
|
|
||||||
b->normalEntry = normalEntry;
|
|
||||||
|
|
||||||
gpr.Start(js.gpa);
|
gpr.Start(js.gpa);
|
||||||
fpr.Start(js.fpa);
|
fpr.Start(js.fpa);
|
||||||
|
|
||||||
|
|
|
@ -9,19 +9,21 @@
|
||||||
|
|
||||||
void JitArm64BlockCache::WriteLinkBlock(u8* location, const JitBlock& block)
|
void JitArm64BlockCache::WriteLinkBlock(u8* location, const JitBlock& block)
|
||||||
{
|
{
|
||||||
const u8* address = block.checkedEntry;
|
|
||||||
ARM64XEmitter emit(location);
|
ARM64XEmitter emit(location);
|
||||||
s64 offset = address - location;
|
|
||||||
|
|
||||||
// different size of the dispatcher call, so they are still continuous
|
// Are we able to jump directly to the normal entry?
|
||||||
if (offset > 0 && offset <= 28 && offset % 4 == 0)
|
s64 distance = ((s64)block.normalEntry - (s64)location) >> 2;
|
||||||
|
if (distance >= -0x40000 && distance <= 0x3FFFF)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < offset / 4; i++)
|
emit.B(CC_LE, block.normalEntry);
|
||||||
emit.HINT(HINT_NOP);
|
|
||||||
|
// We can't write DISPATCHER_PC here, as blink linking is only for 8bytes.
|
||||||
|
// So we'll hit two jumps when calling Advance.
|
||||||
|
emit.B(block.checkedEntry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit.B(address);
|
emit.B(block.checkedEntry);
|
||||||
}
|
}
|
||||||
emit.FlushIcache();
|
emit.FlushIcache();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue