Use the jump table for HighCq tail continues. (#1088)

* Use the jump table for tail continues.

This path is always reached when a function larger than our current length limit (currently 5000) is compiled.

* Use Call Flag rather than 1L
This commit is contained in:
riperiperi 2020-04-04 09:05:11 +01:00 committed by GitHub
parent f70cc96464
commit e99e6d0ad1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -224,16 +224,25 @@ namespace ARMeilleure.Instructions
{ {
bool useTailContinue = true; // Left option here as it may be useful if we need to return to managed rather than tail call in future. (eg. for debug) bool useTailContinue = true; // Left option here as it may be useful if we need to return to managed rather than tail call in future. (eg. for debug)
if (useTailContinue) if (useTailContinue)
{
if (context.HighCq)
{
// If we're doing a tail continue in HighCq, reserve a space in the jump table to avoid calling back to the translator.
// This will always try to get a HighCq version of our continue target as well.
EmitJumpTableBranch(context, address, true);
}
else
{ {
if (allowRejit) if (allowRejit)
{ {
address = context.BitwiseOr(address, Const(1L)); address = context.BitwiseOr(address, Const(CallFlag));
} }
Operand fallbackAddr = context.Call(new _U64_U64(NativeInterface.GetFunctionAddress), address); Operand fallbackAddr = context.Call(new _U64_U64(NativeInterface.GetFunctionAddress), address);
EmitNativeCall(context, fallbackAddr, true); EmitNativeCall(context, fallbackAddr, true);
} }
}
else else
{ {
context.Return(address); context.Return(address);