Author: Alex Gaynor <[email protected]>
Branch: python-loop-unroll
Changeset: r65463:eba8aacbc617
Date: 2013-07-18 10:08 -0700
http://bitbucket.org/pypy/pypy/changeset/eba8aacbc617/
Log: Attempt to write a test
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py
b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -408,3 +408,30 @@
log = self.run(main, [300])
loop, = log.loops_by_id("long_op")
assert len(loop.ops_by_id("long_op")) == 0
+
+ def test_explicit_loop_unrolling(self):
+ def main(n):
+ class A(object):
+ def __init__(self):
+ self.a = 0
+ self.b = 0
+
+ i = 0
+ while i < n:
+ a = A()
+ for attr in ["a", "b"]:
+ setattr(a, attr, getattr(a, attr) + 1)
+ i += a.b
+
+ log = self.run(main, [300])
+ loop, = log.loops_by_filename(self.filepath)
+ assert loop.match("""
+ label(..., descr=TargetToken(4370600008))
+ i48 = int_lt(i43, i30)
+ guard_true(i48, descr=...)
+ guard_not_invalidated(descr=...)
+ p49 = force_token()
+ i50 = int_add(i43, 1)
+ --TICK--
+ jump(..., descr=TargetToken(4370600008))
+ """)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit