jit/metainterp/test/test_warmspot.py::TestLLWarmspot::()::test_loop_automatic_reds
self = <rpython.jit.metainterp.test.test_warmspot.TestLLWarmspot instance at 0x7f3a7b999f50>
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 0x7f3a7aef6310>
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
[c5fd55111b39a80] {jit-tracing
JIT starting (llgraph)
(jitdriver: no get_printable_location)
(jitdriver: no get_printable_location)
[c5fd55111c58080] {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
[c5fd55111c6d280] jit-trace-done}
[c5fd55111ca2200] {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(i4, 1)
i9 = int_add(i3, 1)
i11 = int_add(i5, 2)
i13 = int_add(i2, 3)
i15 = int_add(i0, 4)
i17 = int_add(i1, 10)
i19 = int_gt(i7, 0)
guard_true(i19)
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
guard_future_condition()
jump(i15, i17, i13, i9, i7, i11, descr=<Loop-1>)
[c5fd55111cf3c80] jit-log-noopt}
[c5fd55111cfc580] {jit-optimize
[c5fd55111d1bb80] {jit-log-intbounds
[i0, i1, i2, i3, i4, i5]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i7 = int_add(i4, -1)
i9 = int_add(i3, 1)
# i9 -> (?) IntBound.unbounded()
i11 = int_add(i5, 2)
# i11 -> (?) IntBound.unbounded()
i13 = int_add(i2, 3)
# i13 -> (?) IntBound.unbounded()
i15 = int_add(i0, 4)
# i15 -> (?) IntBound.unbounded()
i17 = int_add(i1, 10)
# i17 -> (?) IntBound.unbounded()
i19 = int_gt(i7, 0)
guard_true(i19, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0x7f3a7b2bc8d0>) [i15, i17, i13, i9, i7, i11]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
[c5fd55112091d00] jit-log-intbounds}
[c5fd55112112800] {jit-log-exported-state
[i20, i21, i22, i23, i24, i25]
INP(i21 = int_add(i26, 10/ci))
INP(i20 = int_add(i27, 4/ci))
INP(i22 = int_add(i28, 3/ci))
INP(i25 = int_add(i29, 2/ci))
INP(i23 = int_add(i30, 1/ci))
PureOp(i31 = int_gt(i24, 0/ci))
INP(i24 = int_add(i32, -1/ci))
[c5fd5511212b080] jit-log-exported-state}
[c5fd55112130a80] jit-optimize}
[c5fd55112141380] {jit-optimize
[c5fd5511226af80] {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 0x7f3a7b2bc890>) [i20, i23, i17, i11, i8, i14]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
[c5fd5511266bc00] jit-log-intbounds}
# i8: (1 <= 0b0?...?) IntBound(1, MAXINT)
jump(i20, i23, i17, i11, i8, i14, descr=TargetToken(139889151352272))
[c5fd55112794400] jit-optimize}
[c5fd5511279b780] {jit-log-short-preamble
[]
label(i33, i34, i35, i36, i37, i38)
jump()
[c5fd551127a7880] jit-log-short-preamble}
[c5fd551127c6e80] {jit-backend
[c5fd551127d5b00] {jit-log-compiling-loop
[i27, i26, i28, i30, i32, i29]
label(i27, i26, i28, i30, i32, i29, descr=TargetToken(139889151297232))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i24 = int_add(i32, -1)
i23 = int_add(i30, 1)
i25 = int_add(i29, 2)
i22 = int_add(i28, 3)
i20 = int_add(i27, 4)
i21 = int_add(i26, 10)
i31 = int_gt(i24, 0)
guard_true(i31, descr=<Guard0x7f3a7b2bc8d0>) [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(139889151352272))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i47 = int_add(i24, -1)
i49 = int_add(i23, 1)
i51 = int_add(i25, 2)
i53 = int_add(i22, 3)
i55 = int_add(i20, 4)
i57 = int_add(i21, 10)
i59 = int_gt(i47, 0)
guard_true(i59, descr=<Guard0x7f3a7b2bc890>) [i55, i57, i53, i49, i47, i51]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
jump(i55, i57, i53, i49, i47, i51, descr=TargetToken(139889151352272))
[c5fd55112819900] jit-log-compiling-loop}
[c5fd55112829100] {jit-mem-looptoken-alloc
allocating Loop # 1
[c5fd5511282f480] jit-mem-looptoken-alloc}
[c5fd5511284cd00] jit-backend}
compiled new loop
[c5fd55112853280] {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(139889151297232))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i7 = int_add(i4, -1)
i9 = int_add(i3, 1)
i11 = int_add(i5, 2)
i13 = int_add(i2, 3)
i15 = int_add(i0, 4)
i17 = int_add(i1, 10)
i19 = int_gt(i7, 0)
guard_true(i19, descr=<Guard0x7f3a7b2bc8d0>) [i15, i17, i13, i9, i7, i11]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
label(i15, i17, i13, i9, i7, i11, descr=TargetToken(139889151352272))
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=<Guard0x7f3a7b2bc890>) [i29, i31, i27, i23, i21, i25]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
jump(i29, i31, i27, i23, i21, i25, descr=TargetToken(139889151352272))
[c5fd5511289a380] jit-log-opt-loop}
DoneWithThisFrameInt
[c5fd551129f1b80] jit-tracing}
builder: rpython-linux-x86-64 build #918+
test: jit/metainterp/test/test_warmspot.py::TestLLWarmspot::()::test_loop_automatic_reds