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

jit/backend/x86/test/test_ztranslation_external_exception.py::TestTranslationRemoveTypePtrX86::()::test_external_exception_handling_translates

self = <rpython.jit.backend.x86.test.test_ztranslation_external_exception.TestTranslationRemoveTypePtrX86 object at 0x000001a42addbad0>

    def test_external_exception_handling_translates(self):
        jitdriver = JitDriver(greens = [], reds = ['n', 'total'])
    
        class ImDone(Exception):
            def __init__(self, resvalue):
                self.resvalue = resvalue
    
        @dont_look_inside
        def f(x, total):
            if x <= 30:
                raise ImDone(total * 10)
            if x > 200:
                return 2
            raise ValueError
        @dont_look_inside
        def g(x):
            if x > 150:
                raise ValueError
            return 2
        class Base:
            def meth(self):
                return 2
        class Sub(Base):
            def meth(self):
                return 1
        @dont_look_inside
        def h(x):
            if x < 20000:
                return Sub()
            else:
                return Base()
        def myportal(i):
            set_param(jitdriver, "threshold", 3)
            set_param(jitdriver, "trace_eagerness", 2)
            total = 0
            n = i
            while True:
                jitdriver.can_enter_jit(n=n, total=total)
                jitdriver.jit_merge_point(n=n, total=total)
                try:
                    total += f(n, total)
                except ValueError:
                    total += 1
                try:
                    total += g(n)
                except ValueError:
                    total -= 1
                n -= h(n).meth()   # this is to force a GUARD_CLASS
        def main(i):
            try:
                myportal(i)
            except ImDone as e:
                return e.resvalue
    
        # XXX custom fishing, depends on the exact env var and format
        logfile = udir.join('test_ztranslation.log')
        os.environ['PYPYLOG'] = 'jit-log-opt:%s' % (logfile,)
        try:
>           res = self.meta_interp(main, [400])

jit\backend\llsupport\test\ztranslation_test.py:334: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
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 0x000001a43c6ee870>
annotator = <rpython.annotator.annrpython.RPythonAnnotator object at 0x000001a42b214560>

    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 ----------
[platform:msg] Updated environment with vsver 160, using x64 True
[rtyper] -=- specialized 41 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
[rtyper] specializing: 100 / 425 blocks   (23%)
[rtyper] specializing: 200 / 425 blocks   (47%)
[rtyper] specializing: 300 / 478 blocks   (62%)
[rtyper] specializing: 400 / 478 blocks   (83%)
[rtyper] -=- specialized 433 more blocks -=-
[rtyper] specializing: 500 / 504 blocks   (99%)
[rtyper] -=- specialized 26 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 7 more blocks -=-
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] -=- specialized 19 more blocks -=-
[rtyper] -=- specialized 12 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
[backendopt:inlining] inlined 2 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 9 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[rtyper] -=- specialized 3 more blocks -=-
[jitcodewriter:info] making JitCodes...
[jitcodewriter:info] There are 3 JitCode instances.
[jitcodewriter:info] There are 7 -live- ops. Size of liveness is 18 bytes
[jitcodewriter] compute_bitstrings:
[jitcodewriter]   5 effectinfos:
[jitcodewriter]     0 descrs for arrays
[jitcodewriter]     1 descrs for fields
[jitcodewriter]     0 descrs for interiorfields
[jitcodewriter] -> 2 bitstrings, mean length 0.5, max length 1
 (somefailed=True in jit/backend/x86/test/test_ztranslation_external_exception.py)
builder: rpython-win-x86-64 build #814*
test: jit/backend/x86/test/test_ztranslation_external_exception.py::TestTranslationRemoveTypePtrX86::()::test_external_exception_handling_translates