[pypy-commit] pypy jitframe-on-heap: merge default

fijal noreply at buildbot.pypy.org
Fri Jan 25 21:40:00 CET 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: jitframe-on-heap
Changeset: r60485:2bc4c9896967
Date: 2013-01-25 22:39 +0200
http://bitbucket.org/pypy/pypy/changeset/2bc4c9896967/

Log:	merge default

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
@@ -215,6 +215,7 @@
     _lineset = None
     is_bytecode = False
     inline_level = None
+    bytecode_name = None
 
     # factory method
     TraceForOpcode = TraceForOpcode
@@ -244,26 +245,29 @@
             return ",".join([str(len(v)) for v in stack])
 
         def append_to_res(bc):
-            if not stack:
-                stack.append([])
-            else:
-                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:
-                        while bc.inline_level + 1 < 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:
+                    while bc.inline_level + 1 < len(stack):
+                        last = stack.pop()
+                        stack[-1].append(cls(last, getpath(stack), storage))
             stack[-1].append(bc)
 
         so_far = []
         stack = []
+        nothing_yet = True
         for op in operations:
             if op.name == 'debug_merge_point':
                 if so_far:
-                    append_to_res(cls.TraceForOpcode(so_far, storage, loopname))
+                    opc = cls.TraceForOpcode(so_far, storage, loopname)
+                    if nothing_yet:
+                        nothing_yet = False
+                        for i in xrange(opc.inline_level + 1):
+                            stack.append([])
+                    append_to_res(opc)
                     if limit:
                         break
                     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
@@ -365,3 +365,14 @@
     """)
     f = Function.from_operations(loop.operations, LoopStorage())
     assert len(f.chunks) == 3
+
+def test_parse_from_inside():
+    loop = parse("""
+    []
+    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) == 2
+    


More information about the pypy-commit mailing list