[pypy-commit] pypy jit-targets: fix test to not retrace when the guard is created and only to count the number of int_mul which is what the test is about

hakanardo noreply at buildbot.pypy.org
Tue Nov 8 14:10:06 CET 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-targets
Changeset: r48932:1515bd7380ed
Date: 2011-11-08 13:02 +0100
http://bitbucket.org/pypy/pypy/changeset/1515bd7380ed/

Log:	fix test to not retrace when the guard is created and only to count
	the number of int_mul which is what the test is about

diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -180,43 +180,39 @@
         self.check_trace_count(3)
 
     def test_loop_invariant_mul_bridge_maintaining1(self):
-        myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x'])
-        def f(x, y):
+        myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x', 'n'])
+        def f(x, y, n):
             res = 0
             while y > 0:
-                myjitdriver.can_enter_jit(x=x, y=y, res=res)
-                myjitdriver.jit_merge_point(x=x, y=y, res=res)
+                myjitdriver.can_enter_jit(x=x, y=y, res=res, n=n)
+                myjitdriver.jit_merge_point(x=x, y=y, res=res, n=n)
                 res += x * x
-                if y<16:
+                if y<n:
                     res += 1
                 y -= 1
             return res
-        res = self.meta_interp(f, [6, 32])
+        res = self.meta_interp(f, [6, 32, 16])
         assert res == 1167
         self.check_trace_count(3)
-        self.check_resops({'int_lt': 3, 'int_gt': 2, 'int_add': 5,
-                           'guard_true': 3, 'int_sub': 4, 'jump': 2,
-                           'int_mul': 2, 'guard_false': 2})
+        self.check_resops(int_mul=3)
 
     def test_loop_invariant_mul_bridge_maintaining2(self):
-        myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x'])
-        def f(x, y):
+        myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x', 'n'])
+        def f(x, y, n):
             res = 0
             while y > 0:
-                myjitdriver.can_enter_jit(x=x, y=y, res=res)
-                myjitdriver.jit_merge_point(x=x, y=y, res=res)
+                myjitdriver.can_enter_jit(x=x, y=y, res=res, n=n)
+                myjitdriver.jit_merge_point(x=x, y=y, res=res, n=n)
                 z = x * x
                 res += z
-                if y<16:
+                if y<n:
                     res += z
                 y -= 1
             return res
-        res = self.meta_interp(f, [6, 32])
+        res = self.meta_interp(f, [6, 32, 16])
         assert res == 1692
         self.check_trace_count(3)
-        self.check_resops({'int_lt': 3, 'int_gt': 2, 'int_add': 5,
-                           'guard_true': 3, 'int_sub': 4, 'jump': 2,
-                           'int_mul': 2, 'guard_false': 2})
+        self.check_resops(int_mul=3)
 
     def test_loop_invariant_mul_bridge_maintaining3(self):
         myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x', 'm'])


More information about the pypy-commit mailing list