[pypy-commit] pypy conditional_call_value_2: Next test, passing

arigo pypy.commits at gmail.com
Sun Sep 11 11:18:56 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: conditional_call_value_2
Changeset: r87002:cc788cdd76d7
Date: 2016-09-11 16:37 +0200
http://bitbucket.org/pypy/pypy/changeset/cc788cdd76d7/

Log:	Next test, passing

diff --git a/rpython/jit/metainterp/test/test_call.py b/rpython/jit/metainterp/test/test_call.py
--- a/rpython/jit/metainterp/test/test_call.py
+++ b/rpython/jit/metainterp/test/test_call.py
@@ -139,6 +139,32 @@
         self.check_resops(call_pure_i=0, cond_call_pure_i=0, call_i=2,
                           int_sub=2)
 
+    def test_cond_call_constant_in_optimizer_3(self):
+        myjitdriver = jit.JitDriver(greens = ['m'], reds = ['n', 'p'])
+        @jit.elidable
+        def externfn(x):
+            return 1
+        class V:
+            def __init__(self, value):
+                self.value = value
+        def f(n, m, p):
+            while n > 0:
+                myjitdriver.can_enter_jit(n=n, p=p, m=m)
+                myjitdriver.jit_merge_point(n=n, p=p, m=m)
+                assert p > 14
+                assert p < 16
+                n0 = n
+                n -= jit.conditional_call_elidable(p, 15, externfn, n0)
+                n -= jit.conditional_call_elidable(p, 15, externfn, n0)
+            return n
+        res = self.meta_interp(f, [21, 5, 15])
+        assert res == -1
+        # same as test_cond_call_constant_in_optimizer_2, but the two
+        # intermediate CALL_PUREs are replaced with only one, because
+        # they are called with the same arguments
+        self.check_resops(call_pure_i=0, cond_call_pure_i=0, call_i=2,
+                          int_sub=4)
+
 
 class TestCall(LLJitMixin, CallTest):
     pass


More information about the pypy-commit mailing list