pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py::TestLogParser::()::test
self = <pypy.module.pypyjit.test_pypy_c.test_jitlogparser.TestLogParser object at 0x0000000031ba8218>
def test(self):
def fn_with_bridges(N):
def is_prime(x):
for y in xrange(2, x):
if x % y == 0:
return False
return True
result = 0
for x in xrange(N):
if x % 3 == 0:
result += 5
elif x % 5 == 0:
result += 3
elif is_prime(x):
result += x
elif x == 99:
result *= 2
return result
#
N = 10000
_log = self.run(fn_with_bridges, [N])
log, loops = import_log(_log.logfile)
parse_log_counts(extract_category(log, 'jit-backend-count'), loops)
is_prime_loops = []
fn_with_bridges_loops = []
bridges = {}
lib_re = re.compile("file '.*lib-python.*'")
for loop in loops:
if hasattr(loop, 'force_asm'):
try:
> loop.force_asm()
pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py:46:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
rpython/tool/jitlogparser/parser.py:472: in <lambda>
dump_start=start_ofs))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.tool.jitlogparser.parser.SimpleParser object at 0x00000000316bb408>
loop = <rpython.jit.tool.oparser_model.ExtendedTreeLoop object at 0x00000000316bb018>
backend_dump = '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...b2bbf2d0ffdff21000e0f200023fd6d0d3ff58b00b00f910ac82d230b2bbf2d0ffdff2b01300f9100080d230b2bbf2d0ffdff21000e0f200023fd6'
backend_tp = 'arm', dump_start = 281470104049008L
def postprocess(self, loop, backend_dump=None, backend_tp=None,
dump_start=0):
if backend_dump is not None:
raw_asm = self._asm_disassemble(backend_dump.decode('hex'),
backend_tp, dump_start)
# additional mess: if the backend_dump starts with a series
# of zeros, raw_asm's first regular line is *after* that,
# after a line saying "...". So we assume that start==dump_start
# if this parameter was passed.
asm = []
start = dump_start
for elem in raw_asm:
if len(elem.split("\t")) < 3:
continue
e = elem.split("\t")
adr = e[0]
v = elem # --- more compactly: " ".join(e[2:])
if not start: # only if 'dump_start' is left at 0
start = int(adr.strip(":"), 16)
ofs = int(adr.strip(":"), 16) - start
if ofs >= 0:
asm.append((ofs, v.strip("\n")))
asm_index = 0
for i, op in enumerate(loop.operations):
end = 0
j = i + 1
while end == 0:
if j == len(loop.operations):
end = loop.last_offset
break
if loop.operations[j].offset is None:
j += 1
else:
end = loop.operations[j].offset
if op.offset is not None:
> while asm[asm_index][0] < op.offset:
E IndexError: list index out of range
rpython/tool/jitlogparser/parser.py:141: IndexError
---------- Captured stdout call ----------
loading symbols from /build_dir/pypy-c-jit-linux-aarch64/build/pypy/goal/pypy-c...
22 symbols found
---------- Captured stderr call ----------
0%..loaded
builder: pypy-c-jit-linux-aarch64 build #2903+
test: pypy/module/pypyjit/test_pypy_c/test_jitlogparser.py::TestLogParser::()::test