[pypy-commit] pypy vecopt: loading all code regions instead of the merged ones from World

plan_rich noreply at buildbot.pypy.org
Wed Jun 10 12:06:16 CEST 2015


Author: Richard Plangger <rich at 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
 


More information about the pypy-commit mailing list