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

pypy/module/pypyjit/test_pypy_c/test_capture_locals.py::TestCaptureLocals::()::test_capture_locals

self = <pypy.module.pypyjit.test_pypy_c.test_capture_locals.TestCaptureLocals object at 0xf38d5bac>

    def test_capture_locals(self):
        def main(n):
            num = 42
            i = 0
            acc = 0
            src = '''
    while i < n:
        acc += num
        i += 1
    '''
            exec(src)
            return acc
    
        log = self.run(main, [500])
        print (log.result)
        assert log.result == 0
        loop, = log.loops_by_filename("<string>")
        assert loop.match("""
                guard_not_invalidated(descr=...)
                i48 = int_lt(i41, i33)
                guard_true(i48, descr=...)
                i49 = int_add_ovf(i39, i38)
                guard_no_overflow(descr=...)
                i51 = int_add(i41, 1)
                i53 = getfield_raw_i(..., descr=...)
                setarrayitem_gc(p27, 3, i49, descr=...)
                setarrayitem_gc(p27, 2, i51, descr=...)
                i57 = int_lt(i53, 0)
                guard_false(i57, descr=...)
                i59 = arraylen_gc(p25, descr=...)
                i60 = arraylen_gc(p27, descr=...)
                jump(..., descr=...)
>           """)

pypy/module/pypyjit/test_pypy_c/test_capture_locals.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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 0xf38e0a2c>
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 ----------
0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = None
('operation mismatch',)
<could not determine information>

Ignore ops: []
Got:

	===== HERE =====
    i55 = getfield_gc_i(p51, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval 8 pure>)
    i56 = int_lt(i55, i34)
    guard_true(i56, descr=<Guard0xf4b439e8>)
    i57 = getfield_gc_i(p53, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval 8 pure>)
    i58 = int_add_ovf(i57, i43)
    guard_no_overflow(descr=<Guard0xf4ae7ef0>)
    guard_not_invalidated(descr=<Guard0xf4ae7f0c>)
    i60 = int_add(i55, 1)
    i62 = getfield_raw_i(-134697856, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i64 = int_lt(i62, 0)
    guard_false(i64, descr=<Guard0xf4ae7f44>)
    i65 = arraylen_gc(p24, descr=<ArrayP 4>)
    p66 = new_with_vtable(descr=<SizeDescr 12>)
    setfield_gc(p66, i60, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval 8 pure>)
    p67 = new_with_vtable(descr=<SizeDescr 12>)
    setfield_gc(p67, i58, descr=<FieldS pypy.objspace.std.intobject.W_IntObject.inst_intval 8 pure>)
    setarrayitem_gc(p24, 3, p66, descr=<ArrayP 4>)
    setarrayitem_gc(p24, 4, p67, descr=<ArrayP 4>)
    jump(p0, p1, p5, p13, p20, p24, p66, p31, i34, p67, p40, i43, descr=TargetToken(-189653580))

Expected:
    
    guard_not_invalidated(descr=...)
    i48 = int_lt(i41, i33)
    guard_true(i48, descr=...)
    i49 = int_add_ovf(i39, i38)
    guard_no_overflow(descr=...)
    i51 = int_add(i41, 1)
    i53 = getfield_raw_i(..., descr=...)
    setarrayitem_gc(p27, 3, i49, descr=...)
    setarrayitem_gc(p27, 2, i51, descr=...)
    i57 = int_lt(i53, 0)
    guard_false(i57, descr=...)
    i59 = arraylen_gc(p25, descr=...)
    i60 = arraylen_gc(p27, descr=...)
    jump(..., descr=...)
builder: pypy-c-jit-linux-x86-32 build #8370+
test: pypy/module/pypyjit/test_pypy_c/test_capture_locals.py::TestCaptureLocals::()::test_capture_locals