pypy/module/pypyjit/test_pypy_c/test_call.py::TestCall::()::test_global_closure_has_constant_cells
self = <pypy.module.pypyjit.test_pypy_c.test_call.TestCall object at 0x000000000cb26170>
def test_global_closure_has_constant_cells(self):
log = self.run("""
def make_adder(n):
def add(x):
return x + n
return add
add5 = make_adder(5)
def main():
i = 0
while i < 5000:
i = add5(i) # ID: call
""", [])
loop, = log.loops_by_id('call', is_entry_bridge=True)
> assert loop.match("""
guard_value(i4, 1, descr=...)
guard_isnull(p5, descr=...)
guard_nonnull_class(p12, ConstClass(W_IntObject), descr=...)
guard_value(p2, ConstPtr(ptr21), descr=...)
i22 = getfield_gc_i(p12, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval .*>)
i24 = int_lt(i22, 5000)
guard_true(i24, descr=...)
dummy_get_utf8?
guard_not_invalidated(descr=...)
p29 = call_r(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=<Callr . i EF=1 OS=5>)
p30 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref .*>)
p31 = force_token()
p32 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc .*>)
guard_value(p32, ConstPtr(ptr33), descr=...)
i34 = getfield_gc_i(p29, descr=<FieldU pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc .*>)
i35 = int_is_zero(i34)
guard_true(i35, descr=...)
i40 = int_add(i22, 5)
--TICK--
""")
pypy/module/pypyjit/test_pypy_c/test_call.py:436:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 0x000000000df99750>
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:
guard_value(i4, 1, descr=<Guard0x7fca99fe37e0>)
===== HERE =====
guard_value(p3, ConstPtr(ptr14), descr=<Guard0x7fca99f12790>)
guard_not_invalidated(descr=<Guard0x7fca99f127c8>)
guard_isnull(p5, descr=<Guard0x7fca99f12838>)
guard_nonnull_class(p8, ConstClass(W_IntObject), descr=<Guard0x7fca99fe3830>)
i16 = getfield_gc_i(p8, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval 8 pure>)
i18 = int_lt(i16, 5000)
guard_true(i18, descr=<Guard0x7fca99f128a8>)
p21 = call_r(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), 64, descr=<Callr 8 i EF=1 OS=5>)
p22 = getfield_gc_r(p21, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref 136>)
p23 = force_token()
p24 = getfield_gc_r(p21, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc 176 pure>)
guard_value(p24, ConstPtr(null), descr=<Guard0x7fca99fe3880>)
i26 = getfield_gc_i(p21, descr=<FieldU pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc 186 pure>)
i27 = int_is_zero(i26)
guard_true(i27, descr=<Guard0x7fca99f12918>)
i31 = int_add(i16, 5)
i34 = getfield_raw_i(140508204960416, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i36 = int_lt(i34, 0)
guard_false(i36, descr=<Guard0x7fca99f12988>)
Expected:
guard_value(i4, 1, descr=...)
guard_isnull(p5, descr=...)
guard_nonnull_class(p12, ConstClass(W_IntObject), descr=...)
guard_value(p2, ConstPtr(ptr21), descr=...)
i22 = getfield_gc_i(p12, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval .*>)
i24 = int_lt(i22, 5000)
guard_true(i24, descr=...)
dummy_get_utf8?
guard_not_invalidated(descr=...)
p29 = call_r(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=<Callr . i EF=1 OS=5>)
p30 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref .*>)
p31 = force_token()
p32 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc .*>)
guard_value(p32, ConstPtr(ptr33), descr=...)
i34 = getfield_gc_i(p29, descr=<FieldU pypy.interpreter.executioncontext.ExecutionContext.inst_profilefunc .*>)
i35 = int_is_zero(i34)
guard_true(i35, descr=...)
i40 = int_add(i22, 5)
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=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_call.py::TestCall::()::test_global_closure_has_constant_cells