pypy/module/pypyjit/test_pypy_c/test_misc.py::TestMisc::()::test_dont_trace_every_iteration
self = <pypy.module.pypyjit.test_pypy_c.test_misc.TestMisc object at 0x000001bd20511168>
def test_dont_trace_every_iteration(self):
def reference(a, b):
i = sa = 0
while i < 300:
sa += a % b
i += 1
return sa
#
def main(a, b):
i = sa = 0
while i < 300:
if a > 0:
pass
if 1 < b < 2:
pass
sa += a % b
i += 1
return sa
#
log_ref = self.run(reference, [10, 20])
assert log_ref.result == 300 * (10 % 20)
#
log = self.run(main, [10, 20])
assert log.result == 300 * (10 % 20)
assert log.jit_summary.tracing_no == log_ref.jit_summary.tracing_no
loop, = log.loops_by_filename(self.filepath)
> assert loop.match("""
i11 = int_lt(i7, 300)
guard_true(i11, descr=...)
i12 = int_add_ovf(i8, i9)
guard_no_overflow(descr=...)
i14 = int_add(i7, 1)
--TICK--
jump(..., descr=...)
""")
pypy\module\pypyjit\test_pypy_c\test_misc.py:280:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pypy\module\pypyjit\test_pypy_c\model.py:177: in match
return matcher.match(expected_src, **kwds)
pypy\module\pypyjit\test_pypy_c\model.py:524: in match
self.match_loop(expected_ops, ignore_ops)
pypy\module\pypyjit\test_pypy_c\model.py:500: in match_loop
self.match_op(op, exp_op)
pypy\module\pypyjit\test_pypy_c\model.py:409: in match_op
self._assert(op.name == exp_opname, "operation mismatch")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0x000001bd20c27be8>
cond = False, message = 'operation mismatch'
def _assert(self, cond, message):
if not cond:
> raise InvalidMatch(message, frame=sys._getframe(1))
E InvalidMatch: operation mismatch
pypy\module\pypyjit\test_pypy_c\model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = None
('operation mismatch',)
<could not determine information>
Ignore ops: []
Got:
===== HERE =====
guard_not_invalidated(descr=<Guard0x2324ffbc0f8>)
i47 = int_lt(i41, 300)
guard_true(i47, descr=<Guard0x2324ffafdc0>)
i48 = int_add_ovf(i39, i37)
guard_no_overflow(descr=<Guard0x2324ffafdf0>)
i50 = int_add(i41, 1)
i52 = getfield_raw_i(140729701711872, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i54 = int_lt(i52, 0)
guard_false(i54, descr=<Guard0x2324ffafe50>)
jump(p0, p1, p8, p10, i50, i48, i28, i32, i37, descr=TargetToken(2415113303648))
Expected:
i11 = int_lt(i7, 300)
guard_true(i11, descr=...)
i12 = int_add_ovf(i8, i9)
guard_no_overflow(descr=...)
i14 = int_add(i7, 1)
guard_not_invalidated?
ticker0 = getfield_raw_i(#, descr=<FieldS pypysig_long_struct_inner.c_value .*>)
ticker_cond0 = int_lt(ticker0, 0)
guard_false(ticker_cond0, descr=...)
jump(..., descr=...)
builder: pypy-c-jit-win-x86-64 build #2538+
test: pypy/module/pypyjit/test_pypy_c/test_misc.py::TestMisc::()::test_dont_trace_every_iteration