Author: Remi Meier <remi.me...@gmail.com>
Branch: guard-compatible
Changeset: r94061:aab085ce1480
Date: 2018-03-22 09:08 +0100
http://bitbucket.org/pypy/pypy/changeset/aab085ce1480/

Log:    (arigato, remi) cleanup test and make the bridge not contain a
        call_pure

        By preventing to share descrs with the GUARD_NOT_INVALIDATED coming
        from the elidable_compatible decorator, a later guard will not share
        the descr and therefore attach the bridge where it failed itself.
        With that, we don't start the trace at the GUARD_NOT_INVALIDATED,
        which is right after a guard_compatible. (Previously that meant that
        the bridge didn't contain all the information to remove a call_pure)

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
@@ -658,6 +658,8 @@
         #
         if opnum == rop.GUARD_COMPATIBLE: # XXX don't share that for now
             self._last_guard_op = None
+        #
+        # can resume data be shared with previous guard(s):
         if (self._last_guard_op and guard_op.getdescr() is None):
             self.metainterp_sd.profiler.count_ops(opnum,
                                             jitprof.Counters.OPT_GUARDS_SHARED)
@@ -672,7 +674,11 @@
             for farg in op.getfailargs():
                 if farg:
                     self.force_box(farg)
-        if op.getopnum() == rop.GUARD_EXCEPTION:
+
+        if opnum == rop.GUARD_NOT_INVALIDATED:
+            self._last_guard_op = None # XXX don't share the next one either
+
+        if opnum == rop.GUARD_EXCEPTION:
             self._last_guard_op = None
         return op
 
diff --git a/rpython/jit/metainterp/test/test_compatible.py 
b/rpython/jit/metainterp/test/test_compatible.py
--- a/rpython/jit/metainterp/test/test_compatible.py
+++ b/rpython/jit/metainterp/test/test_compatible.py
@@ -485,8 +485,8 @@
 
         c = Counter()
         c.count = 0
-        @jit.elidable_compatible()
-        def g(cls, v):
+        
@jit.elidable_compatible(quasi_immut_field_name_for_second_arg='version')
+        def g(cls, version):
             if we_are_translated():
                 c.count += 1
             return cls.x
@@ -497,8 +497,7 @@
                 driver.can_enter_jit(n=n, x=x)
                 driver.jit_merge_point(n=n, x=x)
                 x = jit.hint(x, promote_compatible=True)
-                v = x.version
-                res = g(x, x.version)
+                res = g(x)
                 n -= res
                 if n % 11 == 5:
                     n -= 1
@@ -562,8 +561,8 @@
 
         c = Counter()
         c.count = 0
-        @jit.elidable_compatible()
-        def g(cls, v):
+        
@jit.elidable_compatible(quasi_immut_field_name_for_second_arg='version')
+        def g(cls, version):
             if we_are_translated():
                 c.count += 1
             return cls.x
@@ -580,8 +579,7 @@
                 driver.can_enter_jit(n=n)
                 driver.jit_merge_point(n=n)
                 x = jit.hint(glob_b.x, promote_compatible=True)
-                v = x.version
-                res = g(x, v)
+                res = g(x)
                 n -= res
                 if n % 11 == 5:
                     n -= 1
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to