jit/metainterp/test/test_warmspot.py::TestLLWarmspot::()::test_loop_automatic_reds_with_floats_and_refs
self = <rpython.jit.metainterp.test.test_warmspot.TestLLWarmspot instance at 0x7f3a7b2bd8c0>
def test_loop_automatic_reds_with_floats_and_refs(self):
myjitdriver = JitDriver(greens = ['m'], reds = 'auto')
class MyObj(object):
def __init__(self, val):
self.val = val
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
i1 = i2 = i3 = i4 = n
f1 = f2 = f3 = f4 = float(n)
r1 = r2 = r3 = r4 = MyObj(n)
while n > 0:
myjitdriver.jit_merge_point(m=m)
n -= 1
i1 += 1 # dummy unused red
i2 += 2 # dummy unused red
i3 += 3 # dummy unused red
i4 += 4 # dummy unused red
f1 += 1 # dummy unused red
f2 += 2 # dummy unused red
f3 += 3 # dummy unused red
f4 += 4 # dummy unused red
r1.val += 1 # dummy unused red
r2.val += 2 # dummy unused red
r3.val += 3 # dummy unused red
r4.val += 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=18, float_add=8)
jit/metainterp/test/test_warmspot.py:372:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 0x7f3a7b2c0d90>
insns = {'debug_merge_point': 4, 'float_add': 8, 'getfield_gc_i': 1, 'guard_true': 2, ...}
expected = None
check = {'float_add': 8, 'int_add': 18, '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 20 'int_add', expected 18
jit/metainterp/history.py:982: AssertionError
---------- Captured stdout call ----------
bh: goto_if_not_int_gt [0, 0, 142, 139] -> 142
bh: int_return [<BHInterp <JitCode 'f'>>, 210] -> LeaveFrame!
~~~ return value: 210
---------- Captured stderr call ----------
[rtyper] -=- specialized 8 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 6 bytes
[jitcodewriter] compute_bitstrings:
[jitcodewriter] 0 effectinfos:
[jitcodewriter] 0 descrs for arrays
[jitcodewriter] 0 descrs for fields
[jitcodewriter] 0 descrs for interiorfields
[c5fd55116107880] {jit-tracing
JIT starting (llgraph)
(jitdriver: no get_printable_location)
(jitdriver: no get_printable_location)
[c5fd5511637a200] {jit-trace-done
trace length: 149
number operations: 35
total snapshots: 2
snapshot data: 24
snapshot array data: 54
bigint consts: 0 0
float consts: 4 4
ref consts: 0 0 1
descrs: 1
[c5fd5511638fb80] jit-trace-done}
[c5fd551163d9780] {jit-log-noopt
# Traced loop or bridge with 25 ops
[i0, i1, i2, i3, i4, i5, p6, f7, f8, f9, f10]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i12 = int_sub(i1, 1)
i14 = int_add(i0, 1)
i16 = int_add(i2, 2)
i18 = int_add(i5, 3)
i20 = int_add(i4, 4)
f22 = float_add(f8, 1.0)
f24 = float_add(f10, 2.0)
f26 = float_add(f9, 3.0)
f28 = float_add(f7, 4.0)
i29 = getfield_gc_i(p6, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i31 = int_add(i29, 1)
setfield_gc(p6, i31, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i33 = int_add(i31, 2)
setfield_gc(p6, i33, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i35 = int_add(i33, 3)
setfield_gc(p6, i35, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i37 = int_add(i35, 4)
setfield_gc(p6, i37, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i39 = int_add(i3, 10)
i41 = int_gt(i12, 0)
guard_true(i41)
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
guard_future_condition()
jump(i14, i12, i16, i39, i20, i18, p6, f28, f22, f26, f24, descr=<Loop-1>)
[c5fd55116475b00] jit-log-noopt}
[c5fd55116480380] {jit-optimize
[c5fd551164b0a80] {jit-log-intbounds
[i0, i1, i2, i3, i4, i5, p6, f7, f8, f9, f10]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i12 = int_add(i1, -1)
i14 = int_add(i0, 1)
# i14 -> (?) IntBound.unbounded()
i16 = int_add(i2, 2)
# i16 -> (?) IntBound.unbounded()
i18 = int_add(i5, 3)
# i18 -> (?) IntBound.unbounded()
i20 = int_add(i4, 4)
# i20 -> (?) IntBound.unbounded()
f22 = float_add(f8, 1.0)
f24 = float_add(f10, 2.0)
f26 = float_add(f9, 3.0)
f28 = float_add(f7, 4.0)
i29 = getfield_gc_i(p6, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i31 = int_add(i29, 1)
# i31 -> (?) IntBound.unbounded()
i33 = int_add(i29, 3)
i35 = int_add(i29, 6)
i37 = int_add(i29, 10)
i39 = int_add(i3, 10)
# i39 -> (?) IntBound.unbounded()
setfield_gc(p6, i37, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i41 = int_gt(i12, 0)
guard_true(i41, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0x7f3a7b256a90>) [i14, i12, i16, i39, i20, i18, p6, f28, f22, f26, f24]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
[c5fd55116a0ba00] jit-log-intbounds}
[c5fd55116aa9380] {jit-log-exported-state
[i42, i43, i44, i45, i46, i47, r48, f49, f50, f51, f52]
INP(f52 = float_add(f53, 1073807360/cf))
INP(i43 = int_add(i54, -1/ci))
INP(f51 = float_add(f55, 1610678272/cf))
HeapOp(i56 = int_add(i57, 10/ci), i58 = getfield_gc_i(r48, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val')))
INP(f50 = float_add(f59, 1073774592/cf))
INP(r48)
INP(f49 = float_add(f60, 1073840128/cf))
INP(i46 = int_add(i61, 4/ci))
INP(i47 = int_add(i62, 3/ci))
PureOp(i63 = int_gt(i43, 0/ci))
INP(i44 = int_add(i64, 2/ci))
INP(i42 = int_add(i65, 1/ci))
INP(i45 = int_add(i66, 10/ci))
[c5fd55116ad5c80] jit-log-exported-state}
[c5fd55116adc800] jit-optimize}
[c5fd55116aee700] {jit-optimize
[c5fd55116c3f980] {jit-log-intbounds
[i0, i1, i2, i3, i4, i5, p6, f7, f8, f9, f10]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
# i11: (1 <= 0b0?...?) IntBound(1, MAXINT)
i13 = int_add(i11, -1)
i16 = int_add(i14, 1)
# i16 -> (?) IntBound.unbounded()
i19 = int_add(i17, 2)
# i19 -> (?) IntBound.unbounded()
i22 = int_add(i20, 3)
# i22 -> (?) IntBound.unbounded()
i25 = int_add(i23, 4)
# i25 -> (?) IntBound.unbounded()
f28 = float_add(f26, 1.0)
f31 = float_add(f29, 2.0)
f34 = float_add(f32, 3.0)
f37 = float_add(f35, 4.0)
i40 = int_add(i38, 1)
# i40 -> (?) IntBound.unbounded()
i42 = int_add(i38, 3)
i44 = int_add(i38, 6)
i46 = int_add(i38, 10)
i49 = int_add(i47, 10)
# i49 -> (?) IntBound.unbounded()
setfield_gc(p50, i46, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
# i13: (0 <= 0b0?...? <= MAXINT - 1) IntBound(0, MAXINT - 1)
i52 = int_gt(i13, 0)
guard_true(i52, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0x7f3a7b256a50>) [i16, i13, i19, i49, i25, i22, p50, f37, f28, f34, f31]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
[c5fd5511723cb00] jit-log-intbounds}
# i13: (1 <= 0b0?...?) IntBound(1, MAXINT)
jump(i16, i13, i19, i49, i25, i22, p50, f37, f28, f34, f31, i46, descr=TargetToken(139889150734096))
[c5fd551173a3380] jit-optimize}
[c5fd551173aa480] {jit-log-short-preamble
[]
label(i67, i68, i69, i70, i71, i72, p73, f74, f75, f76, f77)
guard_nonnull(p73)
guard_is_object(p73)
guard_subclass(p73, <AddressAsInt * struct rpython.jit.metainterp.test.test_warmspot.MyObj_vtable { super=... }>)
i79 = getfield_gc_i(p73, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
jump(i79)
[c5fd551173c4880] jit-log-short-preamble}
[c5fd551173f5600] {jit-backend
[c5fd55117403680] {jit-log-compiling-loop
[i65, i54, i64, i66, i61, i62, p48, f60, f59, f55, f53]
label(i65, i54, i64, i66, i61, i62, p48, f60, f59, f55, f53, descr=TargetToken(139889150881616))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i43 = int_add(i54, -1)
i42 = int_add(i65, 1)
i44 = int_add(i64, 2)
i47 = int_add(i62, 3)
i46 = int_add(i61, 4)
f50 = float_add(f59, 1.0)
f52 = float_add(f53, 2.0)
f51 = float_add(f55, 3.0)
f49 = float_add(f60, 4.0)
i57 = getfield_gc_i(p48, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i90 = int_add(i57, 1)
i92 = int_add(i57, 3)
i94 = int_add(i57, 6)
i56 = int_add(i57, 10)
i45 = int_add(i66, 10)
setfield_gc(p48, i56, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i63 = int_gt(i43, 0)
guard_true(i63, descr=<Guard0x7f3a7b256a90>) [i42, i43, i44, i45, i46, i47, p48, f49, f50, f51, f52]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
label(i42, i43, i44, i45, i46, i47, p48, f49, f50, f51, f52, i56, descr=TargetToken(139889150734096))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i99 = int_add(i43, -1)
i101 = int_add(i42, 1)
i103 = int_add(i44, 2)
i105 = int_add(i47, 3)
i107 = int_add(i46, 4)
f109 = float_add(f50, 1.0)
f111 = float_add(f52, 2.0)
f113 = float_add(f51, 3.0)
f115 = float_add(f49, 4.0)
i117 = int_add(i56, 1)
i119 = int_add(i56, 3)
i121 = int_add(i56, 6)
i123 = int_add(i56, 10)
i125 = int_add(i45, 10)
setfield_gc(p48, i123, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i127 = int_gt(i99, 0)
guard_true(i127, descr=<Guard0x7f3a7b256a50>) [i101, i99, i103, i125, i107, i105, p48, f115, f109, f113, f111]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
jump(i101, i99, i103, i125, i107, i105, p48, f115, f109, f113, f111, i123, descr=TargetToken(139889150734096))
[c5fd55117479a80] jit-log-compiling-loop}
[c5fd55117487f80] {jit-mem-looptoken-alloc
allocating Loop # 1
[c5fd5511748e300] jit-mem-looptoken-alloc}
[c5fd551174bdd00] jit-backend}
compiled new loop
[c5fd551174c4280] {jit-log-opt-loop
# Loop 1 ((jitdriver: no get_printable_location)) : loop with 42 ops
[i0, i1, i2, i3, i4, i5, p6, f7, f8, f9, f10]
label(i0, i1, i2, i3, i4, i5, p6, f7, f8, f9, f10, descr=TargetToken(139889150881616))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i12 = int_add(i1, -1)
i14 = int_add(i0, 1)
i16 = int_add(i2, 2)
i18 = int_add(i5, 3)
i20 = int_add(i4, 4)
f22 = float_add(f8, 1.0)
f24 = float_add(f10, 2.0)
f26 = float_add(f9, 3.0)
f28 = float_add(f7, 4.0)
i29 = getfield_gc_i(p6, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i31 = int_add(i29, 1)
i33 = int_add(i29, 3)
i35 = int_add(i29, 6)
i37 = int_add(i29, 10)
i39 = int_add(i3, 10)
setfield_gc(p6, i37, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i41 = int_gt(i12, 0)
guard_true(i41, descr=<Guard0x7f3a7b256a90>) [i14, i12, i16, i39, i20, i18, p6, f28, f22, f26, f24]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
label(i14, i12, i16, i39, i20, i18, p6, f28, f22, f26, f24, i37, descr=TargetToken(139889150734096))
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
i43 = int_add(i12, -1)
i45 = int_add(i14, 1)
i47 = int_add(i16, 2)
i49 = int_add(i18, 3)
i51 = int_add(i20, 4)
f53 = float_add(f22, 1.0)
f55 = float_add(f24, 2.0)
f57 = float_add(f26, 3.0)
f59 = float_add(f28, 4.0)
i61 = int_add(i37, 1)
i63 = int_add(i37, 3)
i65 = int_add(i37, 6)
i67 = int_add(i37, 10)
i69 = int_add(i39, 10)
setfield_gc(p6, i67, descr=FieldDescr(<GcStruct rpython.jit.metainterp.test.test_warmspot.MyObj { super, inst_val }>, 'inst_val'))
i71 = int_gt(i43, 0)
guard_true(i71, descr=<Guard0x7f3a7b256a50>) [i45, i43, i47, i69, i51, i49, p6, f59, f53, f57, f55]
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)')
jump(i45, i43, i47, i69, i51, i49, p6, f59, f53, f57, f55, i67, descr=TargetToken(139889150734096))
[c5fd5511753d600] jit-log-opt-loop}
DoneWithThisFrameInt
[c5fd551177af580] jit-tracing}
builder: rpython-linux-x86-64 build #918+
test: jit/metainterp/test/test_warmspot.py::TestLLWarmspot::()::test_loop_automatic_reds_with_floats_and_refs