[pypy-commit] pypy guard-compatible: make sure that the test fails if grow_guard_compatible_switch does nothing by

cfbolz pypy.commits at gmail.com
Mon Mar 14 13:55:28 EDT 2016


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: guard-compatible
Changeset: r83045:25a9cbb2f43b
Date: 2016-03-14 18:48 +0100
http://bitbucket.org/pypy/pypy/changeset/25a9cbb2f43b/

Log:	make sure that the test fails if grow_guard_compatible_switch does
	nothing by checking that the elidable function is not called too
	often

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
@@ -15,8 +15,15 @@
         p3 = lltype.malloc(S)
         p3.x = 6
         driver = jit.JitDriver(greens = [], reds = ['n', 'x'])
+
+        class A(object):
+            pass
+
+        c = A()
+        c.count = 0
         @jit.elidable_compatible()
         def g(s):
+            c.count += 1
             return s.x
 
         def f(n, x):
@@ -29,8 +36,11 @@
             f(100, p1)
             f(100, p2)
             f(100, p3)
+            return c.count
 
-        self.meta_interp(main, [])
+        x = self.meta_interp(main, [])
+
+        assert x < 25
         # XXX check number of bridges
 
     def test_exception(self):


More information about the pypy-commit mailing list