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

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

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

    def test_lookup_default_encoding(self):
        def main(n):
            i = 0
            letters = b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
            uletters = u'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
            while i < n:
                c = bytes([letters[i % len(uletters)]])
                i += (c.decode() == uletters[i % len(uletters)])
            return i
    
        log = self.run(main, [300], import_site=True)
        assert log.result == 300
        loop, = log.loops_by_filename(self.filepath)
        assert loop.match("""
                i88 = int_lt(i83, i36)
                guard_true(i88, descr=...)
                guard_not_invalidated(descr=...)
                i92 = int_eq(i83, %d)
                i94 = call_i(ConstClass(ll_int_py_mod__Signed_Signed), i83, i46, descr=<Calli . ii EF=0 OS=14>)
                i97 = int_ge(i94, i53)
                guard_false(i97, descr=...)
                i98 = strgetitem(p52, i94)
                p103 = newstr(1)
                strsetitem(p103, 0, i98)
                i95 = call_i(ConstClass(_check_utf8), p103, 0, 0, -1, descr=<Calli 8 riii EF=4>)
                guard_no_exception(descr=...)
                i98 = int_ge(i95, 0)
                guard_true(i98, descr=...)
                i99 = int_ge(i94, i46)
                guard_false(i99, descr=...)
                i115 = int_add(i94, 1)
                i116 = int_gt(i115, i71)
                guard_false(i116, descr=...)
    
                i104 = call_i(ConstClass(_ll_4_str_eq_slice_char__rpy_stringPtr_Signed_Signed_Char), p65, i94, 1, i98, descr=<Calli 8 riii EF=0 OS=27>)
                guard_true(i104, descr=...)
                i124 = int_add(i83, 1)
                --TICK--
                jump(..., descr=...)
>           """ % (-sys.maxint-1,))

pypy/module/pypyjit/test_pypy_c/test_string.py:85: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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:418: in match_op
    self.match_descr(op.descr, exp_descr)
pypy/module/pypyjit/test_pypy_c/model.py:398: in match_descr
    self._assert(exp_descr is not None and re.match(exp_descr, descr), "descr mismatch")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0xf2926e2c>
cond = None, message = 'descr mismatch'

    def _assert(self, cond, message):
        if not cond:
>           raise InvalidMatch(message, frame=sys._getframe(1))
E           InvalidMatch: descr mismatch

pypy/module/pypyjit/test_pypy_c/model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = None
('descr mismatch',)
<could not determine information>

Ignore ops: []
Got:
    i75 = int_lt(i70, i33)
    guard_true(i75, descr=<Guard0xf4a5e420>)
    guard_not_invalidated(descr=<Guard0xf4a6d4c4>)
    i77 = int_eq(i70, -2147483648)
    i79 = call_i(ConstClass(ll_int_py_mod__Signed_Signed), i70, i38, descr=<Calli 4 ii EF=0 OS=14>)
    i80 = int_ge(i79, i47)
    guard_false(i80, descr=<Guard0xf4a5e448>)
    i81 = strgetitem(p46, i79)
    p83 = newstr(1)
    strsetitem(p83, 0, i81)

	===== HERE =====
    i88 = call_i(ConstClass(_check_utf8), p83, 0, 0, -1, descr=<Calli 4 riii EF=4>)
    guard_no_exception(descr=<Guard0xf4a5e470>)
    i91 = int_ge(i88, 0)
    guard_true(i91, descr=<Guard0xf4a6d518>)
    i92 = int_ge(i79, i38)
    guard_false(i92, descr=<Guard0xf4a6d550>)
    i94 = int_add(i79, 1)
    i95 = int_gt(i94, i61)
    guard_false(i95, descr=<Guard0xf4a6d588>)
    i97 = call_i(ConstClass(_ll_4_str_eq_slice_char__rpy_stringPtr_Signed_Signed_Char), p60, i79, 1, i81, descr=<Calli 4 riii EF=0 OS=27>)
    guard_true(i97, descr=<Guard0xf4a5e498>)
    i99 = int_add(i70, 1)
    i101 = getfield_raw_i(-135431648, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i103 = int_lt(i101, 0)
    guard_false(i103, descr=<Guard0xf4a6d5dc>)
    jump(p0, p1, p8, i99, p12, p14, p83, i33, i38, i47, p46, i61, p60, descr=TargetToken(-190518664))

Expected:
    
    i88 = int_lt(i83, i36)
    guard_true(i88, descr=...)
    guard_not_invalidated(descr=...)
    i92 = int_eq(i83, -2147483648)
    i94 = call_i(ConstClass(ll_int_py_mod__Signed_Signed), i83, i46, descr=<Calli . ii EF=0 OS=14>)
    i97 = int_ge(i94, i53)
    guard_false(i97, descr=...)
    i98 = strgetitem(p52, i94)
    p103 = newstr(1)
    strsetitem(p103, 0, i98)
    i95 = call_i(ConstClass(_check_utf8), p103, 0, 0, -1, descr=<Calli 8 riii EF=4>)
    guard_no_exception(descr=...)
    i98 = int_ge(i95, 0)
    guard_true(i98, descr=...)
    i99 = int_ge(i94, i46)
    guard_false(i99, descr=...)
    i115 = int_add(i94, 1)
    i116 = int_gt(i115, i71)
    guard_false(i116, descr=...)
    
    i104 = call_i(ConstClass(_ll_4_str_eq_slice_char__rpy_stringPtr_Signed_Signed_Char), p65, i94, 1, i98, descr=<Calli 8 riii EF=0 OS=27>)
    guard_true(i104, descr=...)
    i124 = int_add(i83, 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=...)
    
    jump(..., descr=...)
builder: pypy-c-jit-linux-x86-32 build #8379+
test: pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_lookup_default_encoding