pypy/module/pypyjit/test_pypy_c/test_instance.py::TestInstance::()::test_load_attr
self = <pypy.module.pypyjit.test_pypy_c.test_instance.TestInstance object at 0x000000000bfc2b80>
def test_load_attr(self):
src = '''
class A(object):
pass
a = A()
a.x = 1
def main(n):
i = 0
while i < n:
i = i + a.x
return i
'''
log = self.run(src, [1000])
assert log.result == 1000
loop, = log.loops_by_filename(self.filepath)
> assert loop.match("""
i9 = int_lt(i5, i6)
guard_true(i9, descr=...)
guard_not_invalidated(descr=...)
i10 = int_add(i5, 1)
--TICK--
jump(..., descr=...)
""")
pypy/module/pypyjit/test_pypy_c/test_instance.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 0x000000000df071d8>
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=<Guard0x7febb42d1880>)
i31 = int_lt(i26, i20)
guard_true(i31, descr=<Guard0x7febb05923d8>)
i33 = int_add(i26, 1)
i35 = getfield_raw_i(140650314271392, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i37 = int_lt(i35, 0)
guard_false(i37, descr=<Guard0x7febb0592448>)
jump(p0, p1, p8, i33, i20, descr=TargetToken(140650252665632))
Expected:
i9 = int_lt(i5, i6)
guard_true(i9, descr=...)
guard_not_invalidated(descr=...)
i10 = int_add(i5, 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-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_instance.py::TestInstance::()::test_load_attr