Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/pypyjit/test_pypy_c/test_misc.py::TestMisc::()::test_cached_pure_func_of_equal_fields

self = <pypy.module.pypyjit.test_pypy_c.test_misc.TestMisc object at 0x0000000005e41248>

    def test_cached_pure_func_of_equal_fields(self):
        def main(n):
            class A(object):
                def __init__(self, val):
                    self.val1 = self.val2 = val
            A("x") # prevent field unboxing
            a = A(1)
            b = A(1)
            sa = 0
            while n:
                sa += 2*a.val1
                sa += 2*b.val2
                b.val2 = a.val1
                n -= 1
            return sa
        #
        log = self.run(main, [1000])
        assert log.result == 4000
        loop, = log.loops_by_filename(self.filepath)
>       assert loop.match("""
                i12 = int_is_true(i4)
                guard_true(i12, descr=...)
                guard_not_invalidated(descr=...)
                guard_nonnull_class(p10, ConstClass(W_IntObject), descr=...)
                i10p = getfield_gc_i(p10, descr=...)
                i10 = int_mul_ovf(2, i10p)
                guard_no_overflow(descr=...)
                i14 = int_add_ovf(i13, i10)
                guard_no_overflow(descr=...)
                i13 = int_add_ovf(i14, i9)
                guard_no_overflow(descr=...)
                setfield_gc(p17, p10, descr=...)
                i17 = int_sub_ovf(i4, 1)
                guard_no_overflow(descr=...)
                --TICK--
                jump(..., descr=...)
                """)

pypy/module/pypyjit/test_pypy_c/test_misc.py:113: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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 0x000000000e97dc58>
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=<Guard0x7f607f713a60>)
    i57 = int_is_true(i51)
    guard_true(i57, descr=<Guard0x7f607f592950>)
    guard_nonnull_class(p56, ConstClass(W_IntObject), descr=<Guard0x7f607f713ab0>)
    i59 = getfield_gc_i(p56, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval 8 pure>)
    i61 = int_mul_ovf(2, i59)
    guard_no_overflow(descr=<Guard0x7f607f592988>)
    i62 = int_add_ovf(i49, i61)
    guard_no_overflow(descr=<Guard0x7f607f5929c0>)
    i63 = int_add_ovf(i62, i38)
    guard_no_overflow(descr=<Guard0x7f607f5929f8>)
    setfield_gc(p14, p56, descr=<FieldP pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable.inst__value1 16>)
    i65 = int_sub_ovf(i51, 1)
    guard_no_overflow(descr=<Guard0x7f607f713b00>)
    i68 = getfield_raw_i(140052428819104, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i70 = int_lt(i68, 0)
    guard_false(i70, descr=<Guard0x7f607f592a68>)
    jump(p0, p1, i65, p10, p12, p14, i63, p24, p56, p56, i61, descr=TargetToken(140052430129952))

Expected:
    
    i12 = int_is_true(i4)
    guard_true(i12, descr=...)
    guard_not_invalidated(descr=...)
    guard_nonnull_class(p10, ConstClass(W_IntObject), descr=...)
    i10p = getfield_gc_i(p10, descr=...)
    i10 = int_mul_ovf(2, i10p)
    guard_no_overflow(descr=...)
    i14 = int_add_ovf(i13, i10)
    guard_no_overflow(descr=...)
    i13 = int_add_ovf(i14, i9)
    guard_no_overflow(descr=...)
    setfield_gc(p17, p10, descr=...)
    i17 = int_sub_ovf(i4, 1)
    guard_no_overflow(descr=...)
    
    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_misc.py::TestMisc::()::test_cached_pure_func_of_equal_fields