Author: Richard Plangger <r...@pasra.at> Branch: vmprof-address Changeset: r78007:c1dc41980f3b Date: 2015-06-10 12:01 +0200 http://bitbucket.org/pypy/pypy/changeset/c1dc41980f3b/
Log: manually loading address from log to get all addresses and be able to display all assembler dumps diff --git a/rpython/jit/backend/tool/viewcode.py b/rpython/jit/backend/tool/viewcode.py --- a/rpython/jit/backend/tool/viewcode.py +++ b/rpython/jit/backend/tool/viewcode.py @@ -265,7 +265,7 @@ while j<len(self.ranges) and coderange.touches(self.ranges[j]): coderange.update_from_old(self.ranges[j]) j += 1 - self.ranges.insert(i, coderange) + self.ranges[i:j] = [coderange] elif line.startswith('LOG '): pieces = line.split(None, 3) assert pieces[1].startswith('@') 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,34 @@ 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 addr, rang in ranges.items(): + 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: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit