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

jit/metainterp/test/test_jitiface.py::TestJitHookInterface::()::test_trace_next_iteration_hash

self = <rpython.jit.metainterp.test.test_jitiface.TestJitHookInterface object at 0x0000000033d9ba28>

    def test_trace_next_iteration_hash(self):
        driver = JitDriver(greens = ['s'], reds = ['i'], name="name")
        class Hashes(object):
            check = False
    
            def __init__(self):
                self.l = []
                self.t = []
    
        hashes = Hashes()
    
        class Hooks(JitHookInterface):
            def before_compile(self, debug_info):
                pass
    
            def after_compile(self, debug_info):
                for op in debug_info.operations:
                    if op.is_guard():
                        hashes.l.append(op.getdescr().get_jitcounter_hash())
    
            def before_compile_bridge(self, debug_info):
                pass
    
            def after_compile_bridge(self, debug_info):
                hashes.t.append(debug_info.fail_descr.get_jitcounter_hash())
    
        hooks = Hooks()
    
        @dont_look_inside
        def foo():
            if hashes.l:
                for item in hashes.l:
                    jit_hooks.trace_next_iteration_hash("name", item)
    
        def loop(i, s):
            while i > 0:
                driver.jit_merge_point(s=s, i=i)
                foo()
                if i == 3:
                    i -= 1
                i -= 1
    
        def main(s, check):
            hashes.check = check
            loop(10, s)
    
>       self.meta_interp(main, [1, 0], policy=JitPolicy(hooks))

jit/metainterp/test/test_jitiface.py:276: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
jit/metainterp/test/support.py:265: in meta_interp
    return ll_meta_interp(*args, **kwds)
jit/metainterp/warmspot.py:89: in ll_meta_interp
    return jittify_and_run(interp, graph, args, backendopt=backendopt, **kwds)
jit/metainterp/warmspot.py:127: in jittify_and_run
    res = interp.eval_graph(graph, args)
rtyper/llinterp.py:102: in eval_graph
    retval = llframe.eval()
rtyper/llinterp.py:300: in eval
    nextblock, args = self.eval_block(nextblock)
rtyper/llinterp.py:324: in eval_block
    self.eval_operation(op)
rtyper/llinterp.py:427: in eval_operation
    retval = ophandler(*vals)
rtyper/llinterp.py:702: in op_direct_call
    return self.perform_call(f, FTYPE.ARGS, args)
rtyper/llinterp.py:698: in perform_call
    return frame.eval()
rtyper/llinterp.py:300: in eval
    nextblock, args = self.eval_block(nextblock)
rtyper/llinterp.py:324: in eval_block
    self.eval_operation(op)
rtyper/llinterp.py:427: in eval_operation
    retval = ophandler(*vals)
rtyper/llinterp.py:702: in op_direct_call
    return self.perform_call(f, FTYPE.ARGS, args)
rtyper/llinterp.py:689: in perform_call
    return self.invoke_callable_with_pyexceptions(f, *args)
rtyper/llinterp.py:496: in invoke_callable_with_pyexceptions
    return obj._callable(*args)
jit/metainterp/warmspot.py:954: in ll_portal_runner
    portal_ptr)(*args)
jit/codewriter/support.py:163: in on_top_of_llinterp
    return llinterp.eval_graph(funcobj.graph, list(args))
rtyper/llinterp.py:102: in eval_graph
    retval = llframe.eval()
rtyper/llinterp.py:300: in eval
    nextblock, args = self.eval_block(nextblock)
rtyper/llinterp.py:324: in eval_block
    self.eval_operation(op)
rtyper/llinterp.py:427: in eval_operation
    retval = ophandler(*vals)
rtyper/llinterp.py:702: in op_direct_call
    return self.perform_call(f, FTYPE.ARGS, args)
rtyper/llinterp.py:689: in perform_call
    return self.invoke_callable_with_pyexceptions(f, *args)
rtyper/llinterp.py:512: in invoke_callable_with_pyexceptions
    self.make_llexception()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <rpython.rtyper.llinterp.LLFrame object at 0x0000000037d4d408>
exc = OSError("gcc: [Errno 11] Resource temporarily unavailable\nargs=('gcc', ['-c',...ule_cache/module_8.o'], None, '/tmp/pytest/usession-main-3189/module_cache')",)

    def make_llexception(self, exc=None):
        if exc is None:
            original = sys.exc_info()
            exc = original[1]
            # it makes no sense to convert some exception classes that
            # just mean something buggy crashed
            if isinstance(exc, (AssertionError, AttributeError,
                                TypeError, NameError,
                                KeyboardInterrupt, SystemExit,
                                ImportError, SyntaxError)):
                raise original[0], original[1], original[2]     # re-raise it
            # for testing the JIT (see ContinueRunningNormally) we need
            # to let some exceptions introduced by the JIT go through
            # the llinterpreter uncaught
            if getattr(exc, '_go_through_llinterp_uncaught_', False):
                raise original[0], original[1], original[2]     # re-raise it
            extraargs = (original,)
        else:
            extraargs = ()
        typer = self.llinterpreter.typer
        exdata = typer.exceptiondata
        evalue = exdata.get_standard_ll_exc_instance_by_class(exc.__class__)
        etype = self.op_direct_call(exdata.fn_type_of_exc_inst, evalue)
>       raise LLException(etype, evalue, *extraargs)
E       LLException: <LLException 'OSError'
E        | Traceback (most recent call last):
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rtyper/llinterp.py", line 496, in invoke_callable_with_pyexceptions
E        |     return obj._callable(*args)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/jit/metainterp/warmspot.py", line 581, in maybe_enter_jit
E        |     crash_in_jit(e)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/jit/metainterp/warmspot.py", line 579, in maybe_enter_jit
E        |     maybe_compile_and_run(state.increment_threshold, *args)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/jit/metainterp/warmstate.py", line 468, in maybe_compile_and_run
E        |     bound_reached(hash, None, *args)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/jit/metainterp/warmstate.py", line 442, in bound_reached
E        |     metainterp.compile_and_run_once(jitdriver_sd, *args)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/jit/metainterp/pyjitpl.py", line 2890, in compile_and_run_once
E        |     debug_start('jit-tracing')
E        |   File "<13-codegen /buildbot/slave/rpython-linux-x86-64/build/rpython/tool/sourcetools.py:318>", line 5, in debug_start
E        |     return debug_start_original(category, timestamp)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rlib/debug.py", line 135, in debug_start
E        |     return _debug_start(category, timestamp)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rlib/debug.py", line 147, in _debug_start
E        |     ts = read_timestamp()
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rlib/rtimer.py", line 27, in read_timestamp
E        |     x = long(rtime.clock() * 500000000)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rlib/rtime.py", line 262, in clock
E        |     if c_clock_gettime(CLOCK_PROCESS_CPUTIME_ID, a) == 0:
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rtyper/lltypesystem/rffi.py", line 321, in wrapper
E        |     res = call_external_function(*real_args)
E        |   File "<490-codegen /buildbot/slave/rpython-linux-x86-64/build/rpython/rtyper/lltypesystem/rffi.py:264>", line 9, in call_external_function
E        |     rposix._errno_after(1)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rlib/rposix.py", line 192, in _errno_after
E        |     rthread.tlfield_rpy_errno.setraw(_get_errno())
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rtyper/lltypesystem/lltype.py", line 1384, in __call__
E        |     return callb(*args)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rtyper/lltypesystem/ll2ctypes.py", line 1339, in __call__
E        |     self.natural_arity)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/rtyper/lltypesystem/ll2ctypes.py", line 1236, in get_ctypes_callable
E        |     symbolic=True)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/translator/tool/cbuild.py", line 345, in compile_shared_lib
E        |     standalone=False))
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/translator/platform/__init__.py", line 57, in compile
E        |     ofiles = self._compile_o_files(cfiles, eci, standalone)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/translator/platform/__init__.py", line 79, in _compile_o_files
E        |     ofiles.append(self._compile_c_file(self.cc, cfile, compile_args))
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/translator/platform/posix.py", line 44, in _compile_c_file
E        |     cwd=str(cfile.dirpath()))
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/translator/platform/__init__.py", line 142, in _execute_c_compiler
E        |     cwd)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/tool/runsubprocess.py", line 21, in run_subprocess
E        |     return _run(executable, args, env, cwd)
E        |   File "/buildbot/slave/rpython-linux-x86-64/build/rpython/tool/runsubprocess.py", line 115, in _run
E        |     raise OSError('%s: %s\nargs=%r' % (args[0], results[1], args))
E        | OSError: gcc: [Errno 11] Resource temporarily unavailable
E        | args=('gcc', ['-c', '-O3', '-pthread', '-fomit-frame-pointer', '-Wall', '-Wno-unused', '-Wno-address', '-Wno-discarded-qualifiers', '-Wno-duplicate-decl-specifier', '-fPIC', '-fvisibility=hidden', '-g', '-O0', '-DRPY_EXTERN=RPY_EXPORTED', '-DRPYTHON_LL2CTYPES', '-I/usr/local/include', '/tmp/pytest/usession-main-3189/module_cache/module_8.c', '-o', '/tmp/pytest/usession-main-3189/module_cache/module_8.o'], None, '/tmp/pytest/usession-main-3189/module_cache')
E        `------>

rtyper/llinterp.py:491: LLException
---------- Captured stdout call ----------
~~~ Crash in JIT!
~~~ <type 'exceptions.OSError'>: gcc: [Errno 11] Resource temporarily unavailable
args=('gcc', ['-c', '-O3', '-pthread', '-fomit-frame-pointer', '-Wall', '-Wno-unused', '-Wno-address', '-Wno-discarded-qualifiers', '-Wno-duplicate-decl-specifier', '-fPIC', '-fvisibility=hidden', '-g', '-O0', '-DRPY_EXTERN=RPY_EXPORTED', '-DRPYTHON_LL2CTYPES', '-I/usr/local/include', '/tmp/pytest/usession-main-3189/module_cache/module_8.c', '-o', '/tmp/pytest/usession-main-3189/module_cache/module_8.o'], None, '/tmp/pytest/usession-main-3189/module_cache')
---------- Captured stderr call ----------
[rtyper] -=- specialized 12 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 1 JitCode instances.
[jitcodewriter:info] There are 5 -live- ops. Size of liveness is 4 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
builder: rpython-linux-x86-64 build #948+
test: jit/metainterp/test/test_jitiface.py::TestJitHookInterface::()::test_trace_next_iteration_hash