[pypy-commit] pypy value-profiling: a test for lists of known types
cfbolz
pypy.commits at gmail.com
Thu Jan 21 14:54:08 EST 2016
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
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--
+ """)
More information about the pypy-commit
mailing list