[pypy-commit] pypy default: test_call moves stuff around, but should still pass. Use "guard_not_invalidated?" in general.

arigo noreply at buildbot.pypy.org
Fri May 31 17:34:00 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r64682:16e45de635c6
Date: 2013-05-31 17:23 +0200
http://bitbucket.org/pypy/pypy/changeset/16e45de635c6/

Log:	test_call moves stuff around, but should still pass. Use
	"guard_not_invalidated?" in general.

diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py
--- a/pypy/module/pypyjit/test_pypy_c/model.py
+++ b/pypy/module/pypyjit/test_pypy_c/model.py
@@ -184,7 +184,7 @@
 
     def match_by_id(self, id, expected_src, **kwds):
         ops = list(self.ops_by_id(id, **kwds))
-        matcher = OpMatcher(ops)
+        matcher = OpMatcher(ops, id)
         return matcher.match(expected_src)
 
 class PartialTraceWithIds(TraceWithIds):
@@ -260,8 +260,9 @@
 
 class OpMatcher(object):
 
-    def __init__(self, ops):
+    def __init__(self, ops, id=None):
         self.ops = ops
+        self.id = id
         self.src = '\n'.join(map(str, ops))
         self.alpha_map = {}
 
@@ -495,6 +496,7 @@
             print '@' * 40
             print "Loops don't match"
             print "================="
+            print 'loop id = %r' % (self.id,)
             print e.args
             print e.msg
             print
diff --git a/pypy/module/pypyjit/test_pypy_c/test_call.py b/pypy/module/pypyjit/test_pypy_c/test_call.py
--- a/pypy/module/pypyjit/test_pypy_c/test_call.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_call.py
@@ -254,17 +254,22 @@
                 return c
             #
             s = 0
-            for i in range(x):
+            i = 0
+            while i < x:
                 l = [i, x, 2]
                 s += g(*l)       # ID: g1
                 s += h(*l)       # ID: h1
                 s += g(i, x, 2)  # ID: g2
                 a = 0
-            for i in range(x):
+                i += 1
+            i = 0
+            while i < x:
                 l = [x, 2]
+                g(*l)
                 s += g(i, *l)    # ID: g3
                 s += h(i, *l)    # ID: h2
                 a = 0
+                i += 1
             return s
         #
         log = self.run(main, [1000])
@@ -339,6 +344,7 @@
         loop, = log.loops_by_filename(self.filepath)
         # the int strategy is used here
         assert loop.match_by_id('append', """
+            guard_not_invalidated?
             i13 = getfield_gc(p8, descr=<FieldS list.length .*>)
             i15 = int_add(i13, 1)
             # Will be killed by the backend
@@ -486,6 +492,7 @@
         assert loop.match("""
             i2 = int_lt(i0, i1)
             guard_true(i2, descr=...)
+            guard_not_invalidated?
             i3 = force_token()
             i4 = int_add(i0, 1)
             --TICK--
@@ -585,7 +592,7 @@
         """, [1000])
         loop, = log.loops_by_id('call')
         assert loop.match_by_id('call', '''
-        guard_not_invalidated(descr=...)
+        guard_not_invalidated?
         i1 = force_token()
         ''')
 


More information about the pypy-commit mailing list