[pypy-svn] r70180 - pypy/branch/change-celldict/pypy/module/pypyjit/test
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Dec 17 18:31:19 CET 2009
Author: cfbolz
Date: Thu Dec 17 18:31:19 2009
New Revision: 70180
Modified:
pypy/branch/change-celldict/pypy/module/pypyjit/test/test_pypy_c.py
Log:
Update those tests to match what you get for global lookups.
Modified: pypy/branch/change-celldict/pypy/module/pypyjit/test/test_pypy_c.py
==============================================================================
--- pypy/branch/change-celldict/pypy/module/pypyjit/test/test_pypy_c.py (original)
+++ pypy/branch/change-celldict/pypy/module/pypyjit/test/test_pypy_c.py Thu Dec 17 18:31:19 2009
@@ -210,21 +210,31 @@
def test_simple_call(self):
self.run_source('''
+ OFFSET = 0
def f(i):
- return i + 1
+ return i + 1 + OFFSET
def main(n):
i = 0
- while i < n:
+ while i < n+OFFSET:
i = f(f(i))
return i
- ''', 76,
+ ''', 96,
([20], 20),
([31], 32))
ops = self.get_by_bytecode("LOAD_GLOBAL")
- assert len(ops) == 2
- assert ops[0].get_opnames() == ["getfield_gc", "getarrayitem_gc",
+ assert len(ops) == 5
+ assert ops[0].get_opnames() == ["getfield_gc", "guard_value",
+ "getfield_gc", "guard_isnull",
"getfield_gc", "guard_nonnull_class"]
- assert not ops[1] # second LOAD_GLOBAL folded away
+ # the second getfield on the same globals is quicker
+ assert ops[1].get_opnames() == ["getfield_gc", "guard_nonnull_class"]
+ assert not ops[2] # second LOAD_GLOBAL of the same name folded away
+ # LOAD_GLOBAL of the same name but in different function partially
+ # folded away
+ # XXX could be improved
+ assert ops[3].get_opnames() == ["guard_value",
+ "getfield_gc", "guard_isnull"]
+ assert not ops[4]
ops = self.get_by_bytecode("CALL_FUNCTION")
assert len(ops) == 2
for bytecode in ops:
@@ -279,7 +289,7 @@
while i < n:
i = f(f(i), j=1)
return i
- ''', 98,
+ ''', 100,
([20], 20),
([31], 32))
ops = self.get_by_bytecode("CALL_FUNCTION")
@@ -303,7 +313,7 @@
a.x = 2
i = i + a.x
return i
- ''', 63,
+ ''', 65,
([20], 20),
([31], 32))
More information about the Pypy-commit
mailing list