Author: Remi Meier <[email protected]>
Branch: stmgc-c4
Changeset: r68649:8a7060e399a8
Date: 2014-01-13 15:05 +0100
http://bitbucket.org/pypy/pypy/changeset/8a7060e399a8/

Log:    add transaction breaks after guard_not_forced

diff --git a/rpython/jit/metainterp/optimizeopt/stm.py 
b/rpython/jit/metainterp/optimizeopt/stm.py
--- a/rpython/jit/metainterp/optimizeopt/stm.py
+++ b/rpython/jit/metainterp/optimizeopt/stm.py
@@ -14,6 +14,7 @@
     """
     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)
@@ -38,6 +39,7 @@
         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
 
@@ -45,6 +47,9 @@
         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)
         
         
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_stm.py 
b/rpython/jit/metainterp/optimizeopt/test/test_stm.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_stm.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_stm.py
@@ -114,6 +114,53 @@
         """
         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)
+
+
 
 
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to