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_unicode_indexing_small_constant_indices

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

    def test_unicode_indexing_small_constant_indices(self):
        log = self.run("""
            l = [u"abä", u"cdä", u"äü", u"éé", u"–—¿"] * 1000
            def main(n):
                global s
                for u in l:
                    s = u[0] + u[1] + u[-1] # ID: index
                    len(u)
                return len(s)
            """, [1000])
        loop, = log.loops_by_filename(self.filepath)
>       assert loop.match_by_id('index', '''
                i77 = getfield_gc_i(p73, descr=<FieldS pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__length .*>)
                p78 = getfield_gc_r(p73, descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .* pure>)
                i79 = strlen(p78)
                i80 = int_eq(i77, i79)
                guard_false(i80, descr=...) # check not ascii
                i82 = int_ge(0, i77)
                guard_false(i82, descr=...)
                i85 = call_i(ConstClass(next_codepoint_pos_dont_look_inside), p78, 0, descr=...)
                i86 = int_gt(i85, i79)
                guard_false(i86, descr=...)
                i88 = int_ge(1, i77)
                guard_false(i88, descr=...)
                i90 = call_i(ConstClass(next_codepoint_pos_dont_look_inside), p78, i85, descr=...)
                i91 = int_gt(i90, i79)
                guard_false(i91, descr=...)
                i92 = int_sub(i90, i85)
                i94 = int_add(-1, i77)
                i96 = call_i(ConstClass(prev_codepoint_pos_dont_look_inside), p78, i79, descr=...)
                i97 = int_sub(i79, i96)
                guard_not_invalidated(descr=...)
            ''')

pypy/module/pypyjit/test_pypy_c/test_string.py:320: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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:408: in match_op
    self._assert(op != '--end--', 'got less ops than expected')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0x000000000d332e20>
cond = False, message = 'got less ops than expected'

    def _assert(self, cond, message):
        if not cond:
>           raise InvalidMatch(message, frame=sys._getframe(1))
E           InvalidMatch: got less ops than expected

pypy/module/pypyjit/test_pypy_c/model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = 'index'
('got less ops than expected',)
<could not determine information>

Ignore ops: []
Got:
    i72 = getfield_gc_i(p68, descr=<FieldS pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__length 16 pure>)
    p73 = getfield_gc_r(p68, descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 24 pure>)
    i74 = strlen(p73)
    i75 = int_eq(i72, i74)
    guard_false(i75, descr=<Guard0x7f15c0e7f2b8>)
    i77 = int_ge(0, i72)
    guard_false(i77, descr=<Guard0x7f15c0e7f328>)
    i80 = call_i(ConstClass(next_codepoint_pos_dont_look_inside), p73, 0, descr=<Calli 8 ri EF=0>)
    i81 = int_gt(i80, i74)
    guard_false(i81, descr=<Guard0x7f15c10c39c0>)
    i83 = int_ge(1, i72)
    guard_false(i83, descr=<Guard0x7f15c0e7f3d0>)
    i85 = call_i(ConstClass(next_codepoint_pos_dont_look_inside), p73, i80, descr=<Calli 8 ri EF=0>)
    i86 = int_gt(i85, i74)
    guard_false(i86, descr=<Guard0x7f15c10c3a10>)
    i87 = int_sub(i85, i80)
    i89 = int_add(-1, i72)
    i91 = call_i(ConstClass(prev_codepoint_pos_dont_look_inside), p73, i74, descr=<Calli 8 ri EF=0>)
    i92 = int_sub(i74, i91)
	===== HERE =====


Expected:
    
    i77 = getfield_gc_i(p73, descr=<FieldS pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__length .*>)
    p78 = getfield_gc_r(p73, descr=<FieldP pypy.objspace.std.unicodeobject.W_UnicodeObject.inst__utf8 .* pure>)
    i79 = strlen(p78)
    i80 = int_eq(i77, i79)
    guard_false(i80, descr=...) # check not ascii
    i82 = int_ge(0, i77)
    guard_false(i82, descr=...)
    i85 = call_i(ConstClass(next_codepoint_pos_dont_look_inside), p78, 0, descr=...)
    i86 = int_gt(i85, i79)
    guard_false(i86, descr=...)
    i88 = int_ge(1, i77)
    guard_false(i88, descr=...)
    i90 = call_i(ConstClass(next_codepoint_pos_dont_look_inside), p78, i85, descr=...)
    i91 = int_gt(i90, i79)
    guard_false(i91, descr=...)
    i92 = int_sub(i90, i85)
    i94 = int_add(-1, i77)
    i96 = call_i(ConstClass(prev_codepoint_pos_dont_look_inside), p78, i79, descr=...)
    i97 = int_sub(i79, i96)
    guard_not_invalidated(descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_unicode_indexing_small_constant_indices