aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Translation/Translator.cs
diff options
context:
space:
mode:
authorFICTURE7 <FICTURE7@gmail.com>2021-05-20 16:31:45 +0400
committerGitHub <noreply@github.com>2021-05-20 09:31:45 -0300
commit65ac00833a8b51fe9ea6f12ffdfadeb098a6c360 (patch)
tree71d18f3be363c2d54afffee7c3bb405acdc96a25 /ARMeilleure/Translation/Translator.cs
parent0181068016bc9ca98ee71f1d7b6ab6010c4302f0 (diff)
Use branch instead of tailcall for recursive calls (#2282)
* Use branch instead of tailcall for recursive calls Use a branch instead of doing a tailcall for recursive calls. This avoids having to store the dispatch address, setting up the epilogue and keeps guest registers in host registers for longer. The rejit check is moved down into the entry block so that the rejit behaviour remains the same as before. * Set PTC version Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Diffstat (limited to 'ARMeilleure/Translation/Translator.cs')
-rw-r--r--ARMeilleure/Translation/Translator.cs22
1 files changed, 13 insertions, 9 deletions
diff --git a/ARMeilleure/Translation/Translator.cs b/ARMeilleure/Translation/Translator.cs
index 81af0681..f8b074c9 100644
--- a/ARMeilleure/Translation/Translator.cs
+++ b/ARMeilleure/Translation/Translator.cs
@@ -237,13 +237,6 @@ namespace ARMeilleure.Translation
Logger.StartPass(PassName.Translation);
- Counter<uint> counter = null;
-
- if (!context.HighCq)
- {
- EmitRejitCheck(context, out counter);
- }
-
EmitSynchronization(context);
if (blocks[0].Address != address)
@@ -251,7 +244,7 @@ namespace ARMeilleure.Translation
context.Branch(context.GetLabel(address));
}
- ControlFlowGraph cfg = EmitAndGetCFG(context, blocks, out Range funcRange);
+ ControlFlowGraph cfg = EmitAndGetCFG(context, blocks, out Range funcRange, out Counter<uint> counter);
ulong funcSize = funcRange.End - funcRange.Start;
@@ -322,8 +315,14 @@ namespace ARMeilleure.Translation
}
}
- private static ControlFlowGraph EmitAndGetCFG(ArmEmitterContext context, Block[] blocks, out Range range)
+ private static ControlFlowGraph EmitAndGetCFG(
+ ArmEmitterContext context,
+ Block[] blocks,
+ out Range range,
+ out Counter<uint> counter)
{
+ counter = null;
+
ulong rangeStart = ulong.MaxValue;
ulong rangeEnd = 0;
@@ -344,6 +343,11 @@ namespace ARMeilleure.Translation
}
}
+ if (block.Address == context.EntryAddress && !context.HighCq)
+ {
+ EmitRejitCheck(context, out counter);
+ }
+
context.CurrBlock = block;
context.MarkLabel(context.GetLabel(block.Address));