pypy/module/pypyjit/test_pypy_c/test_misc.py::TestMisc::()::test_factorial
self = <pypy.module.pypyjit.test_pypy_c.test_misc.TestMisc object at 0x0e4ac8b0>
def test_factorial(self):
def fact(n):
r = 1
while n > 1:
r *= n
n -= 1
return r
log = self.run(fact, [7], threshold=4)
assert log.result == 5040
loop, = log.loops_by_filename(self.filepath)
> assert loop.match("""
i7 = int_gt(i4, 1)
guard_true(i7, descr=...)
i8 = int_mul_ovf(i5, i4)
guard_no_overflow(descr=...)
i10 = int_add(i4, -1)
--TICK--
jump(..., descr=...)
""")
pypy/module/pypyjit/test_pypy_c/test_misc.py:52:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 0x11d91330>
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=<Guard0x8b59ee8>)
i31 = int_gt(i25, 1)
guard_true(i31, descr=<Guard0x8b9110c>)
i32 = int_mul_ovf(i23, i25)
guard_no_overflow(descr=<Guard0x8b91128>)
i34 = int_add(i25, -1)
i36 = getfield_raw_i(-135545728, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i38 = int_lt(i36, 0)
guard_false(i38, descr=<Guard0x8b91160>)
jump(p0, p1, i34, i32, descr=TargetToken(145405360))
Expected:
i7 = int_gt(i4, 1)
guard_true(i7, descr=...)
i8 = int_mul_ovf(i5, i4)
guard_no_overflow(descr=...)
i10 = int_add(i4, -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-linux-x86-32 build #8482+
test: pypy/module/pypyjit/test_pypy_c/test_misc.py::TestMisc::()::test_factorial