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

pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_python3_missing_bchr

self = <pypy.module.pypyjit.test_pypy_c.test_string.TestString object at 0x000000000adef520>

    def test_python3_missing_bchr(self):
        # Check that 'bytes([i])' is special-cased into something
        # efficient, as Python 3.5 doesn't have a bchr() function or
        # anything more direct.
        def main(n):
            i = 0
            result = b''
            while i < n:
                c = bytes([i])
                result += c
                i += 1
            return i
        log = self.run(main, [255])
        assert log.result == 255
        loop, = log.loops_by_filename(self.filepath)
>       assert loop.match("""
                # nothing left like allocating a list object or doing any
                # residual call
                i49 = int_lt(i38, i26)
                guard_true(i49, descr=...)
                guard_not_invalidated(descr=...)
                i51 = int_lt(i38, 256)
                guard_true(i51, descr=...)
                i53 = int_add(i38, 1)
                --TICK--
                i58 = strlen(p46)
                i60 = int_add(i58, 1)
                p61 = newstr(i60)
                copystrcontent(p46, p61, 0, 0, i58)
                strsetitem(p61, i58, i38)
                p62 = newstr(1)
                strsetitem(p62, 0, i38)
                jump(..., descr=...)
            """)

pypy/module/pypyjit/test_pypy_c/test_string.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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 0x0000000008b2c608>
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=<Guard0x7ff9bb8d1ab0>)
    i44 = int_lt(i33, i24)
    guard_true(i44, descr=<Guard0x7ff9b7b91558>)
    i46 = int_lt(i33, 256)
    guard_true(i46, descr=<Guard0x7ff9b7b915c8>)
    i48 = int_add(i33, 1)
    i50 = getfield_raw_i(140710567545504, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i52 = int_lt(i50, 0)
    guard_false(i52, descr=<Guard0x7ff9b7b91a60>)
    i53 = strlen(p41)
    i55 = int_add(i53, 1)
    p56 = newstr(i55)
    copystrcontent(p41, p56, 0, 0, i53)
    strsetitem(p56, i53, i33)
    p57 = newstr(1)
    strsetitem(p57, 0, i33)
    jump(p0, p1, p8, i48, p56, p57, i24, descr=TargetToken(140710505949088))

Expected:
    
    # nothing left like allocating a list object or doing any
    # residual call
    i49 = int_lt(i38, i26)
    guard_true(i49, descr=...)
    guard_not_invalidated(descr=...)
    i51 = int_lt(i38, 256)
    guard_true(i51, descr=...)
    i53 = int_add(i38, 1)
    
    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=...)
    
    i58 = strlen(p46)
    i60 = int_add(i58, 1)
    p61 = newstr(i60)
    copystrcontent(p46, p61, 0, 0, i58)
    strsetitem(p61, i58, i38)
    p62 = newstr(1)
    strsetitem(p62, 0, i38)
    jump(..., descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_python3_missing_bchr