Author: Richard Plangger <r...@pasra.at>
Branch: vecopt
Changeset: r78008:09753b7b85af
Date: 2015-06-10 12:05 +0200
http://bitbucket.org/pypy/pypy/changeset/09753b7b85af/

Log:    loading all code regions instead of the merged ones from World

diff --git a/rpython/tool/jitlogparser/parser.py 
b/rpython/tool/jitlogparser/parser.py
--- a/rpython/tool/jitlogparser/parser.py
+++ b/rpython/tool/jitlogparser/parser.py
@@ -407,16 +407,35 @@
 def import_log(logname, ParserCls=SimpleParser):
     log = parse_log_file(logname)
     addrs = parse_addresses(extract_category(log, 'jit-backend-addr'))
-    from rpython.jit.backend.tool.viewcode import World
-    world = World()
+    from rpython.jit.backend.tool.viewcode import CodeRange
+    ranges = {}
+    backend_name = None
     for entry in extract_category(log, 'jit-backend-dump'):
-        world.parse(entry.splitlines(True))
+        for line in entry.splitlines(True):
+            # copied from class World
+            if line.startswith('BACKEND '):
+                backend_name = line.split(' ')[1].strip()
+            if line.startswith('CODE_DUMP '):
+                pieces = line.split()
+                assert pieces[1].startswith('@')
+                assert pieces[2].startswith('+')
+                if len(pieces) == 3:
+                    continue     # empty line
+                baseaddr = long(pieces[1][1:], 16)
+                if baseaddr < 0:
+                    baseaddr += (2 * sys.maxint + 2)
+                offset = int(pieces[2][1:])
+                addr = baseaddr + offset
+                data = pieces[3].replace(':', '').decode('hex')
+                coderange = CodeRange(None, addr, data)
+                ranges[addr] = coderange
     dumps = {}
-    for r in world.ranges:
-        if r.addr in addrs and addrs[r.addr]:
-            name = addrs[r.addr].pop(0) # they should come in order
-            data = r.data.encode('hex')       # backward compatibility
-            dumps[name] = (world.backend_name, r.addr, data)
+    for rang in sorted(ranges.values()):
+        addr = rang.addr
+        if addr in addrs and addrs[addr]:
+            name = addrs[addr].pop(0) # they should come in order
+            data = rang.data.encode('hex') # backward compatibility
+            dumps[name] = (backend_name, addr, data)
     loops = []
     cat = extract_category(log, 'jit-log-opt')
     if not cat:
@@ -443,6 +462,9 @@
                               parser.postprocess(loop, backend_tp=bname,
                                                  backend_dump=dump,
                                                  dump_start=start_ofs))
+            loop.start_ofs = start_ofs
+        else:
+            loop.start_ofs = -1
         loops += split_trace(loop)
     return log, loops
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to