From b939aeb87c9240dab1ffbbf248264c50ee48e72a Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Wed, 7 Aug 2024 15:44:36 -0700 Subject: [PATCH] Update operand documentation for new opcodes and oparg changes. Also extends the disassembly oparg decoding for new 3.13 additions. --- ASTree.cpp | 10 ++- bytecode.cpp | 58 ++++++++++++- bytecode_ops.inl | 187 ++++++++++++++++++++++-------------------- bytes/python_3_13.cpp | 40 ++++----- 4 files changed, 181 insertions(+), 114 deletions(-) diff --git a/ASTree.cpp b/ASTree.cpp index 6db9195..050eebf 100644 --- a/ASTree.cpp +++ b/ASTree.cpp @@ -645,8 +645,10 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) PycRef left = stack.top(); stack.pop(); auto arg = operand; - if (mod->verCompare(3, 12) >= 0) + if (mod->verCompare(3, 12) == 0) arg >>= 4; // changed under GH-100923 + else if (mod->verCompare(3, 13) >= 0) + arg >>= 5; stack.push(new ASTCompare(left, right, arg)); } break; @@ -1469,7 +1471,7 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) if (mod->verCompare(3, 12) >= 0) { if (operand & 1) { /* Changed in version 3.12: - If the low bit of namei is set, then a NULL or self is pushed to the stack + If the low bit of name is set, then a NULL or self is pushed to the stack before the attribute or unbound method respectively. */ stack.push(nullptr); } @@ -1512,6 +1514,10 @@ PycRef BuildFromCode(PycRef code, PycModule* mod) else stack.push(new ASTName(code->getLocal(operand))); break; + case Pyc::LOAD_FAST_LOAD_FAST_A: + stack.push(new ASTName(code->getLocal(operand >> 4))); + stack.push(new ASTName(code->getLocal(operand & 0xF))); + break; case Pyc::LOAD_GLOBAL_A: if (mod->verCompare(3, 11) >= 0) { // Loads the global named co_names[namei>>1] onto the stack. diff --git a/bytecode.cpp b/bytecode.cpp index 703255f..4fc7658 100644 --- a/bytecode.cpp +++ b/bytecode.cpp @@ -329,7 +329,7 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, static const char *intrinsic2_names[] = { "INTRINSIC_2_INVALID", "INTRINSIC_PREP_RERAISE_STAR", "INTRINSIC_TYPEVAR_WITH_BOUND", "INTRINSIC_TYPEVAR_WITH_CONSTRAINTS", - "INTRINSIC_SET_FUNCTION_TYPE_PARAMS", + "INTRINSIC_SET_FUNCTION_TYPE_PARAMS", "INTRINSIC_SET_TYPEPARAM_DEFAULT", }; static const size_t intrinsic2_names_len = sizeof(intrinsic2_names) / sizeof(intrinsic2_names[0]); @@ -388,9 +388,12 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, case Pyc::IMPORT_FROM_A: case Pyc::IMPORT_NAME_A: case Pyc::LOAD_ATTR_A: + case Pyc::LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN_A: + case Pyc::LOAD_ATTR_WITH_HINT_A: case Pyc::LOAD_LOCAL_A: case Pyc::LOAD_NAME_A: case Pyc::STORE_ATTR_A: + case Pyc::STORE_ATTR_WITH_HINT_A: case Pyc::STORE_GLOBAL_A: case Pyc::STORE_NAME_A: case Pyc::STORE_ANNOTATION_A: @@ -406,6 +409,8 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, } break; case Pyc::LOAD_SUPER_ATTR_A: + case Pyc::LOAD_SUPER_ATTR_ATTR_A: + case Pyc::LOAD_SUPER_ATTR_METHOD_A: case Pyc::INSTRUMENTED_LOAD_SUPER_ATTR_A: try { formatted_print(pyc_output, "%d: %s", operand, code->getName(operand >> 2)->value()); @@ -424,6 +429,17 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, formatted_print(pyc_output, "%d ", operand); } break; + case Pyc::LOAD_FAST_LOAD_FAST_A: + case Pyc::STORE_FAST_LOAD_FAST_A: + case Pyc::STORE_FAST_STORE_FAST_A: + try { + formatted_print(pyc_output, "%d: %s, %s", operand, + code->getLocal(operand >> 4)->value(), + code->getLocal(operand & 0xF)->value()); + } catch (const std::out_of_range &) { + formatted_print(pyc_output, "%d ", operand); + } + break; case Pyc::LOAD_CLOSURE_A: case Pyc::LOAD_DEREF_A: case Pyc::STORE_DEREF_A: @@ -445,11 +461,16 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, case Pyc::SETUP_EXCEPT_A: case Pyc::FOR_LOOP_A: case Pyc::FOR_ITER_A: + case Pyc::FOR_ITER_GEN_A: + case Pyc::FOR_ITER_LIST_A: + case Pyc::FOR_ITER_RANGE_A: + case Pyc::FOR_ITER_TUPLE_A: case Pyc::SETUP_WITH_A: case Pyc::SETUP_ASYNC_WITH_A: case Pyc::POP_JUMP_FORWARD_IF_FALSE_A: case Pyc::POP_JUMP_FORWARD_IF_TRUE_A: case Pyc::SEND_A: + case Pyc::SEND_GEN_A: case Pyc::POP_JUMP_FORWARD_IF_NOT_NONE_A: case Pyc::POP_JUMP_FORWARD_IF_NONE_A: case Pyc::POP_JUMP_IF_NOT_NONE_A: @@ -499,10 +520,15 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, } break; case Pyc::COMPARE_OP_A: + case Pyc::COMPARE_OP_FLOAT_A: + case Pyc::COMPARE_OP_INT_A: + case Pyc::COMPARE_OP_STR_A: { auto arg = operand; - if (mod->verCompare(3, 12) >= 0) + if (mod->verCompare(3, 12) == 0) arg >>= 4; // changed under GH-100923 + else if (mod->verCompare(3, 13) >= 0) + arg >>= 5; if (static_cast(arg) < cmp_strings_len) formatted_print(pyc_output, "%d (%s)", operand, cmp_strings[arg]); else @@ -521,6 +547,8 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, : "UNKNOWN"); break; case Pyc::CONTAINS_OP_A: + case Pyc::CONTAINS_OP_DICT_A: + case Pyc::CONTAINS_OP_SET_A: formatted_print(pyc_output, "%d (%s)", operand, (operand == 0) ? "in" : (operand == 1) ? "not in" : "UNKNOWN"); @@ -549,6 +577,32 @@ void bc_disasm(std::ostream& pyc_output, PycRef code, PycModule* mod, } } break; + case Pyc::CONVERT_VALUE_A: + if (static_cast(operand) < format_value_names_len) + formatted_print(pyc_output, "%d (%s)", operand, format_value_names[operand]); + else + formatted_print(pyc_output, "%d (UNKNOWN)", operand); + break; + case Pyc::SET_FUNCTION_ATTRIBUTE_A: + // This looks like a bitmask, but CPython treats it as an exclusive lookup... + switch (operand) { + case 0x01: + formatted_print(pyc_output, "%d (MAKE_FUNCTION_DEFAULTS)", operand); + break; + case 0x02: + formatted_print(pyc_output, "%d (MAKE_FUNCTION_KWDEFAULTS)", operand); + break; + case 0x04: + formatted_print(pyc_output, "%d (MAKE_FUNCTION_ANNOTATIONS)", operand); + break; + case 0x08: + formatted_print(pyc_output, "%d (MAKE_FUNCTION_CLOSURE)", operand); + break; + default: + formatted_print(pyc_output, "%d (UNKNOWN)", operand); + break; + } + break; default: formatted_print(pyc_output, "%d", operand); break; diff --git a/bytecode_ops.inl b/bytecode_ops.inl index 397f83c..9db07f9 100644 --- a/bytecode_ops.inl +++ b/bytecode_ops.inl @@ -142,8 +142,11 @@ OPCODE_A(LOAD_NAME) // Python 1.0 -> names[A] OPCODE_A(BUILD_TUPLE) // Python 1.0 -> A=size OPCODE_A(BUILD_LIST) // Python 1.0 -> A=size OPCODE_A(BUILD_MAP) // Python 1.0 -> A=size -OPCODE_A(LOAD_ATTR) // Python 1.0 -> names[A] -OPCODE_A(COMPARE_OP) // Python 1.0 -> cmp_ops[A] +OPCODE_A(LOAD_ATTR) // Python 1.0 - 3.11 names[A] + // Python 3.12 -> A=(names[A<<1])+(flag) +OPCODE_A(COMPARE_OP) // Python 1.0 - 3.11 cmp_ops[A] + // Python 3.12 A=(cmp_ops[A<<4])+(flags) + // Python 3.13 -> A=(cmp_ops[A<<5])+(flags) OPCODE_A(IMPORT_NAME) // Python 1.0 -> names[A] OPCODE_A(IMPORT_FROM) // Python 1.0 -> names[A] OPCODE_A(ACCESS_MODE) // Python 1.0 - 1.4 names[A] @@ -153,7 +156,8 @@ OPCODE_A(JUMP_IF_TRUE) // Python 1.0 - 2.6, 3.0 rel jmp OPCODE_A(JUMP_ABSOLUTE) // Python 1.0 - 3.10 abs jmp A OPCODE_A(FOR_LOOP) // Python 1.0 - 2.2 rel jmp +A OPCODE_A(LOAD_LOCAL) // Python 1.0 - 1.4 names[A] -OPCODE_A(LOAD_GLOBAL) // Python 1.0 -> names[A] +OPCODE_A(LOAD_GLOBAL) // Python 1.0 - 3.10 names[A] + // Python 3.11 -> A=(names[A<<1])+(flag) OPCODE_A(SET_FUNC_ARGS) // Python 1.1 - 1.4 A=count OPCODE_A(SETUP_LOOP) // Python 1.0 - 3.7 rel jmp +A OPCODE_A(SETUP_EXCEPT) // Python 1.0 - 3.7 rel jmp +A @@ -170,7 +174,7 @@ OPCODE_A(CALL_FUNCTION) // Python 1.3 - 3.5 A=(#args // Python 3.6 - 3.10 A=#args OPCODE_A(MAKE_FUNCTION) // Python 1.3 - 2.7 A=#defaults // Python 3.0 - 3.5 A=(#defaults)+(#kwdefaults<<8)+(#annotations<<16) - // Python 3.6 -> A=flags + // Python 3.6 - 3.12 A=flags OPCODE_A(BUILD_SLICE) // Python 1.4 -> A=count OPCODE_A(CALL_FUNCTION_VAR) // Python 1.6 - 3.5 A=(#args)+(#kwargs<<8) OPCODE_A(CALL_FUNCTION_KW) // Python 1.6 - 3.5 A=(#args)+(#kwargs<<8) @@ -210,7 +214,7 @@ OPCODE_A(BUILD_MAP_UNPACK_WITH_CALL) // Python 3.5 A=(count OPCODE_A(BUILD_TUPLE_UNPACK) // Python 3.5 - 3.8 A=count OPCODE_A(BUILD_SET_UNPACK) // Python 3.5 - 3.8 A=count OPCODE_A(SETUP_ASYNC_WITH) // Python 3.5 - 3.10 rel jmp +A -OPCODE_A(FORMAT_VALUE) // Python 3.6 -> A=(conversion_type&0x3)+(flags) +OPCODE_A(FORMAT_VALUE) // Python 3.6 - 3.12 A=(conversion_type&0x3)+(flags) OPCODE_A(BUILD_CONST_KEY_MAP) // Python 3.6 -> A=count OPCODE_A(BUILD_STRING) // Python 3.6 -> A=count OPCODE_A(BUILD_TUPLE_UNPACK_WITH_CALL) // Python 3.6 - 3.8 A=count @@ -220,7 +224,7 @@ OPCODE_A(CALL_FINALLY) // Python 3.8 rel jmp OPCODE_A(POP_FINALLY) // Python 3.8 A=flags OPCODE_A(IS_OP) // Python 3.9 -> A=inverted OPCODE_A(CONTAINS_OP) // Python 3.9 -> A=inverted -OPCODE_A(RERAISE) // Python 3.10 -> A=flag +OPCODE_A(RERAISE) // Python 3.10 -> A=count OPCODE_A(JUMP_IF_NOT_EXC_MATCH) // Python 3.9 - 3.10 abs jmp A OPCODE_A(LIST_EXTEND) // Python 3.9 -> stack[A] OPCODE_A(SET_UPDATE) // Python 3.9 -> stack[A] @@ -242,7 +246,7 @@ OPCODE_A(COPY_FREE_VARS) // Python 3.11 -> A=count OPCODE_A(RESUME) // Python 3.11 -> ??? OPCODE_A(PRECALL) // Python 3.11 A=#args OPCODE_A(CALL) // Python 3.11 -> A=#args -OPCODE_A(KW_NAMES) // Python 3.11 -> consts[A] +OPCODE_A(KW_NAMES) // Python 3.11 - 3.12 consts[A] OPCODE_A(POP_JUMP_BACKWARD_IF_NOT_NONE) // Python 3.11 jmp rel -A OPCODE_A(POP_JUMP_BACKWARD_IF_NONE) // Python 3.11 jmp rel -A OPCODE_A(POP_JUMP_BACKWARD_IF_FALSE) // Python 3.11 jmp rel -A @@ -253,91 +257,94 @@ OPCODE_A(POP_JUMP_IF_NOT_NONE) // Python 3.12 -> rel jmp OPCODE_A(POP_JUMP_IF_NONE) // Python 3.12 -> rel jmp +A OPCODE_A(LOAD_SUPER_ATTR) // Python 3.12 -> A=(flags&0x3)+names[A<<2] OPCODE_A(LOAD_FAST_AND_CLEAR) // Python 3.12 -> locals[A] -OPCODE_A(YIELD_VALUE) // Python 3.12 -> ??? +OPCODE_A(YIELD_VALUE) // Python 3.12 A=stack_depth (ignored) + // Python 3.13 -> A=type OPCODE_A(CALL_INTRINSIC_1) // Python 3.12 -> intrinsics_1[A] OPCODE_A(CALL_INTRINSIC_2) // Python 3.12 -> intrinsics_2[A] OPCODE_A(LOAD_FROM_DICT_OR_GLOBALS) // Python 3.12 -> names[A] OPCODE_A(LOAD_FROM_DICT_OR_DEREF) // Python 3.12 -> localsplusnames[A] -OPCODE_A(CALL_KW) // Python 3.13 -> -OPCODE_A(CONVERT_VALUE) // Python 3.13 -> -OPCODE_A(ENTER_EXECUTOR) // Python 3.13 -> -OPCODE_A(LOAD_FAST_LOAD_FAST) // Python 3.13 -> -OPCODE_A(SET_FUNCTION_ATTRIBUTE) // Python 3.13 -> -OPCODE_A(STORE_FAST_LOAD_FAST) // Python 3.13 -> -OPCODE_A(STORE_FAST_STORE_FAST) // Python 3.13 -> -OPCODE_A(BINARY_OP_ADD_FLOAT) -OPCODE_A(BINARY_OP_ADD_INT) -OPCODE_A(BINARY_OP_ADD_UNICODE) -OPCODE_A(BINARY_OP_MULTIPLY_FLOAT) -OPCODE_A(BINARY_OP_MULTIPLY_INT) -OPCODE_A(BINARY_OP_SUBTRACT_FLOAT) -OPCODE_A(BINARY_OP_SUBTRACT_INT) -OPCODE_A(BINARY_SUBSCR_DICT) -OPCODE_A(BINARY_SUBSCR_GETITEM) -OPCODE_A(BINARY_SUBSCR_LIST_INT) -OPCODE_A(BINARY_SUBSCR_STR_INT) -OPCODE_A(BINARY_SUBSCR_TUPLE_INT) -OPCODE_A(CALL_ALLOC_AND_ENTER_INIT) -OPCODE_A(CALL_BOUND_METHOD_EXACT_ARGS) -OPCODE_A(CALL_BOUND_METHOD_GENERAL) -OPCODE_A(CALL_BUILTIN_CLASS) -OPCODE_A(CALL_BUILTIN_FAST) -OPCODE_A(CALL_BUILTIN_FAST_WITH_KEYWORDS) -OPCODE_A(CALL_BUILTIN_O) -OPCODE_A(CALL_ISINSTANCE) -OPCODE_A(CALL_LEN) -OPCODE_A(CALL_LIST_APPEND) -OPCODE_A(CALL_METHOD_DESCRIPTOR_FAST) -OPCODE_A(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) -OPCODE_A(CALL_METHOD_DESCRIPTOR_NOARGS) -OPCODE_A(CALL_METHOD_DESCRIPTOR_O) -OPCODE_A(CALL_NON_PY_GENERAL) -OPCODE_A(CALL_PY_EXACT_ARGS) -OPCODE_A(CALL_PY_GENERAL) -OPCODE_A(CALL_STR_1) -OPCODE_A(CALL_TUPLE_1) -OPCODE_A(CALL_TYPE_1) -OPCODE_A(COMPARE_OP_FLOAT) -OPCODE_A(COMPARE_OP_INT) -OPCODE_A(COMPARE_OP_STR) -OPCODE_A(CONTAINS_OP_DICT) -OPCODE_A(CONTAINS_OP_SET) -OPCODE_A(FOR_ITER_GEN) -OPCODE_A(FOR_ITER_LIST) -OPCODE_A(FOR_ITER_RANGE) -OPCODE_A(FOR_ITER_TUPLE) -OPCODE_A(LOAD_ATTR_CLASS) -OPCODE_A(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) -OPCODE_A(LOAD_ATTR_INSTANCE_VALUE) -OPCODE_A(LOAD_ATTR_METHOD_LAZY_DICT) -OPCODE_A(LOAD_ATTR_METHOD_NO_DICT) -OPCODE_A(LOAD_ATTR_METHOD_WITH_VALUES) -OPCODE_A(LOAD_ATTR_MODULE) -OPCODE_A(LOAD_ATTR_NONDESCRIPTOR_NO_DICT) -OPCODE_A(LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES) -OPCODE_A(LOAD_ATTR_PROPERTY) -OPCODE_A(LOAD_ATTR_SLOT) -OPCODE_A(LOAD_ATTR_WITH_HINT) -OPCODE_A(LOAD_GLOBAL_BUILTIN) -OPCODE_A(LOAD_GLOBAL_MODULE) -OPCODE_A(LOAD_SUPER_ATTR_ATTR) -OPCODE_A(LOAD_SUPER_ATTR_METHOD) -OPCODE_A(RESUME_CHECK) -OPCODE_A(SEND_GEN) -OPCODE_A(STORE_ATTR_INSTANCE_VALUE) -OPCODE_A(STORE_ATTR_SLOT) -OPCODE_A(STORE_ATTR_WITH_HINT) -OPCODE_A(STORE_SUBSCR_DICT) -OPCODE_A(STORE_SUBSCR_LIST_INT) -OPCODE_A(TO_BOOL_ALWAYS_TRUE) -OPCODE_A(TO_BOOL_BOOL) -OPCODE_A(TO_BOOL_INT) -OPCODE_A(TO_BOOL_LIST) -OPCODE_A(TO_BOOL_NONE) -OPCODE_A(TO_BOOL_STR) -OPCODE_A(UNPACK_SEQUENCE_LIST) -OPCODE_A(UNPACK_SEQUENCE_TUPLE) -OPCODE_A(UNPACK_SEQUENCE_TWO_TUPLE) +OPCODE_A(CALL_KW) // Python 3.13 -> A=#args +OPCODE_A(CONVERT_VALUE) // Python 3.13 -> A=conversion_type +OPCODE_A(ENTER_EXECUTOR) // Python 3.13 -> executors[A&0xff] +OPCODE_A(LOAD_FAST_LOAD_FAST) // Python 3.13 -> A=locals[A<<4]+locals[A&0xf] +OPCODE_A(SET_FUNCTION_ATTRIBUTE) // Python 3.13 -> A=attribute_type +OPCODE_A(STORE_FAST_LOAD_FAST) // Python 3.13 -> A=locals[A<<4]+locals[A&0xf] +OPCODE_A(STORE_FAST_STORE_FAST) // Python 3.13 -> A=locals[A<<4]+locals[A&0xf] + +/* Specialized opcode variants added in 3.13 */ +OPCODE(BINARY_OP_ADD_FLOAT) // Python 3.13 -> +OPCODE(BINARY_OP_ADD_INT) // Python 3.13 -> +OPCODE(BINARY_OP_ADD_UNICODE) // Python 3.13 -> +OPCODE(BINARY_OP_MULTIPLY_FLOAT) // Python 3.13 -> +OPCODE(BINARY_OP_MULTIPLY_INT) // Python 3.13 -> +OPCODE(BINARY_OP_SUBTRACT_FLOAT) // Python 3.13 -> +OPCODE(BINARY_OP_SUBTRACT_INT) // Python 3.13 -> +OPCODE(BINARY_SUBSCR_DICT) // Python 3.13 -> +OPCODE(BINARY_SUBSCR_GETITEM) // Python 3.13 -> +OPCODE(BINARY_SUBSCR_LIST_INT) // Python 3.13 -> +OPCODE(BINARY_SUBSCR_STR_INT) // Python 3.13 -> +OPCODE(BINARY_SUBSCR_TUPLE_INT) // Python 3.13 -> +OPCODE_A(CALL_ALLOC_AND_ENTER_INIT) // Python 3.13 -> A=#args +OPCODE_A(CALL_BOUND_METHOD_EXACT_ARGS) // Python 3.13 -> A=#args +OPCODE_A(CALL_BOUND_METHOD_GENERAL) // Python 3.13 -> A=#args +OPCODE_A(CALL_BUILTIN_CLASS) // Python 3.13 -> A=#args +OPCODE_A(CALL_BUILTIN_FAST) // Python 3.13 -> A=#args +OPCODE_A(CALL_BUILTIN_FAST_WITH_KEYWORDS) // Python 3.13 -> A=#args +OPCODE_A(CALL_BUILTIN_O) // Python 3.13 -> A=#args +OPCODE_A(CALL_ISINSTANCE) // Python 3.13 -> A=#args +OPCODE_A(CALL_LEN) // Python 3.13 -> A=#args +OPCODE_A(CALL_LIST_APPEND) // Python 3.13 -> A=#args +OPCODE_A(CALL_METHOD_DESCRIPTOR_FAST) // Python 3.13 -> A=#args +OPCODE_A(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) // Python 3.13 -> A=#args +OPCODE_A(CALL_METHOD_DESCRIPTOR_NOARGS) // Python 3.13 -> A=#args +OPCODE_A(CALL_METHOD_DESCRIPTOR_O) // Python 3.13 -> A=#args +OPCODE_A(CALL_NON_PY_GENERAL) // Python 3.13 -> A=#args +OPCODE_A(CALL_PY_EXACT_ARGS) // Python 3.13 -> A=#args +OPCODE_A(CALL_PY_GENERAL) // Python 3.13 -> A=#args +OPCODE_A(CALL_STR_1) // Python 3.13 -> A=#args +OPCODE_A(CALL_TUPLE_1) // Python 3.13 -> A=#args +OPCODE_A(CALL_TYPE_1) // Python 3.13 -> A=#args +OPCODE_A(COMPARE_OP_FLOAT) // Python 3.13 -> A=(cmp_ops[A<<5])+(flags) +OPCODE_A(COMPARE_OP_INT) // Python 3.13 -> A=(cmp_ops[A<<5])+(flags) +OPCODE_A(COMPARE_OP_STR) // Python 3.13 -> A=(cmp_ops[A<<5])+(flags) +OPCODE_A(CONTAINS_OP_DICT) // Python 3.13 -> A=inverted +OPCODE_A(CONTAINS_OP_SET) // Python 3.13 -> A=inverted +OPCODE_A(FOR_ITER_GEN) // Python 3.13 -> rel jmp +A +OPCODE_A(FOR_ITER_LIST) // Python 3.13 -> rel jmp +A +OPCODE_A(FOR_ITER_RANGE) // Python 3.13 -> rel jmp +A +OPCODE_A(FOR_ITER_TUPLE) // Python 3.13 -> rel jmp +A +OPCODE_A(LOAD_ATTR_CLASS) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) // Python 3.13 -> A=(names[A<<1])+(flag) +OPCODE_A(LOAD_ATTR_INSTANCE_VALUE) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_METHOD_LAZY_DICT) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_METHOD_NO_DICT) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_METHOD_WITH_VALUES) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_MODULE) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_NONDESCRIPTOR_NO_DICT) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_PROPERTY) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_SLOT) // Python 3.13 -> A=flag +OPCODE_A(LOAD_ATTR_WITH_HINT) // Python 3.13 -> A=(names[A<<1])+(flag) +OPCODE_A(LOAD_GLOBAL_BUILTIN) // Python 3.13 -> A=flag +OPCODE_A(LOAD_GLOBAL_MODULE) // Python 3.13 -> A=flag +OPCODE_A(LOAD_SUPER_ATTR_ATTR) // Python 3.13 -> A=(flags&0x3)+names[A<<2] +OPCODE_A(LOAD_SUPER_ATTR_METHOD) // Python 3.13 -> A=(flags&0x3)+names[A<<2] +OPCODE_A(RESUME_CHECK) // Python 3.13 -> ??? +OPCODE_A(SEND_GEN) // Python 3.13 -> rel jmp +A +OPCODE_A(STORE_ATTR_INSTANCE_VALUE) // Python 3.13 -> A=(ignored) +OPCODE_A(STORE_ATTR_SLOT) // Python 3.13 -> A=(ignored) +OPCODE_A(STORE_ATTR_WITH_HINT) // Python 3.13 -> names[A] +OPCODE(STORE_SUBSCR_DICT) // Python 3.13 -> +OPCODE(STORE_SUBSCR_LIST_INT) // Python 3.13 -> +OPCODE(TO_BOOL_ALWAYS_TRUE) // Python 3.13 -> +OPCODE(TO_BOOL_BOOL) // Python 3.13 -> +OPCODE(TO_BOOL_INT) // Python 3.13 -> +OPCODE(TO_BOOL_LIST) // Python 3.13 -> +OPCODE(TO_BOOL_NONE) // Python 3.13 -> +OPCODE(TO_BOOL_STR) // Python 3.13 -> +OPCODE_A(UNPACK_SEQUENCE_LIST) // Python 3.13 -> A=count +OPCODE_A(UNPACK_SEQUENCE_TUPLE) // Python 3.13 -> A=count +OPCODE_A(UNPACK_SEQUENCE_TWO_TUPLE) // Python 3.13 -> A=count /* Instrumented opcodes */ OPCODE_A(INSTRUMENTED_LOAD_SUPER_ATTR) // Python 3.12 -> (see LOAD_SUPER_ATTR) @@ -356,6 +363,6 @@ OPCODE_A(INSTRUMENTED_POP_JUMP_IF_FALSE) // Python 3.12 -> (see POP OPCODE_A(INSTRUMENTED_POP_JUMP_IF_TRUE) // Python 3.12 -> (see POP_JUMP_IF_TRUE) OPCODE_A(INSTRUMENTED_END_FOR) // Python 3.12 -> (see END_FOR) OPCODE_A(INSTRUMENTED_END_SEND) // Python 3.12 -> (see END_SEND) -OPCODE_A(INSTRUMENTED_INSTRUCTION) // Python 3.12 -> ??? +OPCODE_A(INSTRUMENTED_INSTRUCTION) // Python 3.12 -> A=(unused) OPCODE_A(INSTRUMENTED_LINE) // Python 3.12 -> ??? -OPCODE_A(INSTRUMENTED_CALL_KW) // Python 3.13 -> ??? +OPCODE_A(INSTRUMENTED_CALL_KW) // Python 3.13 -> (see CALL_KW) diff --git a/bytes/python_3_13.cpp b/bytes/python_3_13.cpp index b8a3829..c035c9c 100644 --- a/bytes/python_3_13.cpp +++ b/bytes/python_3_13.cpp @@ -121,18 +121,18 @@ BEGIN_MAP(3, 13) MAP_OP(117, UNPACK_SEQUENCE_A) MAP_OP(118, YIELD_VALUE_A) MAP_OP(149, RESUME_A) - MAP_OP(150, BINARY_OP_ADD_FLOAT_A) - MAP_OP(151, BINARY_OP_ADD_INT_A) - MAP_OP(152, BINARY_OP_ADD_UNICODE_A) - MAP_OP(153, BINARY_OP_MULTIPLY_FLOAT_A) - MAP_OP(154, BINARY_OP_MULTIPLY_INT_A) - MAP_OP(155, BINARY_OP_SUBTRACT_FLOAT_A) - MAP_OP(156, BINARY_OP_SUBTRACT_INT_A) - MAP_OP(157, BINARY_SUBSCR_DICT_A) - MAP_OP(158, BINARY_SUBSCR_GETITEM_A) - MAP_OP(159, BINARY_SUBSCR_LIST_INT_A) - MAP_OP(160, BINARY_SUBSCR_STR_INT_A) - MAP_OP(161, BINARY_SUBSCR_TUPLE_INT_A) + MAP_OP(150, BINARY_OP_ADD_FLOAT) + MAP_OP(151, BINARY_OP_ADD_INT) + MAP_OP(152, BINARY_OP_ADD_UNICODE) + MAP_OP(153, BINARY_OP_MULTIPLY_FLOAT) + MAP_OP(154, BINARY_OP_MULTIPLY_INT) + MAP_OP(155, BINARY_OP_SUBTRACT_FLOAT) + MAP_OP(156, BINARY_OP_SUBTRACT_INT) + MAP_OP(157, BINARY_SUBSCR_DICT) + MAP_OP(158, BINARY_SUBSCR_GETITEM) + MAP_OP(159, BINARY_SUBSCR_LIST_INT) + MAP_OP(160, BINARY_SUBSCR_STR_INT) + MAP_OP(161, BINARY_SUBSCR_TUPLE_INT) MAP_OP(162, CALL_ALLOC_AND_ENTER_INIT_A) MAP_OP(163, CALL_BOUND_METHOD_EXACT_ARGS_A) MAP_OP(164, CALL_BOUND_METHOD_GENERAL_A) @@ -183,14 +183,14 @@ BEGIN_MAP(3, 13) MAP_OP(209, STORE_ATTR_INSTANCE_VALUE_A) MAP_OP(210, STORE_ATTR_SLOT_A) MAP_OP(211, STORE_ATTR_WITH_HINT_A) - MAP_OP(212, STORE_SUBSCR_DICT_A) - MAP_OP(213, STORE_SUBSCR_LIST_INT_A) - MAP_OP(214, TO_BOOL_ALWAYS_TRUE_A) - MAP_OP(215, TO_BOOL_BOOL_A) - MAP_OP(216, TO_BOOL_INT_A) - MAP_OP(217, TO_BOOL_LIST_A) - MAP_OP(218, TO_BOOL_NONE_A) - MAP_OP(219, TO_BOOL_STR_A) + MAP_OP(212, STORE_SUBSCR_DICT) + MAP_OP(213, STORE_SUBSCR_LIST_INT) + MAP_OP(214, TO_BOOL_ALWAYS_TRUE) + MAP_OP(215, TO_BOOL_BOOL) + MAP_OP(216, TO_BOOL_INT) + MAP_OP(217, TO_BOOL_LIST) + MAP_OP(218, TO_BOOL_NONE) + MAP_OP(219, TO_BOOL_STR) MAP_OP(220, UNPACK_SEQUENCE_LIST_A) MAP_OP(221, UNPACK_SEQUENCE_TUPLE_A) MAP_OP(222, UNPACK_SEQUENCE_TWO_TUPLE_A)