jit/metainterp/test/test_warmspot.py::TestLLWarmspot::()::test_loop_automatic_reds
self = <rpython.jit.metainterp.test.test_warmspot.TestLLWarmspot instance at 0xf51ee4ac>
def test_loop_automatic_reds(self):
myjitdriver = JitDriver(greens = ['m'], reds = 'auto')
def f(n, m):
res = 0
# try to have lots of red vars, so that if there is an error in
# the ordering of reds, there are low chances that the test passes
# by chance
a = b = c = d = n
while n > 0:
myjitdriver.jit_merge_point(m=m)
n -= 1
a += 1 # dummy unused red
b += 2 # dummy unused red
c += 3 # dummy unused red
d += 4 # dummy unused red
res += m*2
return res
expected = f(21, 5)
res = self.meta_interp(f, [21, 5])
assert res == expected
> self.check_resops(int_sub=2, int_mul=0, int_add=10)
jit/metainterp/test/test_warmspot.py:337:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jit/metainterp/test/support.py:199: in check_resops
get_stats().check_resops(expected=expected, **check)
jit/metainterp/history.py:969: in check_resops
return self._check_insns(insns, expected, check)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.jit.metainterp.history.Stats object at 0xf522bc8c>
insns = {'debug_merge_point': 4, 'guard_true': 2, 'int_add': 12, 'int_gt': 2, ...}
expected = None, check = {'int_add': 10, 'int_mul': 0, 'int_sub': 2}
def _check_insns(self, insns, expected, check):
if expected is not None:
insns.pop('debug_merge_point', None)
insns.pop('enter_portal_frame', None)
insns.pop('leave_portal_frame', None)
insns.pop('label', None)
assert insns == expected
for insn, expected_count in check.items():
getattr(rop, insn.upper()) # fails if 'rop.INSN' does not exist
found = insns.get(insn, 0)
assert found == expected_count, (
> "found %d %r, expected %d" % (found, insn, expected_count))
E AssertionError: found 12 'int_add', expected 10
jit/metainterp/history.py:982: AssertionError
---------- Captured stdout call ----------
bh: goto_if_not_int_gt [0, 0, 65, 62] -> 65
bh: int_return [<BHInterp <JitCode 'f'>>, 210] -> LeaveFrame!
~~~ return value: 210
---------- Captured stderr call ----------
[rtyper] -=- specialized 6 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 7 more blocks -=-
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] -=- specialized 17 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 3 more blocks -=-
[jitcodewriter:info] making JitCodes...
[jitcodewriter:info] There are 1 JitCode instances.
[jitcodewriter:info] There are 4 -live- ops. Size of liveness is 4 bytes
[jitcodewriter] compute_bitstrings:
[jitcodewriter] 0 effectinfos:
[jitcodewriter] 0 descrs for arrays
[jitcodewriter] 0 descrs for fields
[jitcodewriter] 0 descrs for interiorfields
[c5fd604d7350d00] {jit-tracing
JIT starting (llgraph)
(jitdriver: no get_printable_location)
(jitdriver: no get_printable_location)
[c5fd604d75b4680] {jit-trace-done
trace length: 71
number operations: 17
total snapshots: 2
snapshot data: 24
snapshot array data: 34
bigint consts: 0 0
float consts: 0 0
ref consts: 0 0 1
descrs: 1
[c5fd604d75e2080] jit-trace-done}
[c5fd604d7644a80] {jit-log-noopt
# Traced loop or bridge with 12 ops
[i0, i1, i2, i3, i4, i5]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i7 = int_sub(i5, 1)
i9 = int_add(i1, 1)
i11 = int_add(i0, 2)
i13 = int_add(i3, 3)
i15 = int_add(i2, 4)
i17 = int_add(i4, 10)
i19 = int_gt(i7, 0)
guard_true(i19)
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
guard_future_condition()
jump(i11, i9, i15, i13, i17, i7, descr=<Loop-1>)
[c5fd604d7701080] jit-log-noopt}
[c5fd604d7711400] {jit-optimize
[c5fd604d774cf80] {jit-log-intbounds
[i0, i1, i2, i3, i4, i5]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i7 = int_add(i5, -1)
i9 = int_add(i1, 1)
# i9 -> (?) IntBound.unbounded()
i11 = int_add(i0, 2)
# i11 -> (?) IntBound.unbounded()
i13 = int_add(i3, 3)
# i13 -> (?) IntBound.unbounded()
i15 = int_add(i2, 4)
# i15 -> (?) IntBound.unbounded()
i17 = int_add(i4, 10)
# i17 -> (?) IntBound.unbounded()
i19 = int_gt(i7, 0)
guard_true(i19, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0xf52552ac>) [i11, i9, i15, i13, i17, i7]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
[c5fd604d800b400] jit-log-intbounds}
[c5fd604d8163f80] {jit-log-exported-state
[i20, i21, i22, i23, i24, i25]
INP(i20 = int_add(i26, 2/ci))
INP(i24 = int_add(i27, 10/ci))
PureOp(i28 = int_gt(i25, 0/ci))
INP(i23 = int_add(i29, 3/ci))
INP(i25 = int_add(i30, -1/ci))
INP(i21 = int_add(i31, 1/ci))
INP(i22 = int_add(i32, 4/ci))
[c5fd604d8197800] jit-log-exported-state}
[c5fd604d81a2d80] jit-optimize}
[c5fd604d81b9480] {jit-optimize
[c5fd604d8518180] {jit-log-intbounds
[i0, i1, i2, i3, i4, i5]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
# i6: (1 <= 0b0?...?) IntBound(1, MAXINT)
i8 = int_add(i6, -1)
i11 = int_add(i9, 1)
# i11 -> (?) IntBound.unbounded()
i14 = int_add(i12, 2)
# i14 -> (?) IntBound.unbounded()
i17 = int_add(i15, 3)
# i17 -> (?) IntBound.unbounded()
i20 = int_add(i18, 4)
# i20 -> (?) IntBound.unbounded()
i23 = int_add(i21, 10)
# i23 -> (?) IntBound.unbounded()
# i8: (0 <= 0b0?...? <= MAXINT - 1) IntBound(0, MAXINT - 1)
i25 = int_gt(i8, 0)
guard_true(i25, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0xf5247f6c>) [i14, i11, i20, i17, i23, i8]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
[c5fd604d8f26300] jit-log-intbounds}
# i8: (1 <= 0b0?...?) IntBound(1, MAXINT)
jump(i14, i11, i20, i17, i23, i8, descr=TargetToken(-178145684))
[c5fd604d9257100] jit-optimize}
[c5fd604d9264080] {jit-log-short-preamble
[]
label(i33, i34, i35, i36, i37, i38)
jump()
[c5fd604d927dc80] jit-log-short-preamble}
[c5fd604d92d0a80] {jit-backend
[c5fd604d92eac80] {jit-log-compiling-loop
[i26, i31, i32, i29, i27, i30]
label(i26, i31, i32, i29, i27, i30, descr=TargetToken(-182100084))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i25 = int_add(i30, -1)
i21 = int_add(i31, 1)
i20 = int_add(i26, 2)
i23 = int_add(i29, 3)
i22 = int_add(i32, 4)
i24 = int_add(i27, 10)
i28 = int_gt(i25, 0)
guard_true(i28, descr=<Guard0xf52552ac>) [i20, i21, i22, i23, i24, i25]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
label(i20, i21, i22, i23, i24, i25, descr=TargetToken(-178145684))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i47 = int_add(i25, -1)
i49 = int_add(i21, 1)
i51 = int_add(i20, 2)
i53 = int_add(i23, 3)
i55 = int_add(i22, 4)
i57 = int_add(i24, 10)
i59 = int_gt(i47, 0)
guard_true(i59, descr=<Guard0xf5247f6c>) [i51, i49, i55, i53, i57, i47]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
jump(i51, i49, i55, i53, i57, i47, descr=TargetToken(-178145684))
[c5fd604d9389d80] jit-log-compiling-loop}
[c5fd604d939c480] {jit-mem-looptoken-alloc
allocating Loop # 1
[c5fd604d93a9180] jit-mem-looptoken-alloc}
[c5fd604d93f0600] jit-backend}
compiled new loop
[c5fd604d93fd500] {jit-log-opt-loop
# Loop 1 ((jitdriver: no get_printable_location)) : loop with 23 ops
[i0, i1, i2, i3, i4, i5]
label(i0, i1, i2, i3, i4, i5, descr=TargetToken(-182100084))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i7 = int_add(i5, -1)
i9 = int_add(i1, 1)
i11 = int_add(i0, 2)
i13 = int_add(i3, 3)
i15 = int_add(i2, 4)
i17 = int_add(i4, 10)
i19 = int_gt(i7, 0)
guard_true(i19, descr=<Guard0xf52552ac>) [i11, i9, i15, i13, i17, i7]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
label(i11, i9, i15, i13, i17, i7, descr=TargetToken(-178145684))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i21 = int_add(i7, -1)
i23 = int_add(i9, 1)
i25 = int_add(i11, 2)
i27 = int_add(i13, 3)
i29 = int_add(i15, 4)
i31 = int_add(i17, 10)
i33 = int_gt(i21, 0)
guard_true(i33, descr=<Guard0xf5247f6c>) [i25, i23, i29, i27, i31, i21]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
jump(i25, i23, i29, i27, i31, i21, descr=TargetToken(-178145684))
[c5fd604d94a6c00] jit-log-opt-loop}
DoneWithThisFrameInt
[c5fd604d9822580] jit-tracing}
builder: rpython-linux-x86-32 build #857+
test: jit/metainterp/test/test_warmspot.py::TestLLWarmspot::()::test_loop_automatic_reds