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

jit/backend/aarch64/test/test_ztranslation_call_assembler.py::TestTranslationCallAssemblerAarch64::()::test_direct_assembler_call_translates

self = <rpython.jit.backend.aarch64.test.test_ztranslation_call_assembler.TestTranslationCallAssemblerAarch64 object at 0x000000000e727788>

    def test_direct_assembler_call_translates(self):
        """Test CALL_ASSEMBLER and the recursion limit"""
        # - also tests threadlocalref_get
        from rpython.rlib.rstackovf import StackOverflow
    
        class Thing(object):
            def __init__(self, val):
                self.val = val
    
        class Frame(object):
            _virtualizable_ = ['thing']
    
        driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
                           virtualizables = ['frame'],
                           get_printable_location = lambda codeno: str(codeno))
        class SomewhereElse(object):
            pass
    
        somewhere_else = SomewhereElse()
    
        class Foo(object):
            pass
        t = ThreadLocalReference(Foo, loop_invariant=True)
        tf = ThreadLocalField(lltype.Char, "test_call_assembler_")
    
        def change(newthing):
            somewhere_else.frame.thing = newthing
    
        def main(codeno):
            frame = Frame()
            somewhere_else.frame = frame
            frame.thing = Thing(0)
            portal(codeno, frame)
            return frame.thing.val
    
        def portal(codeno, frame):
            i = 0
            while i < 10:
                driver.can_enter_jit(frame=frame, codeno=codeno, i=i)
                driver.jit_merge_point(frame=frame, codeno=codeno, i=i)
                nextval = frame.thing.val
                if codeno == 0:
                    subframe = Frame()
                    subframe.thing = Thing(nextval)
                    nextval = portal(1, subframe)
                elif frame.thing.val > 40:
                    change(Thing(13))
                    nextval = 13
                frame.thing = Thing(nextval + 1)
                i += 1
                if t.get().nine != 9: raise ValueError
                if ord(tf.getraw()) != 0x92: raise ValueError
            return frame.thing.val
    
        driver2 = JitDriver(greens = [], reds = ['n'])
    
        def main2(bound):
            try:
                while portal2(bound) == -bound+1:
                    bound *= 2
            except StackOverflow:
                pass
            return bound
    
        def portal2(n):
            while True:
                driver2.jit_merge_point(n=n)
                n -= 1
                if n <= 0:
                    return n
                n = portal2(n)
        assert portal2(10) == -9
    
        def setup(value):
            foo = Foo()
            foo.nine = value
            t.set(foo)
            tf.setraw("\x92")
            return foo
    
        def mainall(codeno, bound):
            foo = setup(bound + 8)
            result = main(codeno) + main2(bound)
            keepalive_until_here(foo)
            return result
    
        tmp_obj = setup(9)
        expected_1 = main(0)
        res = self.meta_interp(mainall, [0, 1], inline=True,
>                              policy=StopAtXPolicy(change))

jit/backend/llsupport/test/ztranslation_test.py:223: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
jit/backend/test/support.py:73: in meta_interp
    warmrunnerdesc.finish()
jit/metainterp/warmspot.py:298: in finish
    self.annhelper.finish()
rtyper/annlowlevel.py:219: in finish
    self.finish_rtype()
rtyper/annlowlevel.py:254: in finish_rtype
    perform_normalizations(rtyper.annotator)
rtyper/normalizecalls.py:408: in perform_normalizations
    normalize_call_familes(annotator)
rtyper/normalizecalls.py:19: in normalize_call_familes
    normalize_calltable(annotator, callfamily)
rtyper/normalizecalls.py:33: in normalize_calltable
    raise_call_table_too_complex_error(callfamily, annotator)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

callfamily = <rpython.annotator.description.CallFamily object at 0x000000002766dfa0>
annotator = <rpython.annotator.annrpython.RPythonAnnotator object at 0x00000000101b6aa0>

    def raise_call_table_too_complex_error(callfamily, annotator):
        msg = []
        items = callfamily.calltables.items()
        for i, (shape1, table1) in enumerate(items):
            for shape2, table2 in items[i + 1:]:
                if shape1 == shape2:
                    continue
                row1 = table1[0]
                row2 = table2[0]
                problematic_function_graphs = set(row1.values()).union(set(row2.values()))
                pfg = [str(graph) for graph in problematic_function_graphs]
                pfg.sort()
                msg.append("the following functions:")
                msg.append("    %s" % ("\n    ".join(pfg), ))
                msg.append("are called with inconsistent numbers of arguments")
                msg.append("(and/or the argument names are different, which is"
                           " not supported in this case)")
                if shape1[0] != shape2[0]:
                    msg.append("sometimes with %s arguments, sometimes with %s" % (shape1[0], shape2[0]))
                else:
                    pass # XXX better message in this case
                callers = []
                msg.append("the callers of these functions are:")
                for tag, (caller, callee) in annotator.translator.callgraph.iteritems():
                    if callee not in problematic_function_graphs:
                        continue
                    if str(caller) in callers:
                        continue
                    callers.append(str(caller))
                callers.sort()
                for caller in callers:
                    msg.append("    %s" % (caller, ))
>       raise TyperError("\n".join(msg))
E       TyperError: the following functions:
E           (rpython.jit.metainterp.optimizeopt.info:120)NonNullPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:336)InstancePtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:360)StructPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:379)AbstractRawPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:632)ArrayPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:716)ConstPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:83)PtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:862)FloatConstInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.intutils:1264)IntBound.make_guards
E           (rpython.jit.metainterp.optimizeopt.vstring:121)StrPtrInfo.make_guards
E       are called with inconsistent numbers of arguments
E       (and/or the argument names are different, which is not supported in this case)
E       the callers of these functions are:
E           (rpython.jit.metainterp.optimizeopt.info:336)InstancePtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:632)ArrayPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.shortpreamble:382)AbstractShortPreambleBuilder.use_box
E           (rpython.jit.metainterp.optimizeopt.virtualstate:483)NotVirtualStateInfoInt._generate_guards_unkown
E           (rpython.jit.metainterp.optimizeopt.vstring:121)StrPtrInfo.make_guards

rtyper/normalizecalls.py:76: TyperError
---------- Captured stderr call ----------
[rtyper] -=- specialized 78 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
[rtyper] specializing: 100 / 369 blocks   (27%)
[rtyper] specializing: 200 / 435 blocks   (45%)
[rtyper] specializing: 300 / 488 blocks   (61%)
[rtyper] specializing: 400 / 488 blocks   (81%)
[rtyper] -=- specialized 406 more blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] specializing: 500 / 501 blocks   (99%)
[rtyper] -=- specialized 7 more blocks -=-
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] -=- specialized 17 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
[backendopt:inlining] inlined 11 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 0 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[rtyper] -=- specialized 6 more blocks -=-
[jitcodewriter:info] making JitCodes...
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[jitcodewriter:info] There are 4 JitCode instances.
[jitcodewriter:info] There are 19 -live- ops. Size of liveness is 29 bytes
[rtyper] replaced 8 'jit_force_virtualizable' with <* delayed!force_virtualizable_if_necessary>
[jitcodewriter] compute_bitstrings:
[jitcodewriter]   5 effectinfos:
[jitcodewriter]     0 descrs for arrays
[jitcodewriter]     2 descrs for fields
[jitcodewriter]     0 descrs for interiorfields
[jitcodewriter] -> 3 bitstrings, mean length 0.7, max length 1
 (somefailed=True in jit/backend/aarch64/test/test_ztranslation_call_assembler.py)
builder: rpython-linux-aarch64 build #814*
test: jit/backend/aarch64/test/test_ztranslation_call_assembler.py::TestTranslationCallAssemblerAarch64::()::test_direct_assembler_call_translates