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

jit/metainterp/optimizeopt/test/test_optimizeopt.py::TestOptimizeOpt::()::test_constant_getfield1

self = <rpython.jit.metainterp.optimizeopt.test.test_optimizeopt.TestOptimizeOpt object at 0x7f5afb8d2610>

    def test_constant_getfield1(self):
        ops = """
            [p1, p187, i184]
            p188 = getarrayitem_gc_r(p187, 42, descr=gcarraydescr)
            guard_value(p188, ConstPtr(myptr)) []
            p25 = getfield_gc_r(ConstPtr(myptr), descr=otherdescr)
            jump(p25, p187, i184)
            """
        preamble = """
            [p1, p187, i184]
            p188 = getarrayitem_gc_r(p187, 42, descr=gcarraydescr)
            guard_value(p188, ConstPtr(myptr)) []
            p25 = getfield_gc_r(ConstPtr(myptr), descr=otherdescr)
            p5 = same_as_r(p25)
            jump(p25, p187, i184, p5)
            """
        short = """
            [p1, p187, i184]
            guard_nonnull(p187) []
            guard_gc_type(p187, ConstInt(gcarraydescr_tid)) []
            i10 = arraylen_gc(p187, descr=gcarraydescr)
            i11 = int_ge(i10, 43)
            guard_true(i11) []
            p188 = getarrayitem_gc_r(p187, 42, descr=gcarraydescr)
            guard_value(p188, ConstPtr(myptr)) []
            p25 = getfield_gc_r(ConstPtr(myptr), descr=otherdescr)
            jump(p25)
            """
        expected = """
            [p25, p187, i184, p189]
            ifoo = arraylen_gc(p187, descr=gcarraydescr) # killed by backend
            jump(p189, p187, i184, p189)
            """
>       self.optimize_loop(ops, expected, preamble, expected_short=short)

jit/metainterp/optimizeopt/test/test_optimizeopt.py:6761: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
jit/metainterp/optimizeopt/test/test_optimizeopt.py:85: in optimize_loop
    text_right='expected short preamble')
jit/metainterp/optimizeopt/test/test_util.py:584: in assert_equal
    expected.operations, False, remap, text_right)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

oplist1 = [label(r7, r8, i9), guard_nonnull(r8), guard_gc_type(r8, <rpython.jit.backend.llgraph.runner.TypeIDSymbolic object at ... = arraylen_gc(r8, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >)), i11 = int_ge(i10, 43/ci), guard_true(i11), ...]
oplist2 = [label(r17, r16, i18, descr=<rpython.jit.metainterp.optimizeopt.test.test_util.FakeDescr object at 0x7f5afb7a1890>), g...= arraylen_gc(r16, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >)), i20 = int_ge(i19, 43/ci), guard_true(i20), ...]
strict_fail_args = False
remap = {i19 = arraylen_gc(r16, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >)): i10 = arraylen_gc(r8, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >)), i20 = int_ge(i19, 43/ci): i11 = int_ge(i10, 43/ci), i18: i9, r16: r8, ...}
text_right = 'expected short preamble'

    def equaloplists(oplist1, oplist2, strict_fail_args=True, remap={},
                     text_right=None):
        # try to use the full width of the terminal to display the list
        # unfortunately, does not work with the default capture method of py.test
        # (which is fd), you you need to use either -s or --capture=sys, else you
        # get the standard 80 columns width
        totwidth = py.io.get_terminal_width()
        width = totwidth / 2 - 1
        print(' Comparing lists '.center(totwidth, '-'))
        text_right = text_right or 'expected'
        memo = {}
        print('%s| %s' % ('optimized'.center(width), text_right.center(width)))
        for op1, op2 in itertools.izip_longest(oplist1, oplist2, fillvalue=''):
            if op1:
                txt1 = op1.repr(memo)
            else:
                txt1 = ''
            if op2:
                txt2 = op2.repr(memo)
            else:
                txt2 = ''
            while txt1 or txt2:
                part1 = txt1[:width]
                part2 = txt2[:width]
                if part1 == part2:
                    sep = '| '
                else:
                    sep = '<>'
                print('%s%s%s' % (part1.ljust(width), sep, part2))
                txt1 = txt1[width:]
                txt2 = txt2[width:]
        print('-' * totwidth)
    
        for i_count, (op1, op2) in enumerate(zip(oplist1, oplist2)):
>           assert op1.getopnum() == op2.getopnum()
E           assert 93 == 141
E            +  where 93 = <bound method INT_LE_OP.getopnum of i12 = int_le(i10, 18014398509481984/ci)>()
E            +    where <bound method INT_LE_OP.getopnum of i12 = int_le(i10, 18014398509481984/ci)> = i12 = int_le(i10, 18014398509481984/ci).getopnum
E            +  and   141 = <bound method GETARRAYITEM_GC_R_OP.getopnum of r15 = getarrayitem_gc_r(r16, 42/ci, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >))>()
E            +    where <bound method GETARRAYITEM_GC_R_OP.getopnum of r15 = getarrayitem_gc_r(r16, 42/ci, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >))> = r15 = getarrayitem_gc_r(r16, 42/ci, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >)).getopnum

jit/metainterp/optimizeopt/util.py:166: AssertionError
---------- Captured stderr setup ----------
[jitcodewriter] compute_bitstrings:
[jitcodewriter]   40 effectinfos:
[jitcodewriter]     2 descrs for arrays
[jitcodewriter]     4 descrs for fields
[jitcodewriter]     0 descrs for interiorfields
[jitcodewriter] -> 5 bitstrings, mean length 0.8, max length 1
---------- Captured stdout call ----------

Preamble:
label(r0, r1, i2)
r3 = getarrayitem_gc_r(r1, 42/ci, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >))
guard_value(r3, 8751797218854/cp, descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0x7f5afb90e6d0>)
r4 = getfield_gc_r(8751797218854/cp, descr=FieldDescr(<GcStruct NODE2 { parent, other }>, 'other'))
r5 = same_as_r(r4)
label(r4, r1, i2, r5, descr=<rpython.jit.metainterp.history.TargetToken object at 0x7f5afb696d90>)

Loop:
label(r4, r1, i2, r5, descr=<rpython.jit.metainterp.history.TargetToken object at 0x7f5afb696d90>)
i6 = arraylen_gc(r1, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >))
jump(r5, r1, i2, r5, descr=<rpython.jit.metainterp.history.TargetToken object at 0x7f5afb696d90>)

Short Preamble:
label(r7, r8, i9)
guard_nonnull(r8)
guard_gc_type(r8, <rpython.jit.backend.llgraph.runner.TypeIDSymbolic object at 0x7f5afb786fd0>/ci)
i10 = arraylen_gc(r8, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >))
i11 = int_ge(i10, 43/ci)
guard_true(i11)
i12 = int_le(i10, 18014398509481984/ci)
guard_true(i12)
r13 = getarrayitem_gc_r(r8, 42/ci, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >))
guard_value(r13, 8751797218854/cp)
r14 = getfield_gc_r(8751797218854/cp, descr=FieldDescr(<GcStruct NODE2 { parent, other }>, 'other'))
jump(r14)

------------------------------- Comparing lists --------------------------------
               optimized               |                 expected               
label(r0, r1, i2, r3, descr=<rpython.ji<>label(r4, r5, i6, r7, descr=<rpython.ji
t.metainterp.history.TargetToken object<>t.metainterp.optimizeopt.test.test_util
 at 0x7f5afb696d90>)                   <>.FakeDescr object at 0x7f5afb7b2490>)
i8 = arraylen_gc(r1, descr=ArrayDescr(<<>i9 = arraylen_gc(r5, descr=ArrayDescr(<
GcArray of * GCREF (gcopaque) >))      | GcArray of * GCREF (gcopaque) >))
jump(r3, r1, i2, r3, descr=<rpython.jit<>jump(r7, r5, i6, r7)
.metainterp.history.TargetToken object <>
at 0x7f5afb696d90>)                    <>
--------------------------------------------------------------------------------
------------------------------- Comparing lists --------------------------------
               optimized               |            expected preamble           
label(r0, r1, i2)                      <>label(r3, r4, i5, descr=<rpython.jit.me
                                       <>tainterp.optimizeopt.test.test_util.Fak
                                       <>eDescr object at 0x7f5afb7a1890>)
r6 = getarrayitem_gc_r(r1, 42/ci, descr<>r7 = getarrayitem_gc_r(r4, 42/ci, descr
=ArrayDescr(<GcArray of * GCREF (gcopaq| =ArrayDescr(<GcArray of * GCREF (gcopaq
ue) >))                                | ue) >))
guard_value(r6, 8751797218854/cp, descr<>guard_value(r7, 8751797218854/cp)
=<rpython.jit.metainterp.compile.Resume<>
GuardDescr object at 0x7f5afb90e6d0>)  <>
r8 = getfield_gc_r(8751797218854/cp, de<>r9 = getfield_gc_r(8751797218854/cp, de
scr=FieldDescr(<GcStruct NODE2 { parent| scr=FieldDescr(<GcStruct NODE2 { parent
, other }>, 'other'))                  | , other }>, 'other'))
r10 = same_as_r(r8)                    <>r11 = same_as_r(r9)
label(r8, r1, i2, r10, descr=<rpython.j<>label(r9, r4, i5, r11)
it.metainterp.history.TargetToken objec<>
t at 0x7f5afb696d90>)                  <>
--------------------------------------------------------------------------------
------------------------------- Comparing lists --------------------------------
               optimized               |         expected short preamble        
label(r0, r1, i2)                      <>label(r3, r4, i5, descr=<rpython.jit.me
                                       <>tainterp.optimizeopt.test.test_util.Fak
                                       <>eDescr object at 0x7f5afb7a1890>)
guard_nonnull(r1)                      <>guard_nonnull(r4)
guard_gc_type(r1, <rpython.jit.backend.<>guard_gc_type(r4, <rpython.jit.backend.
llgraph.runner.TypeIDSymbolic object at| llgraph.runner.TypeIDSymbolic object at
 0x7f5afb786fd0>/ci)                   <> 0x7f5afc492c90>/ci)
i6 = arraylen_gc(r1, descr=ArrayDescr(<<>i7 = arraylen_gc(r4, descr=ArrayDescr(<
GcArray of * GCREF (gcopaque) >))      | GcArray of * GCREF (gcopaque) >))
i8 = int_ge(i6, 43/ci)                 <>i9 = int_ge(i7, 43/ci)
guard_true(i8)                         <>guard_true(i9)
i10 = int_le(i6, 18014398509481984/ci) <>r11 = getarrayitem_gc_r(r4, 42/ci, desc
                                       <>r=ArrayDescr(<GcArray of * GCREF (gcopa
                                       <>que) >))
guard_true(i10)                        <>guard_value(r11, 8751797218854/cp)
r12 = getarrayitem_gc_r(r1, 42/ci, desc<>r13 = getfield_gc_r(8751797218854/cp, d
r=ArrayDescr(<GcArray of * GCREF (gcopa<>escr=FieldDescr(<GcStruct NODE2 { paren
que) >))                               <>t, other }>, 'other'))
guard_value(r12, 8751797218854/cp)     <>jump(r13)
r14 = getfield_gc_r(8751797218854/cp, d<>
escr=FieldDescr(<GcStruct NODE2 { paren<>
t, other }>, 'other'))                 <>
jump(r14)                              <>
--------------------------------------------------------------------------------
---------- Captured stderr call ----------
[c607241f62dc880] {jit-optimize
[c607241f62f5a80] {jit-log-intbounds
[p0, p1, i2] 
p4 = getarrayitem_gc_r(p1, 42, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >)) 
guard_value(p4, ConstPtr(ptr5), descr=<rpython.jit.metainterp.compile.ResumeGuardDescr object at 0x7f5afb90e6d0>) [] 
p7 = getfield_gc_r(ConstPtr(ptr6), descr=FieldDescr(<GcStruct NODE2 { parent, other }>, 'other')) 
[c607241f641f100] jit-log-intbounds}
[c607241f6495b80] {jit-log-exported-state
[r0, r1, i2] 
  INP(r1) 
  INP(i2) 
  HeapOp(r3 = same_as_r(r0), r4 = getfield_gc_r(8751797218854/cp, descr=FieldDescr(<GcStruct NODE2 { parent, other }>, 'other'))) 
  INP(r0 = getfield_gc_r(8751797218854/cp, descr=FieldDescr(<GcStruct NODE2 { parent, other }>, 'other'))) 
  HeapOp(8751797218854/cp, r5 = getarrayitem_gc_r(r1, 42/ci, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >))) 
[c607241f64b1880] jit-log-exported-state}
[c607241f64b7800] jit-optimize}
[c607241f64c9b00] {jit-optimize
[c607241f653bf00] {jit-log-intbounds
[p0, p1, i2] 
[c607241f657e780] jit-log-intbounds}
i4 = arraylen_gc(p3, descr=ArrayDescr(<GcArray of * GCREF (gcopaque) >)) 
jump(p5, p3, i6, p5, descr=TargetToken(140028741774736)) 
[c607241f66a9500] jit-optimize}
builder: rpython-linux-x86-64 build #922+
test: jit/metainterp/optimizeopt/test/test_optimizeopt.py::TestOptimizeOpt::()::test_constant_getfield1