Răsfoiți Sursa

Fix host stack overflow caused by some recursive guest methods. (#1528)

* Fix host stack overflow caused by some recursive guest methods.

* PPTC flag up.

* Address comments.

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
LDj3SNuD 5 ani în urmă
părinte
comite
66b799a6e4

+ 3 - 1
ARMeilleure/Instructions/InstEmitFlowHelper.cs

@@ -144,7 +144,9 @@ namespace ARMeilleure.Instructions
 
         public static void EmitCall(ArmEmitterContext context, ulong immediate)
         {
-            EmitJumpTableBranch(context, Const(immediate));
+            bool isRecursive = immediate == (ulong)context.BaseAddress;
+
+            EmitJumpTableBranch(context, Const(immediate), isRecursive);
         }
 
         private static void EmitNativeCall(ArmEmitterContext context, Operand nativeContextPtr, Operand funcAddr, bool isJump = false)

+ 1 - 1
ARMeilleure/Translation/PTC/Ptc.cs

@@ -21,7 +21,7 @@ namespace ARMeilleure.Translation.PTC
     {
         private const string HeaderMagic = "PTChd";
 
-        private const int InternalVersion = 1549; //! To be incremented manually for each change to the ARMeilleure project.
+        private const int InternalVersion = 1528; //! To be incremented manually for each change to the ARMeilleure project.
 
         private const string ActualDir = "0";
         private const string BackupDir = "1";