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

jit/backend/llsupport/test/test_rewrite.py::TestFramework::()::test_rewrite_assembler_newstr_newunicode

self = <rpython.jit.backend.llsupport.test.test_rewrite.TestFramework object at 0x00000211ecf2b1d8>

    def test_rewrite_assembler_newstr_newunicode(self):
        # note: strdescr.basesize already contains the extra final character,
        # so that's why newstr(14) is rounded up to 'basesize+15' and not
        # 'basesize+16'.
        self.check_rewrite("""
                [i2]
                p0 = newstr(14)
                p1 = newunicode(10)
                p2 = newunicode(i2)
                p3 = newstr(i2)
                jump()
>           """, """
                [i2]
                p0 = call_malloc_nursery(                                \
                          %(strdescr.basesize + 15 * strdescr.itemsize + \
                            unicodedescr.basesize + 10 * unicodedescr.itemsize)d)
                gc_store(p0, 0,  %(strdescr.tid)d, %(tiddescr.field_size)s)
                gc_store(p0, %(strlendescr.offset)s, 14, %(strlendescr.field_size)s)
                gc_store(p0, 0,  0, %(strhashdescr.field_size)s)
                p1 = nursery_ptr_increment(p0, %(strdescr.basesize + 15 * strdescr.itemsize)d)
                gc_store(p1, 0,  %(unicodedescr.tid)d, %(tiddescr.field_size)s)
                gc_store(p1, %(unicodelendescr.offset)s, 10, %(unicodelendescr.field_size)s)
                gc_store(p1, 0,  0, %(unicodehashdescr.field_size)s)
                p2 = call_malloc_nursery_varsize(2, %(unicodedescr.itemsize)d, i2,\
                                    descr=unicodedescr)
                gc_store(p2, %(unicodelendescr.offset)s, i2, %(unicodelendescr.field_size)s)
                gc_store(p2, 0,  0, %(unicodehashdescr.field_size)s)
                p3 = call_malloc_nursery_varsize(1, 1, i2, \
                                    descr=strdescr)
                gc_store(p3, %(strlendescr.offset)s, i2, %(strlendescr.field_size)s)
                gc_store(p3, 0,  0, %(strhashdescr.field_size)s)
                jump()
            """)

jit\backend\llsupport\test\test_rewrite.py:669: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
jit\backend\llsupport\test\test_rewrite.py:197: in check_rewrite
    equaloplists(operations, expected.operations, remap=remap)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

oplist1 = [r264 = call_malloc_nursery(72/ci), gc_store(r264, 0/ci, 0/ci, 8/ci), gc_store(r264, 8/ci, 14/ci, 8/ci), gc_store(r264, 0/ci, 0/ci, 8/ci), r265 = nursery_ptr_increment(r264, 32/ci), gc_store(r265, 0/ci, 0/ci, 8/ci), ...]
oplist2 = [r266 = call_malloc_nursery(68/ci), gc_store(r266, 0/ci, 0/ci, 8/ci), gc_store(r266, 8/ci, 14/ci, 8/ci), gc_store(r266, 0/ci, 0/ci, 8/ci), r267 = nursery_ptr_increment(r266, 32/ci), gc_store(r267, 0/ci, 0/ci, 8/ci), ...]
strict_fail_args = True, remap = {i262: i263}, text_right = 'expected'

    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()
            assert op1.numargs() == op2.numargs()
            for i in range(op1.numargs()):
                x = op1.getarg(i)
                y = op2.getarg(i)
>               assert x.same_box(remap.get(y, y))
E               assert <bound method ConstInt.same_box of Const(72)>(Const(68))
E                +  where <bound method ConstInt.same_box of Const(72)> = Const(72).same_box
E                +  and   Const(68) = <bound method dict.get of {i262: i263}>(Const(68), Const(68))
E                +    where <bound method dict.get of {i262: i263}> = {i262: i263}.get

jit\metainterp\optimizeopt\util.py:171: AssertionError
---------- Captured stdout call ----------
------------------------------- Comparing lists --------------------------------
               optimized               |                 expected               
r0 = call_malloc_nursery(72/ci)        <>r1 = call_malloc_nursery(68/ci)
gc_store(r0, 0/ci, 0/ci, 8/ci)         <>gc_store(r1, 0/ci, 0/ci, 8/ci)
gc_store(r0, 8/ci, 14/ci, 8/ci)        <>gc_store(r1, 8/ci, 14/ci, 8/ci)
gc_store(r0, 0/ci, 0/ci, 8/ci)         <>gc_store(r1, 0/ci, 0/ci, 8/ci)
r2 = nursery_ptr_increment(r0, 32/ci)  <>r3 = nursery_ptr_increment(r1, 32/ci)
gc_store(r2, 0/ci, 0/ci, 8/ci)         <>gc_store(r3, 0/ci, 0/ci, 8/ci)
gc_store(r2, 8/ci, 10/ci, 8/ci)        <>gc_store(r3, 8/ci, 10/ci, 8/ci)
gc_store(r2, 0/ci, 0/ci, 8/ci)         <>gc_store(r3, 0/ci, 0/ci, 8/ci)
r4 = call_malloc_nursery_varsize(2/ci, <>r6 = call_malloc_nursery_varsize(2/ci, 
2/ci, i5, descr=<rpython.jit.backend.ll<>2/ci, i7, descr=<rpython.jit.backend.ll
support.descr.ArrayDescr object at 0x00| support.descr.ArrayDescr object at 0x00
000211ecf2b788>)                       | 000211ecf2b788>)
gc_store(r4, 8/ci, i5, 8/ci)           <>gc_store(r6, 8/ci, i7, 8/ci)
gc_store(r4, 0/ci, 0/ci, 8/ci)         <>gc_store(r6, 0/ci, 0/ci, 8/ci)
r8 = call_malloc_nursery_varsize(1/ci, <>r9 = call_malloc_nursery_varsize(1/ci, 
1/ci, i5, descr=<rpython.jit.backend.ll<>1/ci, i7, descr=<rpython.jit.backend.ll
support.descr.ArrayDescr object at 0x00| support.descr.ArrayDescr object at 0x00
000211ecf2b750>)                       | 000211ecf2b750>)
gc_store(r8, 8/ci, i5, 8/ci)           <>gc_store(r9, 8/ci, i7, 8/ci)
gc_store(r8, 0/ci, 0/ci, 8/ci)         <>gc_store(r9, 0/ci, 0/ci, 8/ci)
jump(descr=<Loop -1, gen=0>)           | jump(descr=<Loop -1, gen=0>)
--------------------------------------------------------------------------------
builder: rpython-win-x86-64 build #402
test: jit/backend/llsupport/test/test_rewrite/py/TestFramework/()/test_rewrite_assembler_newstr_newunicode