Commits

Remi Meier committed 8a7060e

add transaction breaks after guard_not_forced

Comments (0)

Files changed (2)

rpython/jit/metainterp/optimizeopt/stm.py

     """
     def __init__(self):
         self.remove_next_gnf = False # guard_not_forced
+        self.keep_but_ignore_gnf = False
 
     def propagate_forward(self, op):
         dispatch_opt(self, op)
         if self._break_wanted():
             self._set_break_wanted(False)
             self.emit_operation(op)
+            self.keep_but_ignore_gnf = True
         else:
             self.remove_next_gnf = True
 
         if self.remove_next_gnf:
             self.remove_next_gnf = False
         else:
+            if not self.keep_but_ignore_gnf:
+                self._set_break_wanted(True)
+            self.keep_but_ignore_gnf = False
             self.emit_operation(op)
         
         

rpython/jit/metainterp/optimizeopt/test/test_stm.py

         """
         self.optimize_loop(ops, expected, expected_preamble=preamble)
 
+    def test_add_tb_after_guard_not_forced(self):
+        ops = """
+        []
+        stm_transaction_break()
+        guard_not_forced() []
+        
+        escape() # e.g. like a call_release_gil
+        guard_not_forced() []
+        
+        stm_transaction_break()
+        guard_not_forced() []
+        stm_transaction_break()
+        guard_not_forced() []
+        i0 = call(123, descr=sbtdescr)
+        guard_false(i0) []
+        jump()
+        """
+        preamble = """
+        []
+        stm_transaction_break()
+        guard_not_forced() []
+
+        escape()
+        guard_not_forced() []
+
+        stm_transaction_break()
+        guard_not_forced() []
+        
+        i0 = call(123, descr=sbtdescr)
+        guard_false(i0) []
+        jump()
+        """
+        expected = """
+        []
+        escape()
+        guard_not_forced() []
+
+        stm_transaction_break()
+        guard_not_forced() []
+
+        i0 = call(123, descr=sbtdescr)
+        guard_false(i0) []
+        jump()
+        """
+        self.optimize_loop(ops, expected, expected_preamble=preamble)
+
+
 
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.