]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Clean up temporary bytecode patching.
authorMike Pall <mike>
Tue, 28 Jun 2011 21:19:36 +0000 (23:19 +0200)
committerMike Pall <mike>
Tue, 28 Jun 2011 21:19:36 +0000 (23:19 +0200)
src/lj_trace.c

index 2bb2075d88df559612429c83869e8f73a0dd44dc..0542ea1f8a16687ec196c61746d94fcc22f9f25d 100644 (file)
@@ -545,9 +545,13 @@ static int trace_abort(jit_State *J)
 /* Perform pending re-patch of a bytecode instruction. */
 static LJ_AINLINE void trace_pendpatch(jit_State *J, int force)
 {
-  if (LJ_UNLIKELY(J->patchpc) && (force || J->chain[IR_RETF])) {
-    *J->patchpc = J->patchins;
-    J->patchpc = NULL;
+  if (LJ_UNLIKELY(J->patchpc)) {
+    if (force || J->bcskip == 0) {
+      *J->patchpc = J->patchins;
+      J->patchpc = NULL;
+    } else {
+      J->bcskip = 0;
+    }
   }
 }
 
@@ -769,6 +773,7 @@ int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr)
        J->patchins = *pc;
        J->patchpc = (BCIns *)pc;
        *J->patchpc = *retpc;
+       J->bcskip = 1;
       } else {
        pc = retpc;
        setcframe_pc(cf, pc);