aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ARMeilleure/Instructions/InstEmitFlowHelper.cs9
-rw-r--r--ARMeilleure/Translation/PTC/Ptc.cs2
-rw-r--r--ARMeilleure/Translation/Translator.cs22
3 files changed, 22 insertions, 11 deletions
diff --git a/ARMeilleure/Instructions/InstEmitFlowHelper.cs b/ARMeilleure/Instructions/InstEmitFlowHelper.cs
index f995ffa1..e1309a4e 100644
--- a/ARMeilleure/Instructions/InstEmitFlowHelper.cs
+++ b/ARMeilleure/Instructions/InstEmitFlowHelper.cs
@@ -144,7 +144,14 @@ namespace ARMeilleure.Instructions
{
bool isRecursive = immediate == context.EntryAddress;
- EmitJumpTableBranch(context, Const(immediate), isRecursive);
+ if (isRecursive)
+ {
+ context.Branch(context.GetLabel(immediate));
+ }
+ else
+ {
+ EmitJumpTableBranch(context, Const(immediate), isJump: false);
+ }
}
private static void EmitNativeCall(ArmEmitterContext context, Operand nativeContextPtr, Operand funcAddr, bool isJump)
diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs
index a61cf5b7..b1d55cff 100644
--- a/ARMeilleure/Translation/PTC/Ptc.cs
+++ b/ARMeilleure/Translation/PTC/Ptc.cs
@@ -28,7 +28,7 @@ namespace ARMeilleure.Translation.PTC
private const string OuterHeaderMagicString = "PTCohd\0\0";
private const string InnerHeaderMagicString = "PTCihd\0\0";
- private const uint InternalVersion = 2279; //! To be incremented manually for each change to the ARMeilleure project.
+ private const uint InternalVersion = 2282; //! To be incremented manually for each change to the ARMeilleure project.
private const string ActualDir = "0";
private const string BackupDir = "1";
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));