Author: Carl Friedrich Bolz <[email protected]>
Branch: value-profiling
Changeset: r81890:09164c7f58aa
Date: 2016-01-21 13:58 +0100
http://bitbucket.org/pypy/pypy/changeset/09164c7f58aa/

Log:    a test for lists of known types

diff --git a/pypy/module/pypyjit/test_pypy_c/test_containers.py 
b/pypy/module/pypyjit/test_pypy_c/test_containers.py
--- a/pypy/module/pypyjit/test_pypy_c/test_containers.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_containers.py
@@ -269,3 +269,22 @@
         loop, = log.loops_by_filename(self.filepath)
         opnames = log.opnames(loop.allops())
         assert opnames.count('new_with_vtable') == 0
+
+    def test_list_of_known_types(self):
+        def main(n):
+            l = [[]] * 1000
+            i = 0
+            while i < 1000:
+                # l[i] is not None is always True, because l[i] has known type
+                # W_ListObject
+                i += l[i] is not None # ID: typecheck
+
+        log = self.run(main, [1000])
+        loop, = log.loops_by_filename(self.filepath)
+        assert loop.match_by_id("typecheck", """
+            i40 = uint_ge(i34, i29)
+            guard_false(i40, descr=...)
+            p41 = getarrayitem_gc_r(p31, i34, descr=<ArrayP .*>)
+            i42 = int_add(i34, 1)
+            --TICK--
+        """)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to