Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: guard-compatible
Changeset: r83016:ac2efcf3d81a
Date: 2016-03-13 18:31 +0100
http://bitbucket.org/pypy/pypy/changeset/ac2efcf3d81a/

Log:    a test for the interaction of guard_compatible and guard_class

diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py 
b/rpython/jit/metainterp/optimizeopt/optimizer.py
--- a/rpython/jit/metainterp/optimizeopt/optimizer.py
+++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
@@ -607,6 +607,8 @@
                 self._last_guard_op.getopnum() != rop.GUARD_NOT_FORCED):
             self._last_guard_op = None
         #
+        if opnum == rop.GUARD_COMPATIBLE: # XXX don't share that for now
+            self._last_guard_op = None
         if (self._last_guard_op and guard_op.getdescr() is None):
             self.metainterp_sd.profiler.count_ops(opnum,
                                             jitprof.Counters.OPT_GUARDS_SHARED)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_compatible.py 
b/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
@@ -8,7 +8,7 @@
 
     enable_opts = "intbounds:rewrite:virtualize:string:earlyforce:pure:heap"
 
-    def test_guard_compatible_after_guard_value(self):
+    def test_guard_compatible_and_guard_value(self):
         ops = """
         [p1]
         guard_value(p1, ConstPtr(myptr)) []
@@ -30,6 +30,22 @@
         """
         self.optimize_loop(ops, expected)
 
+    def test_guard_compatible_and_guard_class(self):
+        ops = """
+        [p1]
+        guard_class(p1, ConstClass(node_vtable)) []
+        guard_compatible(p1, ConstPtr(myptr)) []
+        guard_class(p1, ConstClass(node_vtable)) []
+        jump(ConstPtr(myptr))
+        """
+        expected = """
+        [p1]
+        guard_class(p1, ConstClass(node_vtable)) []
+        guard_compatible(p1, ConstPtr(myptr)) []
+        jump(ConstPtr(myptr))
+        """
+        self.optimize_loop(ops, expected)
+
     def test_guard_compatible_after_guard_compatible(self):
         ops = """
         [p1]
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to