Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r60482:ee9892ab4807
Date: 2013-01-25 21:52 +0200
http://bitbucket.org/pypy/pypy/changeset/ee9892ab4807/
Log: a test and a fix
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
@@ -247,12 +247,15 @@
if not stack:
stack.append([])
else:
- if bc.inline_level is not None and bc.inline_level + 1 !=
len(stack):
- if bc.inline_level < len(stack):
- last = stack.pop()
- stack[-1].append(cls(last, getpath(stack), storage))
+ if bc.inline_level is not None:
+ if bc.inline_level == len(stack) - 1:
+ pass
+ elif bc.inline_level > len(stack) - 1:
+ stack.append([])
else:
- stack.append([])
+ while bc.inline_level + 1 < len(stack):
+ last = stack.pop()
+ stack[-1].append(cls(last, getpath(stack),
storage))
stack[-1].append(bc)
so_far = []
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
@@ -354,3 +354,14 @@
f = Function.from_operations(loop.operations, LoopStorage())
assert f.chunks[-1].filename == 'x.py'
assert f.filename is None
+
+def test_parse_2_levels_up():
+ loop = parse("""
+ []
+ debug_merge_point(0, 0, 'one')
+ debug_merge_point(1, 0, 'two')
+ debug_merge_point(2, 0, 'three')
+ debug_merge_point(0, 0, 'one')
+ """)
+ f = Function.from_operations(loop.operations, LoopStorage())
+ assert len(f.chunks) == 3
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit