pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_str_mod
self = <pypy.module.pypyjit.test_pypy_c.test_string.TestString object at 0x11383f50>
def test_str_mod(self):
def main(n):
s = 0
while n > 0:
s += len('%d %d' % (n, n))
n -= 1
return s
log = self.run(main, [1000])
assert log.result == main(1000)
loop, = log.loops_by_filename(self.filepath)
> assert loop.match("""
i79 = int_gt(i74, 0)
guard_true(i79, descr=...)
guard_not_invalidated(descr=...)
p80 = call_r(ConstClass(ll_int2dec__Signed), i74, descr=<Callr . i EF=3>)
guard_no_exception(descr=...)
i85 = strlen(p80)
p86 = new(descr=<SizeDescr .+>)
p88 = newstr(23)
{{{
setfield_gc(p86, 0, descr=<FieldS stringbuilder.current_pos .+>)
setfield_gc(p86, p88, descr=<FieldP stringbuilder.current_buf .+>)
setfield_gc(p86, 23, descr=<FieldS stringbuilder.current_end .+>)
setfield_gc(p86, 23, descr=<FieldS stringbuilder.total_size .+>)
}}}
call_n(ConstClass(ll_append_res0__stringbuilderPtr_rpy_stringPtr), p86, p80, descr=<Callv 0 rr EF=5>)
guard_no_exception(descr=...)
i89 = getfield_gc_i(p86, descr=<FieldS stringbuilder.current_pos .+>)
i90 = getfield_gc_i(p86, descr=<FieldS stringbuilder.current_end .+>)
i91 = int_eq(i89, i90)
cond_call(i91, ConstClass(ll_grow_by__stringbuilderPtr_Signed), p86, 1, descr=<Callv 0 ri EF=5>)
guard_no_exception(descr=...)
i92 = getfield_gc_i(p86, descr=<FieldS stringbuilder.current_pos .+>)
i93 = int_add(i92, 1)
p94 = getfield_gc_r(p86, descr=<FieldP stringbuilder.current_buf .+>)
strsetitem(p94, i92, 32)
setfield_gc(p86, i93, descr=<FieldS stringbuilder.current_pos .+>)
call_n(ConstClass(ll_append_res0__stringbuilderPtr_rpy_stringPtr), p86, p80, descr=<Callv 0 rr EF=5>)
guard_no_exception(descr=...)
p95 = call_r(..., descr=<Callr . r EF=5>) # ll_build
guard_no_exception(descr=...)
i96 = call_i(ConstClass(codepoints_in_utf8), p95, 0, _, descr=<Calli . rii EF=4>)
guard_no_exception(descr=...)
i969 = int_lt(i96, 0)
guard_false(i969, descr=...)
i97 = int_add_ovf(i71, i96)
guard_no_overflow(descr=...)
i98 = int_add(i74, -1)
--TICK--
jump(..., descr=...)
""")
pypy/module/pypyjit/test_pypy_c/test_string.py:140:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 0x11902250>
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=<Guard0xf4890d08>)
i65 = int_gt(i59, 0)
guard_true(i65, descr=<Guard0xf483e278>)
p67 = call_r(ConstClass(ll_int2dec__Signed), i59, descr=<Callr 4 i EF=3>)
guard_no_exception(descr=<Guard0xf4890d30>)
i68 = strlen(p67)
p69 = new(descr=<SizeDescr 24>)
p71 = newstr(23)
setfield_gc(p69, p71, descr=<FieldP stringbuilder.current_buf 4>)
setfield_gc(p69, 0, descr=<FieldS stringbuilder.current_pos 8>)
setfield_gc(p69, 23, descr=<FieldS stringbuilder.current_end 12>)
setfield_gc(p69, 23, descr=<FieldS stringbuilder.total_size 16>)
call_n(ConstClass(ll_append_res0__stringbuilderPtr_rpy_stringPtr), p69, p67, descr=<Callv 0 rr EF=5>)
guard_no_exception(descr=<Guard0xf4890d58>)
i75 = getfield_gc_i(p69, descr=<FieldS stringbuilder.current_pos 8>)
i76 = getfield_gc_i(p69, descr=<FieldS stringbuilder.current_end 12>)
i77 = int_eq(i75, i76)
cond_call(i77, ConstClass(ll_grow_by__stringbuilderPtr_Signed), p69, 1, descr=<Callv 0 ri EF=5>)
guard_no_exception(descr=<Guard0xf4890d80>)
i80 = getfield_gc_i(p69, descr=<FieldS stringbuilder.current_pos 8>)
i82 = int_add(i80, 1)
p83 = getfield_gc_r(p69, descr=<FieldP stringbuilder.current_buf 4>)
strsetitem(p83, i80, 32)
setfield_gc(p69, i82, descr=<FieldS stringbuilder.current_pos 8>)
call_n(ConstClass(ll_append_res0__stringbuilderPtr_rpy_stringPtr), p69, p67, descr=<Callv 0 rr EF=5>)
guard_no_exception(descr=<Guard0xf4890da8>)
p87 = call_r(ConstClass(ll_build_trampoline__v1871___simple_call__function_), p69, descr=<Callr 4 r EF=5>)
guard_no_exception(descr=<Guard0xf4890dd0>)
i91 = call_i(ConstClass(codepoints_in_utf8), p87, 0, 2147483647, descr=<Calli 4 rii EF=4>)
guard_no_exception(descr=<Guard0xf4890df8>)
i93 = int_lt(i91, 0)
guard_false(i93, descr=<Guard0xf483e2b0>)
i94 = int_add_ovf(i57, i91)
guard_no_overflow(descr=<Guard0xf483e2cc>)
i96 = int_add(i59, -1)
i98 = getfield_raw_i(-135156608, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i100 = int_lt(i98, 0)
guard_false(i100, descr=<Guard0xf483e304>)
jump(p0, p1, i96, i94, descr=TargetToken(-191910728))
Expected:
i79 = int_gt(i74, 0)
guard_true(i79, descr=...)
guard_not_invalidated(descr=...)
p80 = call_r(ConstClass(ll_int2dec__Signed), i74, descr=<Callr . i EF=3>)
guard_no_exception(descr=...)
i85 = strlen(p80)
p86 = new(descr=<SizeDescr .+>)
p88 = newstr(23)
{{{
setfield_gc(p86, 0, descr=<FieldS stringbuilder.current_pos .+>)
setfield_gc(p86, p88, descr=<FieldP stringbuilder.current_buf .+>)
setfield_gc(p86, 23, descr=<FieldS stringbuilder.current_end .+>)
setfield_gc(p86, 23, descr=<FieldS stringbuilder.total_size .+>)
}}}
call_n(ConstClass(ll_append_res0__stringbuilderPtr_rpy_stringPtr), p86, p80, descr=<Callv 0 rr EF=5>)
guard_no_exception(descr=...)
i89 = getfield_gc_i(p86, descr=<FieldS stringbuilder.current_pos .+>)
i90 = getfield_gc_i(p86, descr=<FieldS stringbuilder.current_end .+>)
i91 = int_eq(i89, i90)
cond_call(i91, ConstClass(ll_grow_by__stringbuilderPtr_Signed), p86, 1, descr=<Callv 0 ri EF=5>)
guard_no_exception(descr=...)
i92 = getfield_gc_i(p86, descr=<FieldS stringbuilder.current_pos .+>)
i93 = int_add(i92, 1)
p94 = getfield_gc_r(p86, descr=<FieldP stringbuilder.current_buf .+>)
strsetitem(p94, i92, 32)
setfield_gc(p86, i93, descr=<FieldS stringbuilder.current_pos .+>)
call_n(ConstClass(ll_append_res0__stringbuilderPtr_rpy_stringPtr), p86, p80, descr=<Callv 0 rr EF=5>)
guard_no_exception(descr=...)
p95 = call_r(..., descr=<Callr . r EF=5>) # ll_build
guard_no_exception(descr=...)
i96 = call_i(ConstClass(codepoints_in_utf8), p95, 0, _, descr=<Calli . rii EF=4>)
guard_no_exception(descr=...)
i969 = int_lt(i96, 0)
guard_false(i969, descr=...)
i97 = int_add_ovf(i71, i96)
guard_no_overflow(descr=...)
i98 = int_add(i74, -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 #8482+
test: pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_str_mod