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

pypy/module/pypyjit/test_pypy_c/test_instance.py::TestInstance::()::test_float_instance_field_write

self = <pypy.module.pypyjit.test_pypy_c.test_instance.TestInstance object at 0x0000000010705718>

    def test_float_instance_field_write(self):
        def main():
            class A(object):
                def __init__(self, x):
                    self.x = float(x)
    
            l = [A(i) for i in range(2000)]
    
            for a in l:
                a.x += 3.4 # ID: set
        log = self.run(main, [])
        listcomp, loop, = log.loops_by_filename(self.filepath)
        if sys.maxint == 2**63 - 1:
>           loop.match_by_id('set', """
                p60 = getfield_gc_r(p56, descr=...) # map
                guard_value(p60, ConstPtr(ptr61), descr=...)
                guard_not_invalidated(descr=...)
                p62 = getfield_gc_r(p56, descr=...) # value
                i64 = getarrayitem_gc_i(p62, 0, descr=...) # x
                f64 = convert_longlong_bytes_to_float(i64)
                f66 = float_add(f64, 3.400000)
                i66 = convert_float_bytes_to_longlong(f66)
                i68 = getfield_raw_i(..., descr=...)
                setarrayitem_gc(p62, 0, i66, descr=...) # store x
                i71 = int_lt(i68, 0)
                guard_false(i71, descr=...)
    """)

pypy/module/pypyjit/test_pypy_c/test_instance.py:348: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pypy/module/pypyjit/test_pypy_c/model.py:182: in match_by_id
    return matcher.match(expected_src, ignore_ops=ignore_ops)
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 0x000000000fb57788>
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 = 'set'
('operation mismatch',)
<could not determine information>

Ignore ops: []
Got:
    p55 = getfield_gc_r(p51, descr=<FieldP pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable.inst_map 48>)
    guard_value(p55, ConstPtr(ptr56), descr=<Guard0x7f244c1a1ef8>)

	===== HERE =====
    p57 = getfield_gc_r(p51, descr=<FieldP pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable.inst__value0 8>)
    i59 = getarrayitem_gc_i(p57, 0, descr=<ArrayS 8>)
    f60 = convert_longlong_bytes_to_float(i59)
    f62 = float_add(f60, 3.400000)
    i63 = convert_float_bytes_to_longlong(f62)
    i65 = getfield_raw_i(139793933863584, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    setarrayitem_gc(p57, 0, i63, descr=<ArrayS 8>)
    i68 = int_lt(i65, 0)
    guard_false(i68, descr=<Guard0x7f244c1aa6b0>)

Expected:
    
    p60 = getfield_gc_r(p56, descr=...) # map
    guard_value(p60, ConstPtr(ptr61), descr=...)
    guard_not_invalidated(descr=...)
    p62 = getfield_gc_r(p56, descr=...) # value
    i64 = getarrayitem_gc_i(p62, 0, descr=...) # x
    f64 = convert_longlong_bytes_to_float(i64)
    f66 = float_add(f64, 3.400000)
    i66 = convert_float_bytes_to_longlong(f66)
    i68 = getfield_raw_i(..., descr=...)
    setarrayitem_gc(p62, 0, i66, descr=...) # store x
    i71 = int_lt(i68, 0)
    guard_false(i71, descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_instance.py::TestInstance::()::test_float_instance_field_write