[pypy-svn] r78648 - in pypy/branch/jit-unroll-loops/pypy/module: array/benchmark pypyjit/test
hakanardo at codespeak.net
hakanardo at codespeak.net
Tue Nov 2 19:38:26 CET 2010
Author: hakanardo
Date: Tue Nov 2 19:38:24 2010
New Revision: 78648
Modified:
pypy/branch/jit-unroll-loops/pypy/module/array/benchmark/circulartst.py
pypy/branch/jit-unroll-loops/pypy/module/pypyjit/test/test_pypy_c.py
Log:
fixed test to look for the profiling guard in the preamble
Modified: pypy/branch/jit-unroll-loops/pypy/module/array/benchmark/circulartst.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/module/array/benchmark/circulartst.py (original)
+++ pypy/branch/jit-unroll-loops/pypy/module/array/benchmark/circulartst.py Tue Nov 2 19:38:24 2010
@@ -17,7 +17,6 @@
sa = 0
while i < 200000000:
sa += buf[i-2] + buf[i-1] + buf[i] + buf[i+1] + buf[i+2]
- if i%100 == 0: sys.stderr.write('%d\n'%i)
i += 1
return sa
Modified: pypy/branch/jit-unroll-loops/pypy/module/pypyjit/test/test_pypy_c.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/module/pypyjit/test/test_pypy_c.py (original)
+++ pypy/branch/jit-unroll-loops/pypy/module/pypyjit/test/test_pypy_c.py Tue Nov 2 19:38:24 2010
@@ -131,27 +131,35 @@
return result
def parse_loops(self, opslogfile):
- from pypy.jit.tool.oparser import parse
from pypy.tool import logparser
assert opslogfile.check()
log = logparser.parse_log_file(str(opslogfile))
parts = logparser.extract_category(log, 'jit-log-opt-')
self.rawloops = [part for part in parts
if not from_entry_bridge(part, parts)]
- # skip entry bridges, they can contain random things
- self.loops = [parse(part, no_namespace=True) for part in self.rawloops]
- self.sliced_loops = [] # contains all bytecodes of all loops
- self.total_ops = 0
- for loop in self.loops:
- self.total_ops += len(loop.operations)
+ self.loops, self.sliced_loops, self.total_ops = \
+ self.parse_rawloops(self.rawloops)
+ self.check_0_op_bytecodes()
+ self.rawentrybridges = [part for part in parts
+ if from_entry_bridge(part, parts)]
+ _, self.sliced_entrybridge, _ = \
+ self.parse_rawloops(self.rawentrybridges)
+
+ def parse_rawloops(self, rawloops):
+ from pypy.jit.tool.oparser import parse
+ loops = [parse(part, no_namespace=True) for part in rawloops]
+ sliced_loops = [] # contains all bytecodes of all loops
+ total_ops = 0
+ for loop in loops:
+ total_ops += len(loop.operations)
for op in loop.operations:
if op.getopname() == "debug_merge_point":
sliced_loop = BytecodeTrace()
sliced_loop.bytecode = op.getarg(0)._get_str().rsplit(" ", 1)[1]
- self.sliced_loops.append(sliced_loop)
+ sliced_loops.append(sliced_loop)
else:
sliced_loop.append(op)
- self.check_0_op_bytecodes()
+ return loops, sliced_loops, total_ops
def check_0_op_bytecodes(self):
for bytecodetrace in self.sliced_loops:
@@ -159,8 +167,12 @@
continue
assert not bytecodetrace
- def get_by_bytecode(self, name):
- return [ops for ops in self.sliced_loops if ops.bytecode == name]
+ def get_by_bytecode(self, name, from_entry_bridge=False):
+ if from_entry_bridge:
+ sliced_loops = self.sliced_entrybridge
+ else:
+ sliced_loops = self.sliced_loops
+ return [ops for ops in sliced_loops if ops.bytecode == name]
def print_loops(self):
for rawloop in self.rawloops:
@@ -471,6 +483,8 @@
bytecode, = self.get_by_bytecode("CALL_METHOD")
assert len(bytecode.get_opnames("new_with_vtable")) == 1 # the forcing of the int
assert len(bytecode.get_opnames("call")) == 1 # the call to append
+ assert len(bytecode.get_opnames("guard")) == 1 # guard for guard_no_exception after the call
+ bytecode, = self.get_by_bytecode("CALL_METHOD", True)
assert len(bytecode.get_opnames("guard")) == 2 # guard for profiling disabledness + guard_no_exception after the call
def test_range_iter(self):
More information about the Pypy-commit
mailing list