[pypy-svn] r71384 - pypy/trunk/pypy/module/pypyjit/test
fijal at codespeak.net
fijal at codespeak.net
Sun Feb 21 17:02:44 CET 2010
Author: fijal
Date: Sun Feb 21 17:02:42 2010
New Revision: 71384
Modified:
pypy/trunk/pypy/module/pypyjit/test/test_pypy_c.py
Log:
Write a test for chain of guards. Should pass now, but I don't have a recent
pypy-c around
Modified: pypy/trunk/pypy/module/pypyjit/test/test_pypy_c.py
==============================================================================
--- pypy/trunk/pypy/module/pypyjit/test/test_pypy_c.py (original)
+++ pypy/trunk/pypy/module/pypyjit/test/test_pypy_c.py Sun Feb 21 17:02:42 2010
@@ -531,6 +531,25 @@
bytecode, = self.get_by_bytecode("COMPARE_OP")
assert len(bytecode.get_opnames()) <= 2 # oois, guard_true
+ def test_chain_of_guards(self):
+ self.run_source('''
+ class A(object):
+ def method_x(self):
+ return 3
+
+ l = ["x", "y"]
+
+ def main(arg):
+ sum = 0
+ a = A()
+ i = 0
+ while i < 2000:
+ name = l[arg]
+ sum += getattr(a, 'method_' + name)()
+ i += 1
+ return sum
+ ''', 3000, ([0], 2000*3))
+ assert len(self.loops) == 1
class AppTestJIT(PyPyCJITTests):
def setup_class(cls):
More information about the Pypy-commit
mailing list