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 0x0dcba4f0>
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 0x10684d90>
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:
i73 = int_lt(i68, i33)
guard_true(i73, descr=<Guard0xf4916470>)
guard_not_invalidated(descr=<Guard0xf4925470>)
i75 = int_eq(i68, -2147483648)
i77 = call_i(ConstClass(ll_int_py_mod__Signed_Signed), i68, i38, descr=<Calli 4 ii EF=0 OS=14>)
i78 = int_ge(i77, i45)
guard_false(i78, descr=<Guard0xf4916498>)
i79 = strgetitem(p44, i77)
p81 = newstr(1)
strsetitem(p81, 0, i79)
===== HERE =====
i86 = call_i(ConstClass(_check_utf8), p81, 0, 0, -1, descr=<Calli 4 riii EF=4>)
guard_no_exception(descr=<Guard0xf49164c0>)
i89 = int_ge(i86, 0)
guard_true(i89, descr=<Guard0xf49254c4>)
i90 = int_ge(i77, i38)
guard_false(i90, descr=<Guard0xf49254fc>)
i92 = int_add(i77, 1)
i93 = int_gt(i92, i59)
guard_false(i93, descr=<Guard0xf4925534>)
i95 = call_i(ConstClass(_ll_4_str_eq_slice_char__rpy_stringPtr_Signed_Signed_Char), p58, i77, 1, i79, descr=<Calli 4 riii EF=0 OS=27>)
guard_true(i95, descr=<Guard0xf49164e8>)
i97 = int_add(i68, 1)
i99 = getfield_raw_i(-135486720, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i101 = int_lt(i99, 0)
guard_false(i101, descr=<Guard0xf4925588>)
jump(p0, p1, p8, i97, p12, p14, p81, i33, i38, i45, p44, i59, p58, descr=TargetToken(-191866284))
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 #8502+
test: pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_lookup_default_encoding