[pypy-svn] pypy default: actually check something in these loops

antocuni commits-noreply at bitbucket.org
Fri Apr 15 13:29:36 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r43385:9f2c65d1f7ef
Date: 2011-04-15 11:58 +0200
http://bitbucket.org/pypy/pypy/changeset/9f2c65d1f7ef/

Log:	actually check something in these loops

diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
--- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
@@ -1455,23 +1455,35 @@
             i=2
             sa=0
             while i < 300: 
-                sa+=max(*range(i))
+                sa+=max(*range(i))  # ID: max
                 i+=1
             return sa
         log = self.run(main, [], threshold=200)
         assert log.result == main()
         loop, = log.loops_by_filename(self.filepath)
-        # XXX: what do we want to check here?
+        # check that max() is turned into a residual call and not into 300
+        # individual guards
+        assert loop.match_by_id("max", """
+           ...
+           p58 = call_may_force(ConstClass(min_max_loop__max), _, _, descr=...)
+           ...
+        """)
 
     def test_iter_max(self):
         def main():
             i=2
             sa=0
             while i < 300:
-                sa+=max(range(i))
+                sa+=max(range(i))   # ID: max
                 i+=1
             return sa
         log = self.run(main, [], threshold=200)
         assert log.result == main()
         loop, = log.loops_by_filename(self.filepath)
-        # XXX: what do we want to check here?
+        # check that max() is turned into a residual call and not into 300
+        # individual guards
+        assert loop.match_by_id("max", """
+           ...
+           p58 = call_may_force(ConstClass(min_max_loop__max), _, _, descr=...)
+           ...
+        """)


More information about the Pypy-commit mailing list