[pypy-commit] pypy default: fix parser and tests
fijal
noreply at buildbot.pypy.org
Sat Jun 18 10:20:38 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r44991:5d021179fc09
Date: 2011-06-18 10:24 +0200
http://bitbucket.org/pypy/pypy/changeset/5d021179fc09/
Log: fix parser and tests
diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py
--- a/pypy/tool/jitlogparser/parser.py
+++ b/pypy/tool/jitlogparser/parser.py
@@ -98,7 +98,7 @@
def __init__(self, operations, storage):
if operations[0].name == 'debug_merge_point':
self.inline_level = int(operations[0].args[0])
- m = re.search('<code object ([<>\w]+), file \'(.+?)\', line (\d+)> #(\d+) (\w+)',
+ m = re.search('<code object ([<>\w]+)\. file \'(.+?)\'\. line (\d+)> #(\d+) (\w+)',
operations[0].getarg(1))
if m is None:
# a non-code loop, like StrLiteralSearch or something
diff --git a/pypy/tool/jitlogparser/test/test_parser.py b/pypy/tool/jitlogparser/test/test_parser.py
--- a/pypy/tool/jitlogparser/test/test_parser.py
+++ b/pypy/tool/jitlogparser/test/test_parser.py
@@ -38,10 +38,10 @@
def test_split():
ops = parse('''
[i0]
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 200> #10 ADD")
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 200> #11 SUB")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 200> #10 ADD")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 200> #11 SUB")
i1 = int_add(i0, 1)
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 200> #11 SUB")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 200> #11 SUB")
i2 = int_add(i1, 1)
''')
res = Function.from_operations(ops.operations, LoopStorage())
@@ -54,12 +54,12 @@
def test_inlined_call():
ops = parse("""
[]
- debug_merge_point(0, '<code object inlined_call, file 'source.py', line 12> #28 CALL_FUNCTION')
+ debug_merge_point(0, '<code object inlined_call. file 'source.py'. line 12> #28 CALL_FUNCTION')
i18 = getfield_gc(p0, descr=<BoolFieldDescr pypy.interpreter.pyframe.PyFrame.inst_is_being_profiled 89>)
- debug_merge_point(1, '<code object inner, file 'source.py', line 9> #0 LOAD_FAST')
- debug_merge_point(1, '<code object inner, file 'source.py', line 9> #3 LOAD_CONST')
- debug_merge_point(1, '<code object inner, file 'source.py', line 9> #7 RETURN_VALUE')
- debug_merge_point(0, '<code object inlined_call, file 'source.py', line 12> #31 STORE_FAST')
+ debug_merge_point(1, '<code object inner. file 'source.py'. line 9> #0 LOAD_FAST')
+ debug_merge_point(1, '<code object inner. file 'source.py'. line 9> #3 LOAD_CONST')
+ debug_merge_point(1, '<code object inner. file 'source.py'. line 9> #7 RETURN_VALUE')
+ debug_merge_point(0, '<code object inlined_call. file 'source.py'. line 12> #31 STORE_FAST')
""")
res = Function.from_operations(ops.operations, LoopStorage())
assert len(res.chunks) == 3 # two chunks + inlined call
@@ -72,10 +72,10 @@
def test_name():
ops = parse('''
[i0]
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 200> #10 ADD")
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 201> #11 SUB")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 200> #10 ADD")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 201> #11 SUB")
i1 = int_add(i0, 1)
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 202> #11 SUB")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 202> #11 SUB")
i2 = int_add(i1, 1)
''')
res = Function.from_operations(ops.operations, LoopStorage())
@@ -89,10 +89,10 @@
ops = parse('''
[i0]
i3 = int_add(i0, 1)
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 200> #10 ADD")
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 201> #11 SUB")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 200> #10 ADD")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 201> #11 SUB")
i1 = int_add(i0, 1)
- debug_merge_point(0, "<code object stuff, file '/I/dont/exist.py', line 202> #11 SUB")
+ debug_merge_point(0, "<code object stuff. file '/I/dont/exist.py'. line 202> #11 SUB")
i2 = int_add(i1, 1)
''')
res = Function.from_operations(ops.operations, LoopStorage())
@@ -102,10 +102,10 @@
fname = str(py.path.local(__file__).join('..', 'x.py'))
ops = parse('''
[i0, i1]
- debug_merge_point(0, "<code object f, file '%(fname)s', line 2> #0 LOAD_FAST")
- debug_merge_point(0, "<code object f, file '%(fname)s', line 2> #3 LOAD_FAST")
- debug_merge_point(0, "<code object f, file '%(fname)s', line 2> #6 BINARY_ADD")
- debug_merge_point(0, "<code object f, file '%(fname)s', line 2> #7 RETURN_VALUE")
+ debug_merge_point(0, "<code object f. file '%(fname)s'. line 2> #0 LOAD_FAST")
+ debug_merge_point(0, "<code object f. file '%(fname)s'. line 2> #3 LOAD_FAST")
+ debug_merge_point(0, "<code object f. file '%(fname)s'. line 2> #6 BINARY_ADD")
+ debug_merge_point(0, "<code object f. file '%(fname)s'. line 2> #7 RETURN_VALUE")
''' % locals())
res = Function.from_operations(ops.operations, LoopStorage())
assert res.chunks[1].lineno == 3
@@ -114,11 +114,11 @@
fname = str(py.path.local(__file__).join('..', 'x.py'))
ops = parse('''
[i0, i1]
- debug_merge_point(0, "<code object g, file '%(fname)s', line 5> #9 LOAD_FAST")
- debug_merge_point(0, "<code object g, file '%(fname)s', line 5> #12 LOAD_CONST")
- debug_merge_point(0, "<code object g, file '%(fname)s', line 5> #22 LOAD_CONST")
- debug_merge_point(0, "<code object g, file '%(fname)s', line 5> #28 LOAD_CONST")
- debug_merge_point(0, "<code object g, file '%(fname)s', line 5> #6 SETUP_LOOP")
+ debug_merge_point(0, "<code object g. file '%(fname)s'. line 5> #9 LOAD_FAST")
+ debug_merge_point(0, "<code object g. file '%(fname)s'. line 5> #12 LOAD_CONST")
+ debug_merge_point(0, "<code object g. file '%(fname)s'. line 5> #22 LOAD_CONST")
+ debug_merge_point(0, "<code object g. file '%(fname)s'. line 5> #28 LOAD_CONST")
+ debug_merge_point(0, "<code object g. file '%(fname)s'. line 5> #6 SETUP_LOOP")
''' % locals())
res = Function.from_operations(ops.operations, LoopStorage())
assert res.linerange == (7, 9)
@@ -128,7 +128,7 @@
fname = str(py.path.local(__file__).join('..', 'x.py'))
ops = parse("""
[p6, p1]
- debug_merge_point(0, '<code object h, file '%(fname)s', line 11> #17 FOR_ITER')
+ debug_merge_point(0, '<code object h. file '%(fname)s'. line 11> #17 FOR_ITER')
guard_class(p6, 144264192, descr=<Guard2>)
p12 = getfield_gc(p6, descr=<GcPtrFieldDescr pypy.objspace.std.iterobject.W_AbstractSeqIterObject.inst_w_seq 12>)
""" % locals())
More information about the pypy-commit
mailing list