) version = 2.6 version_tuple = (2, 6) python_implementation = "PyPy" l = locals() init_opdata(l, opcode_26, version_tuple, is_pypy=True) # FIXME: DRY common PYPY opcode additions # fmt: off # PyPy only # ---------- name_op(l, 'LOOKUP_METHOD', 201, 1, 2) nargs_op(l, 'CALL_METHOD', 202, -1, 1) # fmt: on l["hasnargs"].append(202) # Used only in single-mode compilation list-comprehension generators varargs_op(l, "BUILD_LIST_FROM_ARG", 203) # Used only in assert statements jrel_op(l, "JUMP_IF_NOT_DEBUG", 204, conditional=True) # FIXME remove (fix uncompyle6) update_pj2(globals(), l) finalize_opcodes(l)
name_op(l, "LOAD_GLOBAL", 116, 0, 1) # Operand is in name list jrel_op(l, "SETUP_LOOP", 120, 0, 0, conditional=True) # Distance to target address jrel_op(l, "SETUP_EXCEPT", 121, 0, 0) # "" jrel_op(l, "SETUP_FINALLY", 122, 0, 0) # "" local_op(l, "LOAD_FAST", 124, 0, 1) # Local variable number store_op(l, "STORE_FAST", 125, 1, 0, is_type="local") # Local variable number local_op(l, "DELETE_FAST", 126) # Local variable number def_op(l, "SET_LINENO", 127) # Current line number def_op(l, "RAISE_VARARGS", 130, -1, 0, fallthrough=False) # Number of raise arguments (1, 2, or 3) nargs_op(l, "CALL_FUNCTION", 131, -1, 1) # #args + (#kwargs << 8) def_op(l, "MAKE_FUNCTION", 132, -1, 1) # Number of args with default values varargs_op(l, "BUILD_SLICE", 133, -1, 1) # Number of items def_op(l, "EXTENDED_ARG", 143) EXTENDED_ARG = 143 fields2copy = """cmp_op hasjabs""".split() update_pj2(globals(), l) opcode_arg_fmt = {"EXTENDED_ARG": format_extended_arg} finalize_opcodes(l)
def_op(l, "POP_BLOCK", 87, 0, 0) def_op(l, "END_FINALLY", 88, 1, 0) def_op(l, "BUILD_CLASS", 89, 2, 0) HAVE_ARGUMENT = 90 # Opcodes from here have an argument: store_op(l, "STORE_NAME", 90, 1, 0, is_type="name") # Operand is in name list name_op(l, "DELETE_NAME", 91, 0, 0) # "" varargs_op(l, "UNPACK_SEQUENCE", 92, -1, 1) # TOS is number of tuple items jrel_op(l, "FOR_ITER", 93, 0, 1) # TOS is read store_op(l, "STORE_ATTR", 95, 2, 0, is_type="name") # Operand is in name list name_op(l, "DELETE_ATTR", 96, 1, 0) # "" store_op(l, "STORE_GLOBAL", 97, 1, 0, is_type="name") # "" name_op(l, "DELETE_GLOBAL", 98, 0, 0) # "" nargs_op(l, "DUP_TOPX", 99, -1, 2) # number of items to duplicate const_op(l, "LOAD_CONST", 100, 0, 1) # Operand is in const list name_op(l, "LOAD_NAME", 101, 0, 1) # Operand is in name list varargs_op(l, "BUILD_TUPLE", 102, -1, 1) # TOS is number of tuple items varargs_op(l, "BUILD_LIST", 103, -1, 1) # TOS is number of list items varargs_op(l, "BUILD_MAP", 104, 0, 1) # TOS is number of kwarg items. Always zero for now name_op(l, "LOAD_ATTR", 105, 1, 1) # Operand is in name list compare_op(l, "COMPARE_OP", 106, 2, 1) # Comparison operator name_op(l, "IMPORT_NAME", 107, 2, 2) # Imports TOS and TOS1; module pushed name_op(l, "IMPORT_FROM", 108, 0, 1) # Operand is in name list jrel_op(l, "JUMP_FORWARD", 110, 0, 0, fallthrough=False) # Number of bytes to skip jrel_op(l, "JUMP_IF_FALSE", 111, 1, 1, True) # ""
name_op(l, 'LOAD_GLOBAL', 116, 0, 1) # Operand is in name list jrel_op(l, 'SETUP_LOOP', 120, 0, 0, conditional=True) # Distance to target address jrel_op(l, 'SETUP_EXCEPT', 121, 0, 0) # "" jrel_op(l, 'SETUP_FINALLY', 122, 0, 0) # "" local_op(l, 'LOAD_FAST', 124, 0, 1) # Local variable number local_op(l, 'STORE_FAST', 125, 1, 0) # Local variable number local_op(l, 'DELETE_FAST', 126) # Local variable number def_op(l, 'SET_LINENO', 127) # Current line number def_op(l, 'RAISE_VARARGS', 130, -1, 0, fallthrough=False) # Number of raise arguments (1, 2, or 3) nargs_op(l, 'CALL_FUNCTION', 131, -1, 1) # #args + (#kwargs << 8) def_op(l, 'MAKE_FUNCTION', 132, -1, 1) # Number of args with default values varargs_op(l, 'BUILD_SLICE', 133, -1, 1) # Number of items def_op(l, 'EXTENDED_ARG', 143) EXTENDED_ARG = 143 fields2copy = """cmp_op hasjabs""".split() update_pj2(globals(), l) opcode_arg_fmt = { 'EXTENDED_ARG': format_extended_arg, }
0) # Target byte offset from beginning of code name_op(l, 'LOAD_GLOBAL', 116, 0, 1) # Operand is in name list jabs_op(l, 'CONTINUE_LOOP', 119, 0, 0) # Target address jrel_op(l, 'SETUP_LOOP', 120, 0, 0) # Distance to target address jrel_op(l, 'SETUP_EXCEPT', 121, 0, 0) # "" jrel_op(l, 'SETUP_FINALLY', 122, 0, 0) # "" local_op(l, 'LOAD_FAST', 124, 0, 1) # Local variable number local_op(l, 'STORE_FAST', 125, 1, 0) # Local variable number local_op(l, 'DELETE_FAST', 126) # Local variable number def_op(l, 'RAISE_VARARGS', 130, -1, 0) # Number of raise arguments (1, 2, or 3) nargs_op(l, 'CALL_FUNCTION', 131, -1, 1) # #args + (#kwargs << 8) def_op(l, 'MAKE_FUNCTION', 132, -1, 1) # Number of args with default values varargs_op(l, 'BUILD_SLICE', 133, -1, 1) # Number of items def_op(l, 'MAKE_CLOSURE', 134, -1, 1) free_op(l, 'LOAD_CLOSURE', 135, 0, 1) free_op(l, 'LOAD_DEREF', 136, 0, 1) free_op(l, 'STORE_DEREF', 137, 1, 0) nargs_op(l, 'CALL_FUNCTION_VAR', 140, -1, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_KW', 141, -1, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_VAR_KW', 142, -1, 1) # #args + (#kwargs << 8) def_op(l, 'EXTENDED_ARG', 143) EXTENDED_ARG = 143
# and STORE_ANNOTATION introduced in 3.6! rm_op(l, "STORE_ANNOTATION", 127) # These have a changed stack effect since 3.6 # OP NAME OPCODE POP PUSH #--------------------------------------------------------------- def_op(l, "WITH_CLEANUP_START", 81, 0, 2) def_op(l, "WITH_CLEANUP_FINISH", 82, 3, 0) def_op(l, "END_FINALLY", 88, 6, 0) def_op(l, "POP_EXCEPT", 89, 3, 0) # Pops last 3 values jrel_op(l, "SETUP_WITH", 143, 0, 6) jrel_op(l, "SETUP_ASYNC_WITH", 154, 0, 5) # These are new since Python 3.7 name_op(l, "LOAD_METHOD", 160, 0, 1) nargs_op(l, "CALL_METHOD", 161, -2, 1) format_MAKE_FUNCTION_flags = opcode_36.format_MAKE_FUNCTION_flags format_value_flags = opcode_36.format_value_flags def extended_format_RAISE_VARARGS(opc, instructions): raise_inst = instructions[0] assert raise_inst.opname == "RAISE_VARARGS" argc = raise_inst.argval if argc == 0: return "reraise" elif argc == 1: instance_arg = resolved_attrs(instructions[1:]) if instance_arg: return "instance_arg" return format_RAISE_VARARGS(raise_inst.argval)
import xdis.opcodes.opcode_37 as opcode_37 from xdis.opcodes.opcode_37 import ( format_MAKE_FUNCTION_flags, ) l = locals() init_opdata(l, opcode_37, version_tuple, is_pypy=True) # FIXME: DRY common PYPY opcode additions # fmt: off rm_op(l, "BUILD_TUPLE_UNPACK_WITH_CALL", 158) rm_op(l, "LOAD_METHOD", 160) nargs_op(l, "CALL_FUNCTION_KW", 141, 9, 1) # #args + (#kwargs << 8) nargs_op(l, "CALL_FUNCTION_EX", 142, -2, 1) # The following were removed from 3.7 but still in Pypy 3.7 store_op(l, 'STORE_ANNOTATION', 127, 1, 0, is_type="name") # PyPy only # ---------- name_op(l, "LOOKUP_METHOD", 201, 1, 2) l["hasvargs"].append(202) nargs_op(l, "CALL_METHOD_KW", 204, -1, 1) # Used only in single-mode compilation list-comprehension generators
nargs_op, finalize_opcodes, format_CALL_FUNCTION_pos_name_encoded, format_MAKE_FUNCTION_default_argc, format_extended_arg, update_pj2, ) version = 1.6 python_implementation = "CPython" l = locals() init_opdata(l, opcode_15, version) # 1.6 Bytecodes not in 1.5 nargs_op(l, "CALL_FUNCTION_VAR", 140, -1, 1) # #args + (#kwargs << 8) nargs_op(l, "CALL_FUNCTION_KW", 141, -1, 1) # #args + (#kwargs << 8) nargs_op(l, "CALL_FUNCTION_VAR_KW", 142, -1, 1) # #args + (#kwargs << 8) update_pj2(globals(), l) opcode_arg_fmt = {"EXTENDED_ARG": format_extended_arg} opcode_arg_fmt = { "EXTENDED_ARG": format_extended_arg, "CALL_FUNCTION": format_CALL_FUNCTION_pos_name_encoded, "CALL_FUNCTION_KW": format_CALL_FUNCTION_pos_name_encoded, "CALL_FUNCTION_VAR_KW": format_CALL_FUNCTION_pos_name_encoded, "MAKE_FUNCTION": format_MAKE_FUNCTION_default_argc, }
# These are removed since 3.7... rm_op(l, "BREAK_LOOP", 80) rm_op(l, "CONTINUE_LOOP", 119) rm_op(l, "SETUP_LOOP", 120) rm_op(l, "SETUP_EXCEPT", 121) # These are new/changed since Python 3.7 # OP NAME OPCODE POP PUSH # -------------------------------------------- def_op(l, "ROT_FOUR", 6, 4, 4) # Opcode number changed from 5 to 6. Why? def_op(l, "BEGIN_FINALLY", 53, 0, 6) def_op(l, "END_ASYNC_FOR", 54, 7, 0) # POP is 0, when not 7 def_op(l, "END_FINALLY", 88, 6, 0) # POP is 6, when not 1 jrel_op(l, "CALL_FINALLY", 162, 0, 1) nargs_op(l, "POP_FINALLY", 163, 6, 0) # PUSH/POP vary format_value_flags = opcode_37.format_value_flags opcode_arg_fmt = { "BUILD_MAP_UNPACK_WITH_CALL": format_BUILD_MAP_UNPACK_WITH_CALL, "CALL_FUNCTION_EX": format_CALL_FUNCTION_EX, "CALL_FUNCTION_KW": format_CALL_FUNCTION_KW, "EXTENDED_ARG": format_extended_arg36, "FORMAT_VALUE": format_value_flags, "MAKE_FUNCTION": format_MAKE_FUNCTION_flags, "RAISE_VARARGS": opcode_37.format_RAISE_VARARGS } opcode_extended_fmt = { "CALL_FUNCTION": extended_format_CALL_FUNCTION,
# These are removed since 3.7... rm_op(l, 'BREAK_LOOP', 80) rm_op(l, 'CONTINUE_LOOP', 119) rm_op(l, 'SETUP_LOOP', 120) rm_op(l, 'SETUP_EXCEPT', 121) # These are new since Python 3.7 # OP NAME OPCODE POP PUSH #-------------------------------------------- def_op(l, 'ROT_FOUR', 6, 4, 4) def_op(l, 'BEGIN_FINALLY', 53, 0, 1) def_op(l, 'END_ASYNC_FOR', 54, 7, 0) # POP is 0, when not 7 def_op(l, 'END_FINALLY', 88, 1, 0) # POP is 6, when not 1 jrel_op(l, 'CALL_FINALLY', 162, 0, 1) nargs_op(l, 'POP_FINALLY', 163, 0, 0) # PUSH/POP vary format_MAKE_FUNCTION_arg = opcode_37.format_MAKE_FUNCTION_arg format_value_flags = opcode_37.format_value_flags opcode_arg_fmt = { 'MAKE_FUNCTION': format_MAKE_FUNCTION_arg, 'FORMAT_VALUE': format_value_flags, 'EXTENDED_ARG': format_extended_arg36 } update_pj3(globals(), l) finalize_opcodes(l)
from xdis.opcodes.opcode_3x import format_MAKE_FUNCTION_arg import xdis.opcodes.opcode_36 as opcode_36 l = locals() init_opdata(l, opcode_36, version, is_pypy=True) ## FIXME: DRY common PYPY opcode additions # Opcodes removed from 3.6. rm_op(l, "CALL_FUNCTION_EX", 142) rm_op(l, "BUILD_TUPLE_UNPACK_WITH_CALL", 158) # The following were removed from 3.6 but still in Pypy 3.6 def_op(l, "MAKE_CLOSURE", 134, 9, 1) # TOS is number of items to pop nargs_op(l, "CALL_FUNCTION_VAR", 140, 9, 1) # #args + (#kwargs << 8) nargs_op(l, "CALL_FUNCTION_KW", 141, 9, 1) # #args + (#kwargs << 8) nargs_op(l, "CALL_FUNCTION_VAR_KW", 142, 9, 1) # #args + (#kwargs << 8) # PyPy only # ---------- name_op(l, "LOOKUP_METHOD", 201, 1, 2) nargs_op(l, "CALL_METHOD", 202, -1, 1) l["hasvargs"].append(202) # Used only in single-mode compilation list-comprehension generators varargs_op(l, "BUILD_LIST_FROM_ARG", 203) # Used only in assert statements
import xdis.opcodes.opcode_36 as opcode_36 l = locals() init_opdata(l, opcode_36, version, is_pypy=True) ## FIXME: DRY common PYPY opcode additions # Opcodes removed from 3.6. rm_op(l, 'CALL_FUNCTION_EX', 142) rm_op(l, 'BUILD_TUPLE_UNPACK_WITH_CALL', 158) # The following were removed from 3.6 but still in Pypy 3.6 def_op(l, 'MAKE_CLOSURE', 134, 9, 1) # TOS is number of items to pop nargs_op(l, 'CALL_FUNCTION_VAR', 140, 9, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_KW', 141, 9, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_VAR_KW',142, 9, 1) # #args + (#kwargs << 8) # PyPy only # ---------- def_op(l, 'FORMAT_VALUE', 155) def_op(l, 'BUILD_STRING', 157) name_op(l, 'LOOKUP_METHOD', 201, 1, 2) nargs_op(l, 'CALL_METHOD', 202, -1, 1) l['hasvargs'].append(202) # Used only in single-mode compilation list-comprehension generators varargs_op(l, 'BUILD_LIST_FROM_ARG', 203)
def_op(l, 'FOR_LOOP', 114) # Number of bytes to skip name_op(l, 'LOAD_GLOBAL', 116, 0, 1) # Operand is in name list jrel_op(l, 'SETUP_LOOP', 120, 0, 0) # Distance to target address jrel_op(l, 'SETUP_EXCEPT', 121, 0, 0) # "" jrel_op(l, 'SETUP_FINALLY', 122, 0, 0) # "" local_op(l, 'LOAD_FAST', 124, 0, 1) # Local variable number local_op(l, 'STORE_FAST', 125, 1, 0) # Local variable number local_op(l, 'DELETE_FAST', 126) # Local variable number def_op(l, 'SET_LINENO', 127) # Current line number def_op(l, 'RAISE_VARARGS', 130, -1, 0) # Number of raise arguments (1, 2, or 3) nargs_op(l, 'CALL_FUNCTION', 131, -1, 1) # #args + (#kwargs << 8) def_op(l, 'MAKE_FUNCTION', 132, -1, 1) # Number of args with default values varargs_op(l, 'BUILD_SLICE', 133, -1, 1) # Number of items def_op(l, 'EXTENDED_ARG', 143) EXTENDED_ARG = 143 fields2copy = """cmp_op hasjabs""".split() update_pj2(globals(), l) opcode_arg_fmt = { 'EXTENDED_ARG': format_extended_arg, }
# This is a different opcode from before. # The tuple of default values for positional-or-keyword parameters, # the dict of default values for keyword-only parameters, the dict of # annotations and the closure are pushed on the stack if corresponding # bit (0-3) is set. They are followed by the code object and the # qualified name of the function. # These are new since Python 3.6 name_op(l, 'STORE_ANNOTATION', 127) # Index in name list jrel_op(l, 'SETUP_ASYNC_WITH', 154) def_op(l, 'FORMAT_VALUE', 155) varargs_op(l, 'BUILD_CONST_KEY_MAP', 156, -1, 1) # TOS is count of kwargs nargs_op(l, 'CALL_FUNCTION_EX', 142, -1, 1) def_op(l, 'SETUP_ANNOTATIONS', 85) def_op(l, 'BUILD_STRING', 157) def_op(l, 'BUILD_TUPLE_UNPACK_WITH_CALL', 158) MAKE_FUNCTION_FLAGS = tuple("default keyword-only annotation closure".split()) def format_MAKE_FUNCTION_arg(flags): pattr = '' for flag in MAKE_FUNCTION_FLAGS: bit = flags & 1 if bit: if pattr: pattr += ", " + flag else: pattr = flag
# and STORE_ANNOTATION introduced in 3.6! rm_op(l, 'STORE_ANNOTATION', 127) # These have a changed stack effect since 3.6 # OP NAME OPCODE POP PUSH #--------------------------------------------------------------- def_op(l, 'WITH_CLEANUP_START', 81, 0, 2) def_op(l, 'WITH_CLEANUP_FINISH', 82, 3, 0) def_op(l, 'END_FINALLY', 88, 6, 0) def_op(l, 'POP_EXCEPT', 89, 3, 0) # Pops last 3 values jrel_op(l, 'SETUP_WITH', 143, 0, 6) jrel_op(l, 'SETUP_ASYNC_WITH', 154, 0, 5) # These are new since Python 3.7 name_op(l, 'LOAD_METHOD', 160, 0, 1) nargs_op(l, 'CALL_METHOD', 161, -2, 1) format_MAKE_FUNCTION_arg = opcode_36.format_MAKE_FUNCTION_arg format_value_flags = opcode_36.format_value_flags opcode_arg_fmt = { 'CALL_FUNCTION': opcode_36.format_CALL_FUNCTION, 'CALL_FUNCTION_KW': opcode_36.format_CALL_FUNCTION_KW, 'CALL_FUNCTION_EX': opcode_36.format_CALL_FUNCTION_EX, 'CALL_METHOD': opcode_36.format_CALL_FUNCTION, 'MAKE_FUNCTION': format_MAKE_FUNCTION_arg, 'FORMAT_VALUE': format_value_flags, 'EXTENDED_ARG': opcode_36.format_extended_arg36 } update_pj3(globals(), l)
version = 3.2 version_tuple = (3, 2) python_implementation = "PyPy" import xdis.opcodes.opcode_32 as opcode_32 l = locals() init_opdata(l, opcode_32, version_tuple, is_pypy=True) ## FIXME: DRY common PYPY opcode additions # PyPy only # ---------- name_op(l, "LOOKUP_METHOD", 201, 1, 2) nargs_op(l, "CALL_METHOD", 202, -1, 1) l["hasvargs"].append(202) # Used only in single-mode compilation list-comprehension generators varargs_op(l, "BUILD_LIST_FROM_ARG", 203) # Used only in assert statements jrel_op(l, "JUMP_IF_NOT_DEBUG", 204, conditional=True) # There are no opcodes to remove or change. # If there were, they'd be listed below. # FIXME remove (fix uncompyle6) update_pj3(globals(), l) finalize_opcodes(l)
jabs_op(l, 'POP_JUMP_IF_FALSE', 114, 2, 1, conditional=True) # "" jabs_op(l, 'POP_JUMP_IF_TRUE', 115, 2, 1, conditional=True) # "" name_op(l, 'LOAD_GLOBAL', 116, 0, 1) # Operand is in name list jabs_op(l, 'CONTINUE_LOOP', 119, 0, 0, fallthrough=False) # Target address jrel_op(l, 'SETUP_LOOP', 120, 0, 0, conditional=True) # Distance to target address jrel_op(l, 'SETUP_EXCEPT', 121, 0, 6, conditional=True) # "" jrel_op(l, 'SETUP_FINALLY', 122, 0, 6, conditional=True) # "" local_op(l, 'LOAD_FAST', 124, 0, 1) # Local variable number store_op(l, 'STORE_FAST', 125, 1, 0, is_type="local") # Local variable number local_op(l, 'DELETE_FAST', 126, 0, 0) # Local variable number nargs_op(l, 'RAISE_VARARGS', 130, -1, 1, fallthrough=False) # Number of raise arguments (1, 2, or 3) nargs_op(l, 'CALL_FUNCTION', 131, -1, 1) # #args + (#kwargs << 8) nargs_op(l, 'MAKE_FUNCTION', 132, -2, 1) # TOS is number of args if < 3.6 varargs_op(l, 'BUILD_SLICE', 133, 2, 1) # TOS is number of items to pop nargs_op(l, 'MAKE_CLOSURE', 134, -3, 1) # TOS is number of items to pop free_op(l, 'LOAD_CLOSURE', 135, 0, 1) free_op(l, 'LOAD_DEREF', 136, 0, 1) store_op(l, 'STORE_DEREF', 137, 1, 0, is_type="free") free_op(l, 'DELETE_DEREF', 138, 0, 0) nargs_op(l, 'CALL_FUNCTION_VAR', 140, -2, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_KW', 141, -2, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_VAR_KW', 142, -3, 1) # #args + (#kwargs << 8)
# MAKE_FUNCTION oparg # This is a different opcode from before. # The tuple of default values for positional-or-keyword parameters, # the dict of default values for keyword-only parameters, the dict of # annotations and the closure are pushed on the stack if corresponding # bit (0-3) is set. They are followed by the code object and the # qualified name of the function. # These are new since Python 3.6 name_op(l, 'STORE_ANNOTATION', 127) # Index in name list jrel_op(l, 'SETUP_ASYNC_WITH', 154) def_op(l, 'FORMAT_VALUE', 155) varargs_op(l, 'BUILD_CONST_KEY_MAP', 156, -1, 1) # TOS is count of kwargs nargs_op(l, 'CALL_FUNCTION_EX', 142, -1, 1) def_op(l, 'SETUP_ANNOTATIONS', 85) def_op(l, 'BUILD_STRING', 157) varargs_op(l, 'BUILD_TUPLE_UNPACK_WITH_CALL', 158) MAKE_FUNCTION_FLAGS = tuple("default keyword-only annotation closure".split()) def format_MAKE_FUNCTION_arg(flags): pattr = '' for flag in MAKE_FUNCTION_FLAGS: bit = flags & 1 if bit: if pattr: pattr += ", " + flag else:
# Target byte offset from beginning of code name_op(l, 'LOAD_GLOBAL', 116, 0, 1) # Operand is in name list jabs_op(l, 'CONTINUE_LOOP', 119, 0, 0, fallthrough=False) # Target address jrel_op(l, 'SETUP_LOOP', 120, 0, 0, conditional=True) # Distance to target address jrel_op(l, 'SETUP_EXCEPT', 121, 0, 6, conditional=True) # "" jrel_op(l, 'SETUP_FINALLY', 122, 0, 7, conditional=True) # "" local_op(l, 'LOAD_FAST', 124, 0, 1) # Local variable number local_op(l, 'STORE_FAST', 125, 1, 0) # Local variable number local_op(l, 'DELETE_FAST', 126) # Local variable number def_op(l, 'RAISE_VARARGS', 130, -1, 0, fallthrough=False) # Number of raise arguments (1, 2, or 3) nargs_op(l, 'CALL_FUNCTION', 131, 9, 1) # TOS is #args + (#kwargs << 8) def_op(l, 'MAKE_FUNCTION', 132, 9, 1) # TOS is number of args with default values varargs_op(l, 'BUILD_SLICE', 133, 9, 1) # TOS is number of items def_op(l, 'MAKE_CLOSURE', 134, 9, 1) free_op(l, 'LOAD_CLOSURE', 135, 0, 1) free_op(l, 'LOAD_DEREF', 136, 0, 1) free_op(l, 'STORE_DEREF', 137, 1, 0) nargs_op(l, 'CALL_FUNCTION_VAR', 140, -1, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_KW', 141, -1, 1) # #args + (#kwargs << 8) nargs_op(l, 'CALL_FUNCTION_VAR_KW', 142, -1, 1) # #args + (#kwargs << 8) def_op(l, 'EXTENDED_ARG', 143) EXTENDED_ARG = 143
version = 3.5 import xdis.opcodes.opcode_35 as opcode_35 l = locals() init_opdata(l, opcode_35, version, is_pypy=True) ## FIXME: DRY common PYPY opcode additions # PyPy only # ---------- def_op(l, 'FORMAT_VALUE', 155) def_op(l, 'BUILD_STRING', 157) name_op(l, 'LOOKUP_METHOD', 201, 1, 2) nargs_op(l, 'CALL_METHOD', 202, -1, 1) l['hasvargs'].append(202) # Used only in single-mode compilation list-comprehension generators varargs_op(l, 'BUILD_LIST_FROM_ARG', 203) # Used only in assert statements jrel_op(l, 'JUMP_IF_NOT_DEBUG', 204, conditional=True) # There are no opcodes to remove or change. # If there were, they'd be listed below. # FIXME remove (fix uncompyle6) update_pj3(globals(), l) finalize_opcodes(l)
from xdis.opcodes.opcode_37 import format_MAKE_FUNCTION_flags l = locals() init_opdata(l, opcode_38, version_tuple, is_pypy=True) # fmt: off rm_op(l, "ROT_FOUR", 6) rm_op(l, "BUILD_TUPLE_UNPACK_WITH_CALL", 158) rm_op(l, "LOAD_METHOD", 160) # PyPy only # ---------- name_op(l, "LOOKUP_METHOD", 201, 1, 2) l["hasvargs"].append(202) nargs_op(l, "CALL_METHOD_KW", 204, -1, 1) # Used only in single-mode compilation list-comprehension generators jrel_op(l, 'SETUP_EXCEPT', 121, 0, 6, conditional=True) # "" varargs_op(l, "BUILD_LIST_FROM_ARG", 203) def_op(l, "LOAD_REVDB_VAR", 205) opcode_arg_fmt = { "EXTENDED_ARG": format_extended_arg, "MAKE_FUNCTION": format_MAKE_FUNCTION_flags, "RAISE_VARARGS": format_RAISE_VARARGS_older, 'CALL_FUNCTION': format_CALL_FUNCTION_pos_name_encoded, } opcode_extended_fmt = { "LOAD_ATTR": extended_format_ATTR,