Commits

Armin Rigo committed dacc3c5

Don't insert the dummy malloc between the final GUARD_NOT_FORCED_2
and the following FINISH!

Comments (0)

Files changed (2)

rpython/jit/backend/llsupport/stmrewrite.py

             self._do_stm_call('stm_hint_commit_soon', [], None,
                               op.stm_location)
             return
+        # ----------  jump, finish, guard_not_forced_2  ----------
+        if (opnum == rop.JUMP or opnum == rop.FINISH
+                or opnum == rop.GUARD_NOT_FORCED_2):
+            self.add_dummy_allocation()
+            self.newops.append(op)
+            return
         # ----------  pure operations, guards  ----------
         if op.is_always_pure() or op.is_guard() or op.is_ovf():
             self.newops.append(op)
                      ):
             self.newops.append(op)
             return
-        # ----------  jump, finish  ----------
-        if opnum == rop.JUMP or opnum == rop.FINISH:
-            self.add_dummy_allocation()
-            self.newops.append(op)
-            return
         # ----------  fall-back  ----------
         # Check that none of the ops handled here can collect.
         # This is not done by the fallback here

rpython/jit/backend/llsupport/test/test_stmrewrite.py

         $DUMMYALLOC
         jump(i1)
         """)
+
+    def test_dummy_alloc_is_before_guard_not_forced_2(self):
+        self.check_rewrite("""
+        []
+        escape()
+        guard_not_forced_2() []
+        finish()
+        """, """
+        []
+        $INEV
+        escape()
+        $DUMMYALLOC
+        guard_not_forced_2() []
+        finish()
+        """)