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

pypy/module/pypyjit/test_pypy_c/test_weakref.py::TestThread::()::test_make_ref_with_callback

self = <pypy.module.pypyjit.test_pypy_c.test_weakref.TestThread object at 0x000000000a0eabb8>

    def test_make_ref_with_callback(self):
        log = self.run("""
            import weakref
    
            class Dummy(object):
                pass
    
            def noop(obj):
                pass
    
            def main(n):
                obj = Dummy()
                for i in range(n):
                    weakref.ref(obj, noop)
            """, [500])
        loop, = log.loops_by_filename(self.filepath)
>       assert loop.match("""
            i58 = getfield_gc_i(p18, descr=<FieldS pypy.module.__builtin__.functional.W_IntRangeIterator.inst_current .>)
            i60 = int_lt(i58, i31)
            guard_true(i60, descr=...)
            i61 = int_add(i58, 1)
            dummy_get_utf8?
            setfield_gc(p18, i61, descr=<FieldS pypy.module.__builtin__.functional.W_IntRangeIterator.inst_current 8>)
            guard_not_invalidated(descr=...)
            dummy_get_utf8?
            dummy_get_utf8?
            p65 = getfield_gc_r(p14, descr=<FieldP .+inst_map \d+>)
            guard_value(p65, ConstPtr(ptr45), descr=...)
            p66 = getfield_gc_r(p14, descr=<FieldP .+inst__value0 \d+>)
            guard_nonnull(p66, descr=...)
            p67 = force_token()
            setfield_gc(p0, p67, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token \d+>)
            p68 = call_may_force_r(ConstClass(WeakrefLifeline.make_weakref_with_callback), p66, ConstPtr(ptr50), p14, ConstPtr(ptr51), descr=<Callr \d rrrr EF=7>)
            guard_not_forced(descr=...)
            guard_no_exception(descr=...)
            guard_nonnull_class(p68, ..., descr=...)
            guard_not_invalidated(descr=...)
            --TICK--
            jump(..., descr=...)
            """)

pypy/module/pypyjit/test_pypy_c/test_weakref.py:21: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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 0x000000000aa56918>
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=<Guard0x7f36ebd5a340>)
    i45 = getfield_gc_i(p14, descr=<FieldS pypy.module.__builtin__.functional.W_IntRangeIterator.inst_current 8>)
    i46 = int_lt(i45, i27)
    guard_true(i46, descr=<Guard0x7f36ebd667c8>)
    i48 = int_add(i45, 1)
    p49 = getfield_gc_r(p10, descr=<FieldP pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable.inst_map 48>)
    setfield_gc(p14, i48, descr=<FieldS pypy.module.__builtin__.functional.W_IntRangeIterator.inst_current 8>)
    guard_value(p49, ConstPtr(ptr50), descr=<Guard0x7f36ebd5a390>)
    p52 = getfield_gc_r(p10, descr=<FieldP pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable.inst__value0 8>)
    guard_nonnull(p52, descr=<Guard0x7f36ebd66838>)
    p53 = force_token()
    setfield_gc(p0, p53, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token 8>)
    p57 = call_may_force_r(ConstClass(WeakrefLifeline.make_weakref_with_callback), p52, ConstPtr(ptr55), p10, ConstPtr(ptr56), descr=<Callr 8 rrrr EF=7>)
    guard_not_forced(descr=<Guard0x7f36ebd466a8>)
    guard_no_exception(descr=<Guard0x7f36ebd66870>)
    guard_nonnull_class(p57, 139873843737000, descr=<Guard0x7f36ebd5a3e0>)
    guard_not_invalidated(descr=<Guard0x7f36ebd668a8>)
    i60 = getfield_raw_i(139873860520608, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i62 = int_lt(i60, 0)
    guard_false(i62, descr=<Guard0x7f36ebd66918>)
    jump(p0, p1, p8, p10, i45, p14, i27, descr=TargetToken(139873861627552))

Expected:
    
    i58 = getfield_gc_i(p18, descr=<FieldS pypy.module.__builtin__.functional.W_IntRangeIterator.inst_current .>)
    i60 = int_lt(i58, i31)
    guard_true(i60, descr=...)
    i61 = int_add(i58, 1)
    dummy_get_utf8?
    setfield_gc(p18, i61, descr=<FieldS pypy.module.__builtin__.functional.W_IntRangeIterator.inst_current 8>)
    guard_not_invalidated(descr=...)
    dummy_get_utf8?
    dummy_get_utf8?
    p65 = getfield_gc_r(p14, descr=<FieldP .+inst_map \d+>)
    guard_value(p65, ConstPtr(ptr45), descr=...)
    p66 = getfield_gc_r(p14, descr=<FieldP .+inst__value0 \d+>)
    guard_nonnull(p66, descr=...)
    p67 = force_token()
    setfield_gc(p0, p67, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token \d+>)
    p68 = call_may_force_r(ConstClass(WeakrefLifeline.make_weakref_with_callback), p66, ConstPtr(ptr50), p14, ConstPtr(ptr51), descr=<Callr \d rrrr EF=7>)
    guard_not_forced(descr=...)
    guard_no_exception(descr=...)
    guard_nonnull_class(p68, ..., descr=...)
    guard_not_invalidated(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_weakref.py::TestThread::()::test_make_ref_with_callback