Exemple #1
0
from rpython.jit.metainterp.resoperation import opname

for name in opname.values():
    name = name.lower()
    if not name.startswith('guard') and name != 'debug_merge_point':
        print '"%s"' % name,

Exemple #2
0
def _make_execute_list():
    execute_by_num_args = {}
    for key in opname.values():
        value = getattr(rop, key)
        if not key.startswith('_'):
            if (rop._FINAL_FIRST <= value <= rop._FINAL_LAST
                    or rop._GUARD_FIRST <= value <= rop._GUARD_LAST):
                continue
            # find which list to store the operation in, based on num_args
            num_args = resoperation.oparity[value]
            withdescr = resoperation.opwithdescr[value]
            dictkey = num_args, withdescr
            if dictkey not in execute_by_num_args:
                execute_by_num_args[dictkey] = [None] * (rop._LAST + 1)
            execute = execute_by_num_args[dictkey]
            #
            if execute[value] is not None:
                raise AssertionError("duplicate entry for op number %d" %
                                     value)
            #
            # Fish for a way for the pyjitpl interpreter to delegate
            # really running the operation to the blackhole interpreter
            # or directly to the cpu.  First try the do_xxx() functions
            # explicitly encoded above:
            name = 'do_' + key.lower()
            if name in globals():
                execute[value] = globals()[name]
                continue
            #
            # Maybe the same without the _PURE suffix?
            if key[-7:-2] == '_PURE':
                key = key[:-7] + key[-2:]
                name = 'do_' + key.lower()
                if name in globals():
                    execute[value] = globals()[name]
                    continue
            #
            # If missing, fallback to the bhimpl_xxx() method of the
            # blackhole interpreter.  This only works if there is a
            # method of the exact same name and it accepts simple
            # parameters.
            name = 'bhimpl_' + key.lower()
            if hasattr(BlackholeInterpreter, name):
                func = make_execute_function(
                    key.lower(),
                    getattr(BlackholeInterpreter, name).im_func)
                if func is not None:
                    execute[value] = func
                    continue
            if value in (
                    rop.FORCE_TOKEN,
                    rop.CALL_ASSEMBLER_R,
                    rop.CALL_ASSEMBLER_F,
                    rop.CALL_ASSEMBLER_I,
                    rop.CALL_ASSEMBLER_N,
                    rop.INCREMENT_DEBUG_COUNTER,
                    rop.COND_CALL_VALUE_R,
                    rop.COND_CALL_VALUE_I,
                    rop.COND_CALL_GC_WB,
                    rop.COND_CALL_GC_WB_ARRAY,
                    rop.ZERO_ARRAY,
                    rop.DEBUG_MERGE_POINT,
                    rop.JIT_DEBUG,
                    rop.ENTER_PORTAL_FRAME,
                    rop.LEAVE_PORTAL_FRAME,
                    rop.SETARRAYITEM_RAW,
                    rop.SETINTERIORFIELD_RAW,
                    rop.CALL_RELEASE_GIL_I,
                    rop.CALL_RELEASE_GIL_F,
                    rop.CALL_RELEASE_GIL_N,
                    rop.QUASIIMMUT_FIELD,
                    rop.CHECK_MEMORY_ERROR,
                    rop.CALL_MALLOC_NURSERY,
                    rop.CALL_MALLOC_NURSERY_VARSIZE,
                    rop.CALL_MALLOC_NURSERY_VARSIZE_FRAME,
                    rop.NURSERY_PTR_INCREMENT,
                    rop.LABEL,
                    rop.ESCAPE_I,
                    rop.ESCAPE_N,
                    rop.ESCAPE_R,
                    rop.ESCAPE_F,
                    rop.FORCE_SPILL,
                    rop.SAVE_EXC_CLASS,
                    rop.SAVE_EXCEPTION,
                    rop.RESTORE_EXCEPTION,
                    rop.VEC_LOAD_I,
                    rop.VEC_LOAD_F,
                    rop.GC_LOAD_I,
                    rop.GC_LOAD_R,
                    rop.GC_LOAD_F,
                    rop.GC_LOAD_INDEXED_R,
                    rop.VEC_STORE,
                    rop.GC_STORE,
                    rop.GC_STORE_INDEXED,
                    rop.LOAD_FROM_GC_TABLE,
                    rop.LOAD_EFFECTIVE_ADDRESS,
            ):  # list of opcodes never executed by pyjitpl
                continue
            if rop._VEC_PURE_FIRST <= value <= rop._VEC_PURE_LAST:
                continue

            raise AssertionError("missing %r" % (key, ))
    return execute_by_num_args
Exemple #3
0
def _make_execute_list():
    execute_by_num_args = {}
    for key in opname.values():
        value = getattr(rop, key)
        if not key.startswith('_'):
            if (rop._FINAL_FIRST <= value <= rop._FINAL_LAST or
                rop._GUARD_FIRST <= value <= rop._GUARD_LAST):
                continue
            # find which list to store the operation in, based on num_args
            num_args = resoperation.oparity[value]
            withdescr = resoperation.opwithdescr[value]
            dictkey = num_args, withdescr
            if dictkey not in execute_by_num_args:
                execute_by_num_args[dictkey] = [None] * (rop._LAST+1)
            execute = execute_by_num_args[dictkey]
            #
            if execute[value] is not None:
                raise AssertionError("duplicate entry for op number %d"% value)
            #
            # Fish for a way for the pyjitpl interpreter to delegate
            # really running the operation to the blackhole interpreter
            # or directly to the cpu.  First try the do_xxx() functions
            # explicitly encoded above:
            name = 'do_' + key.lower()
            if name in globals():
                execute[value] = globals()[name]
                continue
            #
            # Maybe the same without the _PURE suffix?
            if key[-7:-2] == '_PURE':
                key = key[:-7] + key[-2:]
                name = 'do_' + key.lower()
                if name in globals():
                    execute[value] = globals()[name]
                    continue
            #
            # If missing, fallback to the bhimpl_xxx() method of the
            # blackhole interpreter.  This only works if there is a
            # method of the exact same name and it accepts simple
            # parameters.
            name = 'bhimpl_' + key.lower()
            if hasattr(BlackholeInterpreter, name):
                func = make_execute_function(
                    key.lower(),
                    getattr(BlackholeInterpreter, name).im_func)
                if func is not None:
                    execute[value] = func
                    continue
            if value in (rop.FORCE_TOKEN,
                         rop.CALL_ASSEMBLER_R,
                         rop.CALL_ASSEMBLER_F,
                         rop.CALL_ASSEMBLER_I,
                         rop.CALL_ASSEMBLER_N,
                         rop.INCREMENT_DEBUG_COUNTER,
                         rop.COND_CALL_VALUE_R,
                         rop.COND_CALL_VALUE_I,
                         rop.COND_CALL_GC_WB,
                         rop.COND_CALL_GC_WB_ARRAY,
                         rop.ZERO_ARRAY,
                         rop.DEBUG_MERGE_POINT,
                         rop.JIT_DEBUG,
                         rop.ENTER_PORTAL_FRAME,
                         rop.LEAVE_PORTAL_FRAME,
                         rop.SETARRAYITEM_RAW,
                         rop.SETINTERIORFIELD_RAW,
                         rop.CALL_RELEASE_GIL_I,
                         rop.CALL_RELEASE_GIL_F,
                         rop.CALL_RELEASE_GIL_N,
                         rop.QUASIIMMUT_FIELD,
                         rop.CHECK_MEMORY_ERROR,
                         rop.CALL_MALLOC_NURSERY,
                         rop.CALL_MALLOC_NURSERY_VARSIZE,
                         rop.CALL_MALLOC_NURSERY_VARSIZE_FRAME,
                         rop.NURSERY_PTR_INCREMENT,
                         rop.LABEL,
                         rop.ESCAPE_I,
                         rop.ESCAPE_N,
                         rop.ESCAPE_R,
                         rop.ESCAPE_F,
                         rop.FORCE_SPILL,
                         rop.SAVE_EXC_CLASS,
                         rop.SAVE_EXCEPTION,
                         rop.RESTORE_EXCEPTION,
                         rop.VEC_LOAD_I,
                         rop.VEC_LOAD_F,
                         rop.GC_LOAD_I,
                         rop.GC_LOAD_R,
                         rop.GC_LOAD_F,
                         rop.GC_LOAD_INDEXED_R,
                         rop.VEC_STORE,
                         rop.GC_STORE,
                         rop.GC_STORE_INDEXED,
                         rop.LOAD_FROM_GC_TABLE,
                         ):      # list of opcodes never executed by pyjitpl
                continue
            if rop._VEC_PURE_FIRST <= value <= rop._VEC_PURE_LAST:
                continue

            raise AssertionError("missing %r" % (key,))
    return execute_by_num_args