Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

jit/metainterp/test/test_call.py::TestCall::()::test_cond_call_constant_in_optimizer

self = <rpython.jit.metainterp.test.test_call.TestCall object at 0x7f786c510d90>

    def test_cond_call_constant_in_optimizer(self):
        myjitdriver = jit.JitDriver(greens = ['m'], reds = ['n', 'p'])
        def externfn(x):
            return x - 3
        class V:
            def __init__(self, value):
                self.value = value
        def f(n, m, p):
            while n > 0:
                myjitdriver.can_enter_jit(n=n, p=p, m=m)
                myjitdriver.jit_merge_point(n=n, p=p, m=m)
                m1 = noConst(m)
                n -= jit.conditional_call_elidable(p, externfn, m1)
            return n
        res = self.meta_interp(f, [21, 5, 0])
        assert res == -1
        # the COND_CALL_VALUE is constant-folded away by optimizeopt.py
        self.check_resops({'int_sub': 2, 'int_gt': 2, 'guard_true': 2,
>                          'jump': 1})

jit/metainterp/test/test_call.py:116: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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 0x7f786c4d5d50>
insns = {'guard_true': 2, 'int_add': 2, 'int_gt': 2, 'jump': 1}
expected = {'guard_true': 2, 'int_gt': 2, 'int_sub': 2, 'jump': 1}, check = {}

    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
E           assert {'guard_true'... 2, 'jump': 1} == {'guard_true':... 2, 'jump': 1}
E             Omitting 3 identical items, use -v to show
E             Left contains more items:
E             {'int_add': 2}
E             Right contains more items:
E             {'int_sub': 2}
E             Use -v to get the full diff

jit/metainterp/history.py:977: AssertionError
---------- Captured stdout call ----------
	bh: goto_if_not_int_gt [-1, 0, 60, 55] -> 60
	bh: int_return [<BHInterp <JitCode 'f'>>, -1] -> LeaveFrame!
~~~ return value: -1
---------- Captured stderr call ----------
[rtyper] -=- specialized 17 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 4 JitCode instances.
[jitcodewriter:info] There are 6 -live- ops. Size of liveness is 8 bytes
[jitcodewriter] compute_bitstrings:
[jitcodewriter]   1 effectinfos:
[jitcodewriter]     0 descrs for arrays
[jitcodewriter]     0 descrs for fields
[jitcodewriter]     0 descrs for interiorfields
[jitcodewriter] -> 1 bitstrings, mean length 0.0, max length 0
[c5fd5382725c080] {jit-tracing
JIT starting (llgraph) 
(jitdriver: no get_printable_location) 
(jitdriver: no get_printable_location) 
[c5fd53827378d00] {jit-trace-done
trace length: 66 
 number operations: 12 
 total snapshots: 2 
 snapshot data: 24 
 snapshot array data: 18 
 bigint consts:  1 1 
 float consts:  0 0 
 ref consts:  0 0 1 
 descrs: 1 
[c5fd5382738e500] jit-trace-done}
[c5fd538273b3a80] {jit-log-noopt
# Traced loop or bridge with 11 ops 
[i0, i1] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
i3 = same_as_i(5) 
p4 = new(descr=SizeDescr(<GcStruct tuple1 { item0 }>)) 
setfield_gc(p4, i3, descr=FieldDescr(<GcStruct tuple1 { item0 }>, 'item0')) 
i6 = cond_call_value_i(i1, ConstClass(externfn), i3, descr=CallDescr(<Signed>, (<Signed>,), <EffectInfo 0x7f786cead0d0: EF=2>)) 
i7 = int_sub(i0, i6) 
i9 = int_gt(i7, 0) 
guard_true(i9) 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
guard_future_condition() 
jump(i7, i1, descr=<Loop-1>) 
[c5fd53827407e80] jit-log-noopt}
[c5fd53827410f00] {jit-optimize
[c5fd53827424f00] {jit-log-intbounds
[i0, i1] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
i3 = int_add(i0, -2) 
i5 = int_gt(i3, 0) 
guard_true(i5, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0x7f786c580f90>) [i3, i1] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
[c5fd538275f8b80] jit-log-intbounds}
[c5fd5382763d500] {jit-log-exported-state
[i10, i11] 
  PureOp(i12 = int_gt(i10, 0/ci)) 
  INP(i10 = int_add(i13, -2/ci)) 
  INP(i11) 
[c5fd5382764ae00] jit-log-exported-state}
[c5fd53827650200] jit-optimize}
[c5fd53827660400] {jit-optimize
[c5fd538276e5f00] {jit-log-intbounds
[i0, i1] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
# i2: (1 <= 0b0?...?)   IntBound(1, MAXINT) 
i4 = int_add(i2, -2) 
# i4: (-1 <= ? <= MAXINT - 2)   IntBound(-1, MAXINT - 2) 
i6 = int_gt(i4, 0) 
guard_true(i6, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0x7f786c434350>) [i4, i7] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
[c5fd53827939d80] jit-log-intbounds}
# i4: (1 <= 0b0?...?)   IntBound(1, MAXINT) 
jump(i4, i7, descr=TargetToken(140155189153296)) 
[c5fd538279d9c80] jit-optimize}
[c5fd538279e0780] {jit-log-short-preamble
[] 
label(i14, i15) 
jump() 
[c5fd538279eb180] jit-log-short-preamble}
[c5fd53827a00d80] {jit-backend
[c5fd53827a0ee00] {jit-log-compiling-loop
[i13, i11] 
label(i13, i11, descr=TargetToken(140155190046544)) 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
i10 = int_add(i13, -2) 
i12 = int_gt(i10, 0) 
guard_true(i12, descr=<Guard0x7f786c580f90>) [i10, i11] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
label(i10, i11, descr=TargetToken(140155189153296)) 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
i19 = int_add(i10, -2) 
i21 = int_gt(i19, 0) 
guard_true(i21, descr=<Guard0x7f786c434350>) [i19, i11] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
jump(i19, i11, descr=TargetToken(140155189153296)) 
[c5fd53827a35e80] jit-log-compiling-loop}
[c5fd53827a43400] {jit-mem-looptoken-alloc
allocating Loop # 1 
[c5fd53827a49180] jit-mem-looptoken-alloc}
[c5fd53827a5dc00] jit-backend}
compiled new loop 
[c5fd53827a63d00] {jit-log-opt-loop
# Loop 1 ((jitdriver: no get_printable_location)) : loop with 13 ops 
[i0, i1] 
label(i0, i1, descr=TargetToken(140155190046544)) 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
i3 = int_add(i0, -2) 
i5 = int_gt(i3, 0) 
guard_true(i5, descr=<Guard0x7f786c580f90>) [i3, i1] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
label(i3, i1, descr=TargetToken(140155189153296)) 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
i7 = int_add(i3, -2) 
i9 = int_gt(i7, 0) 
guard_true(i9, descr=<Guard0x7f786c434350>) [i7, i1] 
debug_merge_point(0, 0, '(jitdriver: no get_printable_location)') 
jump(i7, i1, descr=TargetToken(140155189153296)) 
[c5fd53827a90080] jit-log-opt-loop}
DoneWithThisFrameInt 
[c5fd53827b3d980] jit-tracing}
builder: rpython-linux-x86-64 build #918+
test: jit/metainterp/test/test_call.py::TestCall::()::test_cond_call_constant_in_optimizer