GH-99005: More intrinsics (GH-100774)

* Remove UNARY_POSITIVE, LIST_TO_TUPLE and ASYNC_GEN_WRAP, replacing them with intrinsics.
This commit is contained in:
Mark Shannon 2023-01-06 14:47:57 +00:00 committed by GitHub
parent 659c2607f5
commit 78068126a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 151 additions and 204 deletions

View File

@ -460,10 +460,6 @@ The Python compiler currently generates the following bytecode instructions.
Unary operations take the top of the stack, apply the operation, and push the Unary operations take the top of the stack, apply the operation, and push the
result back on the stack. result back on the stack.
.. opcode:: UNARY_POSITIVE
Implements ``TOS = +TOS``.
.. opcode:: UNARY_NEGATIVE .. opcode:: UNARY_NEGATIVE
@ -906,13 +902,6 @@ iterations of the loop.
.. versionadded:: 3.6 .. versionadded:: 3.6
.. opcode:: LIST_TO_TUPLE
Pops a list from the stack and pushes a tuple containing the same values.
.. versionadded:: 3.9
.. opcode:: LIST_EXTEND (i) .. opcode:: LIST_EXTEND (i)
Calls ``list.extend(TOS1[-i], TOS)``. Used to build lists. Calls ``list.extend(TOS1[-i], TOS)``. Used to build lists.
@ -1372,14 +1361,6 @@ iterations of the loop.
.. versionadded:: 3.11 .. versionadded:: 3.11
.. opcode:: ASYNC_GEN_WRAP
Wraps the value on top of the stack in an ``async_generator_wrapped_value``.
Used to yield in async generators.
.. versionadded:: 3.11
.. opcode:: HAVE_ARGUMENT .. opcode:: HAVE_ARGUMENT
This is not really an opcode. It identifies the dividing line between This is not really an opcode. It identifies the dividing line between
@ -1411,6 +1392,9 @@ iterations of the loop.
* ``1`` Prints the argument to standard out. Used in the REPL. * ``1`` Prints the argument to standard out. Used in the REPL.
* ``2`` Performs ``import *`` for the named module. * ``2`` Performs ``import *`` for the named module.
* ``3`` Extracts the return value from a ``StopIteration`` exception. * ``3`` Extracts the return value from a ``StopIteration`` exception.
* ``4`` Wraps an aync generator value
* ``5`` Performs the unary ``+`` operation
* ``6`` Converts a list to a tuple
.. versionadded:: 3.12 .. versionadded:: 3.12

View File

@ -10,7 +10,7 @@ extern "C" {
extern PyObject *_PyGen_yf(PyGenObject *); extern PyObject *_PyGen_yf(PyGenObject *);
extern PyObject *_PyCoro_GetAwaitableIter(PyObject *o); extern PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
extern PyObject *_PyAsyncGenValueWrapperNew(PyObject *); extern PyObject *_PyAsyncGenValueWrapperNew(PyThreadState *state, PyObject *);
/* runtime lifecycle */ /* runtime lifecycle */

View File

@ -2,8 +2,11 @@
#define INTRINSIC_PRINT 1 #define INTRINSIC_PRINT 1
#define INTRINSIC_IMPORT_STAR 2 #define INTRINSIC_IMPORT_STAR 2
#define INTRINSIC_STOPITERATION_ERROR 3 #define INTRINSIC_STOPITERATION_ERROR 3
#define INTRINSIC_ASYNC_GEN_WRAP 4
#define INTRINSIC_UNARY_POSITIVE 5
#define INTRINSIC_LIST_TO_TUPLE 6
#define MAX_INTRINSIC_1 3 #define MAX_INTRINSIC_1 6
typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value); typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value);

View File

@ -54,7 +54,6 @@ const uint8_t _PyOpcode_Caches[256] = {
}; };
const uint8_t _PyOpcode_Deopt[256] = { const uint8_t _PyOpcode_Deopt[256] = {
[ASYNC_GEN_WRAP] = ASYNC_GEN_WRAP,
[BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH, [BEFORE_ASYNC_WITH] = BEFORE_ASYNC_WITH,
[BEFORE_WITH] = BEFORE_WITH, [BEFORE_WITH] = BEFORE_WITH,
[BINARY_OP] = BINARY_OP, [BINARY_OP] = BINARY_OP,
@ -145,7 +144,6 @@ const uint8_t _PyOpcode_Deopt[256] = {
[KW_NAMES] = KW_NAMES, [KW_NAMES] = KW_NAMES,
[LIST_APPEND] = LIST_APPEND, [LIST_APPEND] = LIST_APPEND,
[LIST_EXTEND] = LIST_EXTEND, [LIST_EXTEND] = LIST_EXTEND,
[LIST_TO_TUPLE] = LIST_TO_TUPLE,
[LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR, [LOAD_ASSERTION_ERROR] = LOAD_ASSERTION_ERROR,
[LOAD_ATTR] = LOAD_ATTR, [LOAD_ATTR] = LOAD_ATTR,
[LOAD_ATTR_CLASS] = LOAD_ATTR, [LOAD_ATTR_CLASS] = LOAD_ATTR,
@ -216,7 +214,6 @@ const uint8_t _PyOpcode_Deopt[256] = {
[UNARY_INVERT] = UNARY_INVERT, [UNARY_INVERT] = UNARY_INVERT,
[UNARY_NEGATIVE] = UNARY_NEGATIVE, [UNARY_NEGATIVE] = UNARY_NEGATIVE,
[UNARY_NOT] = UNARY_NOT, [UNARY_NOT] = UNARY_NOT,
[UNARY_POSITIVE] = UNARY_POSITIVE,
[UNPACK_EX] = UNPACK_EX, [UNPACK_EX] = UNPACK_EX,
[UNPACK_SEQUENCE] = UNPACK_SEQUENCE, [UNPACK_SEQUENCE] = UNPACK_SEQUENCE,
[UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE, [UNPACK_SEQUENCE_LIST] = UNPACK_SEQUENCE,
@ -239,13 +236,12 @@ static const char *const _PyOpcode_OpName[263] = {
[BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE", [BINARY_OP_ADD_UNICODE] = "BINARY_OP_ADD_UNICODE",
[BINARY_OP_INPLACE_ADD_UNICODE] = "BINARY_OP_INPLACE_ADD_UNICODE", [BINARY_OP_INPLACE_ADD_UNICODE] = "BINARY_OP_INPLACE_ADD_UNICODE",
[NOP] = "NOP", [NOP] = "NOP",
[UNARY_POSITIVE] = "UNARY_POSITIVE", [BINARY_OP_MULTIPLY_FLOAT] = "BINARY_OP_MULTIPLY_FLOAT",
[UNARY_NEGATIVE] = "UNARY_NEGATIVE", [UNARY_NEGATIVE] = "UNARY_NEGATIVE",
[UNARY_NOT] = "UNARY_NOT", [UNARY_NOT] = "UNARY_NOT",
[BINARY_OP_MULTIPLY_FLOAT] = "BINARY_OP_MULTIPLY_FLOAT",
[BINARY_OP_MULTIPLY_INT] = "BINARY_OP_MULTIPLY_INT", [BINARY_OP_MULTIPLY_INT] = "BINARY_OP_MULTIPLY_INT",
[UNARY_INVERT] = "UNARY_INVERT",
[BINARY_OP_SUBTRACT_FLOAT] = "BINARY_OP_SUBTRACT_FLOAT", [BINARY_OP_SUBTRACT_FLOAT] = "BINARY_OP_SUBTRACT_FLOAT",
[UNARY_INVERT] = "UNARY_INVERT",
[BINARY_OP_SUBTRACT_INT] = "BINARY_OP_SUBTRACT_INT", [BINARY_OP_SUBTRACT_INT] = "BINARY_OP_SUBTRACT_INT",
[BINARY_SUBSCR_DICT] = "BINARY_SUBSCR_DICT", [BINARY_SUBSCR_DICT] = "BINARY_SUBSCR_DICT",
[BINARY_SUBSCR_GETITEM] = "BINARY_SUBSCR_GETITEM", [BINARY_SUBSCR_GETITEM] = "BINARY_SUBSCR_GETITEM",
@ -254,20 +250,20 @@ static const char *const _PyOpcode_OpName[263] = {
[CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS", [CALL_PY_EXACT_ARGS] = "CALL_PY_EXACT_ARGS",
[CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS", [CALL_PY_WITH_DEFAULTS] = "CALL_PY_WITH_DEFAULTS",
[CALL_BOUND_METHOD_EXACT_ARGS] = "CALL_BOUND_METHOD_EXACT_ARGS", [CALL_BOUND_METHOD_EXACT_ARGS] = "CALL_BOUND_METHOD_EXACT_ARGS",
[CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS",
[BINARY_SUBSCR] = "BINARY_SUBSCR", [BINARY_SUBSCR] = "BINARY_SUBSCR",
[BINARY_SLICE] = "BINARY_SLICE", [BINARY_SLICE] = "BINARY_SLICE",
[STORE_SLICE] = "STORE_SLICE", [STORE_SLICE] = "STORE_SLICE",
[CALL_BUILTIN_CLASS] = "CALL_BUILTIN_CLASS",
[CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS", [CALL_BUILTIN_FAST_WITH_KEYWORDS] = "CALL_BUILTIN_FAST_WITH_KEYWORDS",
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS",
[GET_LEN] = "GET_LEN", [GET_LEN] = "GET_LEN",
[MATCH_MAPPING] = "MATCH_MAPPING", [MATCH_MAPPING] = "MATCH_MAPPING",
[MATCH_SEQUENCE] = "MATCH_SEQUENCE", [MATCH_SEQUENCE] = "MATCH_SEQUENCE",
[MATCH_KEYS] = "MATCH_KEYS", [MATCH_KEYS] = "MATCH_KEYS",
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS", [CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST",
[PUSH_EXC_INFO] = "PUSH_EXC_INFO", [PUSH_EXC_INFO] = "PUSH_EXC_INFO",
[CHECK_EXC_MATCH] = "CHECK_EXC_MATCH", [CHECK_EXC_MATCH] = "CHECK_EXC_MATCH",
[CHECK_EG_MATCH] = "CHECK_EG_MATCH", [CHECK_EG_MATCH] = "CHECK_EG_MATCH",
[CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST",
[CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O", [CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O",
[CALL_NO_KW_ISINSTANCE] = "CALL_NO_KW_ISINSTANCE", [CALL_NO_KW_ISINSTANCE] = "CALL_NO_KW_ISINSTANCE",
[CALL_NO_KW_LEN] = "CALL_NO_KW_LEN", [CALL_NO_KW_LEN] = "CALL_NO_KW_LEN",
@ -278,6 +274,7 @@ static const char *const _PyOpcode_OpName[263] = {
[CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1", [CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1",
[CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1", [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1",
[CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1", [CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1",
[COMPARE_OP_FLOAT_JUMP] = "COMPARE_OP_FLOAT_JUMP",
[WITH_EXCEPT_START] = "WITH_EXCEPT_START", [WITH_EXCEPT_START] = "WITH_EXCEPT_START",
[GET_AITER] = "GET_AITER", [GET_AITER] = "GET_AITER",
[GET_ANEXT] = "GET_ANEXT", [GET_ANEXT] = "GET_ANEXT",
@ -285,38 +282,38 @@ static const char *const _PyOpcode_OpName[263] = {
[BEFORE_WITH] = "BEFORE_WITH", [BEFORE_WITH] = "BEFORE_WITH",
[END_ASYNC_FOR] = "END_ASYNC_FOR", [END_ASYNC_FOR] = "END_ASYNC_FOR",
[CLEANUP_THROW] = "CLEANUP_THROW", [CLEANUP_THROW] = "CLEANUP_THROW",
[COMPARE_OP_FLOAT_JUMP] = "COMPARE_OP_FLOAT_JUMP",
[COMPARE_OP_INT_JUMP] = "COMPARE_OP_INT_JUMP", [COMPARE_OP_INT_JUMP] = "COMPARE_OP_INT_JUMP",
[COMPARE_OP_STR_JUMP] = "COMPARE_OP_STR_JUMP", [COMPARE_OP_STR_JUMP] = "COMPARE_OP_STR_JUMP",
[FOR_ITER_LIST] = "FOR_ITER_LIST", [FOR_ITER_LIST] = "FOR_ITER_LIST",
[FOR_ITER_TUPLE] = "FOR_ITER_TUPLE",
[STORE_SUBSCR] = "STORE_SUBSCR", [STORE_SUBSCR] = "STORE_SUBSCR",
[DELETE_SUBSCR] = "DELETE_SUBSCR", [DELETE_SUBSCR] = "DELETE_SUBSCR",
[FOR_ITER_TUPLE] = "FOR_ITER_TUPLE",
[FOR_ITER_RANGE] = "FOR_ITER_RANGE", [FOR_ITER_RANGE] = "FOR_ITER_RANGE",
[FOR_ITER_GEN] = "FOR_ITER_GEN", [FOR_ITER_GEN] = "FOR_ITER_GEN",
[LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS", [LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS",
[LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN", [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN",
[LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE", [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE",
[LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE",
[GET_ITER] = "GET_ITER", [GET_ITER] = "GET_ITER",
[GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER", [GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER",
[LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE",
[LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS",
[LOAD_ATTR_PROPERTY] = "LOAD_ATTR_PROPERTY", [LOAD_ATTR_PROPERTY] = "LOAD_ATTR_PROPERTY",
[LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS",
[LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT", [LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT",
[LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT",
[LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR", [LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR",
[RETURN_GENERATOR] = "RETURN_GENERATOR", [RETURN_GENERATOR] = "RETURN_GENERATOR",
[LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT",
[LOAD_ATTR_METHOD_LAZY_DICT] = "LOAD_ATTR_METHOD_LAZY_DICT", [LOAD_ATTR_METHOD_LAZY_DICT] = "LOAD_ATTR_METHOD_LAZY_DICT",
[LOAD_ATTR_METHOD_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT", [LOAD_ATTR_METHOD_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT",
[LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES", [LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES",
[LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST", [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST",
[LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST", [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST",
[LIST_TO_TUPLE] = "LIST_TO_TUPLE",
[RETURN_VALUE] = "RETURN_VALUE",
[LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST", [LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST",
[SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS",
[LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN", [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN",
[ASYNC_GEN_WRAP] = "ASYNC_GEN_WRAP", [RETURN_VALUE] = "RETURN_VALUE",
[LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE",
[SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS",
[STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE",
[STORE_ATTR_SLOT] = "STORE_ATTR_SLOT",
[PREP_RERAISE_STAR] = "PREP_RERAISE_STAR", [PREP_RERAISE_STAR] = "PREP_RERAISE_STAR",
[POP_EXCEPT] = "POP_EXCEPT", [POP_EXCEPT] = "POP_EXCEPT",
[STORE_NAME] = "STORE_NAME", [STORE_NAME] = "STORE_NAME",
@ -342,7 +339,7 @@ static const char *const _PyOpcode_OpName[263] = {
[JUMP_FORWARD] = "JUMP_FORWARD", [JUMP_FORWARD] = "JUMP_FORWARD",
[JUMP_IF_FALSE_OR_POP] = "JUMP_IF_FALSE_OR_POP", [JUMP_IF_FALSE_OR_POP] = "JUMP_IF_FALSE_OR_POP",
[JUMP_IF_TRUE_OR_POP] = "JUMP_IF_TRUE_OR_POP", [JUMP_IF_TRUE_OR_POP] = "JUMP_IF_TRUE_OR_POP",
[LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE", [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT",
[POP_JUMP_IF_FALSE] = "POP_JUMP_IF_FALSE", [POP_JUMP_IF_FALSE] = "POP_JUMP_IF_FALSE",
[POP_JUMP_IF_TRUE] = "POP_JUMP_IF_TRUE", [POP_JUMP_IF_TRUE] = "POP_JUMP_IF_TRUE",
[LOAD_GLOBAL] = "LOAD_GLOBAL", [LOAD_GLOBAL] = "LOAD_GLOBAL",
@ -350,7 +347,7 @@ static const char *const _PyOpcode_OpName[263] = {
[CONTAINS_OP] = "CONTAINS_OP", [CONTAINS_OP] = "CONTAINS_OP",
[RERAISE] = "RERAISE", [RERAISE] = "RERAISE",
[COPY] = "COPY", [COPY] = "COPY",
[STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", [STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST",
[BINARY_OP] = "BINARY_OP", [BINARY_OP] = "BINARY_OP",
[SEND] = "SEND", [SEND] = "SEND",
[LOAD_FAST] = "LOAD_FAST", [LOAD_FAST] = "LOAD_FAST",
@ -370,9 +367,9 @@ static const char *const _PyOpcode_OpName[263] = {
[STORE_DEREF] = "STORE_DEREF", [STORE_DEREF] = "STORE_DEREF",
[DELETE_DEREF] = "DELETE_DEREF", [DELETE_DEREF] = "DELETE_DEREF",
[JUMP_BACKWARD] = "JUMP_BACKWARD", [JUMP_BACKWARD] = "JUMP_BACKWARD",
[STORE_ATTR_SLOT] = "STORE_ATTR_SLOT", [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST",
[CALL_FUNCTION_EX] = "CALL_FUNCTION_EX", [CALL_FUNCTION_EX] = "CALL_FUNCTION_EX",
[STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT", [STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT",
[EXTENDED_ARG] = "EXTENDED_ARG", [EXTENDED_ARG] = "EXTENDED_ARG",
[LIST_APPEND] = "LIST_APPEND", [LIST_APPEND] = "LIST_APPEND",
[SET_ADD] = "SET_ADD", [SET_ADD] = "SET_ADD",
@ -382,20 +379,20 @@ static const char *const _PyOpcode_OpName[263] = {
[YIELD_VALUE] = "YIELD_VALUE", [YIELD_VALUE] = "YIELD_VALUE",
[RESUME] = "RESUME", [RESUME] = "RESUME",
[MATCH_CLASS] = "MATCH_CLASS", [MATCH_CLASS] = "MATCH_CLASS",
[STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST", [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT",
[STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST", [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST",
[FORMAT_VALUE] = "FORMAT_VALUE", [FORMAT_VALUE] = "FORMAT_VALUE",
[BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP", [BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP",
[BUILD_STRING] = "BUILD_STRING", [BUILD_STRING] = "BUILD_STRING",
[STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT",
[STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT",
[UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST",
[UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE", [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE",
[UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE",
[160] = "<160>",
[161] = "<161>",
[LIST_EXTEND] = "LIST_EXTEND", [LIST_EXTEND] = "LIST_EXTEND",
[SET_UPDATE] = "SET_UPDATE", [SET_UPDATE] = "SET_UPDATE",
[DICT_MERGE] = "DICT_MERGE", [DICT_MERGE] = "DICT_MERGE",
[DICT_UPDATE] = "DICT_UPDATE", [DICT_UPDATE] = "DICT_UPDATE",
[UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", [166] = "<166>",
[167] = "<167>", [167] = "<167>",
[168] = "<168>", [168] = "<168>",
[169] = "<169>", [169] = "<169>",
@ -496,6 +493,9 @@ static const char *const _PyOpcode_OpName[263] = {
#endif #endif
#define EXTRA_CASES \ #define EXTRA_CASES \
case 160: \
case 161: \
case 166: \
case 167: \ case 167: \
case 168: \ case 168: \
case 169: \ case 169: \

117
Include/opcode.h generated
View File

@ -14,7 +14,6 @@ extern "C" {
#define INTERPRETER_EXIT 3 #define INTERPRETER_EXIT 3
#define END_FOR 4 #define END_FOR 4
#define NOP 9 #define NOP 9
#define UNARY_POSITIVE 10
#define UNARY_NEGATIVE 11 #define UNARY_NEGATIVE 11
#define UNARY_NOT 12 #define UNARY_NOT 12
#define UNARY_INVERT 15 #define UNARY_INVERT 15
@ -42,10 +41,8 @@ extern "C" {
#define LOAD_BUILD_CLASS 71 #define LOAD_BUILD_CLASS 71
#define LOAD_ASSERTION_ERROR 74 #define LOAD_ASSERTION_ERROR 74
#define RETURN_GENERATOR 75 #define RETURN_GENERATOR 75
#define LIST_TO_TUPLE 82
#define RETURN_VALUE 83 #define RETURN_VALUE 83
#define SETUP_ANNOTATIONS 85 #define SETUP_ANNOTATIONS 85
#define ASYNC_GEN_WRAP 87
#define PREP_RERAISE_STAR 88 #define PREP_RERAISE_STAR 88
#define POP_EXCEPT 89 #define POP_EXCEPT 89
#define HAVE_ARGUMENT 90 #define HAVE_ARGUMENT 90
@ -131,63 +128,63 @@ extern "C" {
#define BINARY_OP_ADD_INT 6 #define BINARY_OP_ADD_INT 6
#define BINARY_OP_ADD_UNICODE 7 #define BINARY_OP_ADD_UNICODE 7
#define BINARY_OP_INPLACE_ADD_UNICODE 8 #define BINARY_OP_INPLACE_ADD_UNICODE 8
#define BINARY_OP_MULTIPLY_FLOAT 13 #define BINARY_OP_MULTIPLY_FLOAT 10
#define BINARY_OP_MULTIPLY_INT 14 #define BINARY_OP_MULTIPLY_INT 13
#define BINARY_OP_SUBTRACT_FLOAT 16 #define BINARY_OP_SUBTRACT_FLOAT 14
#define BINARY_OP_SUBTRACT_INT 17 #define BINARY_OP_SUBTRACT_INT 16
#define BINARY_SUBSCR_DICT 18 #define BINARY_SUBSCR_DICT 17
#define BINARY_SUBSCR_GETITEM 19 #define BINARY_SUBSCR_GETITEM 18
#define BINARY_SUBSCR_LIST_INT 20 #define BINARY_SUBSCR_LIST_INT 19
#define BINARY_SUBSCR_TUPLE_INT 21 #define BINARY_SUBSCR_TUPLE_INT 20
#define CALL_PY_EXACT_ARGS 22 #define CALL_PY_EXACT_ARGS 21
#define CALL_PY_WITH_DEFAULTS 23 #define CALL_PY_WITH_DEFAULTS 22
#define CALL_BOUND_METHOD_EXACT_ARGS 24 #define CALL_BOUND_METHOD_EXACT_ARGS 23
#define CALL_BUILTIN_CLASS 28 #define CALL_BUILTIN_CLASS 24
#define CALL_BUILTIN_FAST_WITH_KEYWORDS 29 #define CALL_BUILTIN_FAST_WITH_KEYWORDS 28
#define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 34 #define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 29
#define CALL_NO_KW_BUILTIN_FAST 38 #define CALL_NO_KW_BUILTIN_FAST 34
#define CALL_NO_KW_BUILTIN_O 39 #define CALL_NO_KW_BUILTIN_O 38
#define CALL_NO_KW_ISINSTANCE 40 #define CALL_NO_KW_ISINSTANCE 39
#define CALL_NO_KW_LEN 41 #define CALL_NO_KW_LEN 40
#define CALL_NO_KW_LIST_APPEND 42 #define CALL_NO_KW_LIST_APPEND 41
#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 43 #define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 42
#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 44 #define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 43
#define CALL_NO_KW_METHOD_DESCRIPTOR_O 45 #define CALL_NO_KW_METHOD_DESCRIPTOR_O 44
#define CALL_NO_KW_STR_1 46 #define CALL_NO_KW_STR_1 45
#define CALL_NO_KW_TUPLE_1 47 #define CALL_NO_KW_TUPLE_1 46
#define CALL_NO_KW_TYPE_1 48 #define CALL_NO_KW_TYPE_1 47
#define COMPARE_OP_FLOAT_JUMP 56 #define COMPARE_OP_FLOAT_JUMP 48
#define COMPARE_OP_INT_JUMP 57 #define COMPARE_OP_INT_JUMP 56
#define COMPARE_OP_STR_JUMP 58 #define COMPARE_OP_STR_JUMP 57
#define FOR_ITER_LIST 59 #define FOR_ITER_LIST 58
#define FOR_ITER_TUPLE 62 #define FOR_ITER_TUPLE 59
#define FOR_ITER_RANGE 63 #define FOR_ITER_RANGE 62
#define FOR_ITER_GEN 64 #define FOR_ITER_GEN 63
#define LOAD_ATTR_CLASS 65 #define LOAD_ATTR_CLASS 64
#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 66 #define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 65
#define LOAD_ATTR_INSTANCE_VALUE 67 #define LOAD_ATTR_INSTANCE_VALUE 66
#define LOAD_ATTR_MODULE 70 #define LOAD_ATTR_MODULE 67
#define LOAD_ATTR_PROPERTY 72 #define LOAD_ATTR_PROPERTY 70
#define LOAD_ATTR_SLOT 73 #define LOAD_ATTR_SLOT 72
#define LOAD_ATTR_WITH_HINT 76 #define LOAD_ATTR_WITH_HINT 73
#define LOAD_ATTR_METHOD_LAZY_DICT 77 #define LOAD_ATTR_METHOD_LAZY_DICT 76
#define LOAD_ATTR_METHOD_NO_DICT 78 #define LOAD_ATTR_METHOD_NO_DICT 77
#define LOAD_ATTR_METHOD_WITH_VALUES 79 #define LOAD_ATTR_METHOD_WITH_VALUES 78
#define LOAD_CONST__LOAD_FAST 80 #define LOAD_CONST__LOAD_FAST 79
#define LOAD_FAST__LOAD_CONST 81 #define LOAD_FAST__LOAD_CONST 80
#define LOAD_FAST__LOAD_FAST 84 #define LOAD_FAST__LOAD_FAST 81
#define LOAD_GLOBAL_BUILTIN 86 #define LOAD_GLOBAL_BUILTIN 82
#define LOAD_GLOBAL_MODULE 113 #define LOAD_GLOBAL_MODULE 84
#define STORE_ATTR_INSTANCE_VALUE 121 #define STORE_ATTR_INSTANCE_VALUE 86
#define STORE_ATTR_SLOT 141 #define STORE_ATTR_SLOT 87
#define STORE_ATTR_WITH_HINT 143 #define STORE_ATTR_WITH_HINT 113
#define STORE_FAST__LOAD_FAST 153 #define STORE_FAST__LOAD_FAST 121
#define STORE_FAST__STORE_FAST 154 #define STORE_FAST__STORE_FAST 141
#define STORE_SUBSCR_DICT 158 #define STORE_SUBSCR_DICT 143
#define STORE_SUBSCR_LIST_INT 159 #define STORE_SUBSCR_LIST_INT 153
#define UNPACK_SEQUENCE_LIST 160 #define UNPACK_SEQUENCE_LIST 154
#define UNPACK_SEQUENCE_TUPLE 161 #define UNPACK_SEQUENCE_TUPLE 158
#define UNPACK_SEQUENCE_TWO_TUPLE 166 #define UNPACK_SEQUENCE_TWO_TUPLE 159
#define DO_TRACING 255 #define DO_TRACING 255
#define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\ #define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\

View File

@ -427,6 +427,7 @@ _code_type = type(_write_atomic.__code__)
# Python 3.12a1 3511 (Add STOPITERATION_ERROR instruction) # Python 3.12a1 3511 (Add STOPITERATION_ERROR instruction)
# Python 3.12a1 3512 (Remove all unused consts from code objects) # Python 3.12a1 3512 (Remove all unused consts from code objects)
# Python 3.12a1 3513 (Add CALL_INTRINSIC_1 instruction, removed STOPITERATION_ERROR, PRINT_EXPR, IMPORT_STAR) # Python 3.12a1 3513 (Add CALL_INTRINSIC_1 instruction, removed STOPITERATION_ERROR, PRINT_EXPR, IMPORT_STAR)
# Python 3.12a1 3514 (Remove ASYNC_GEN_WRAP, LIST_TO_TUPLE, and UNARY_POSITIVE)
# Python 3.13 will start with 3550 # Python 3.13 will start with 3550
@ -439,7 +440,7 @@ _code_type = type(_write_atomic.__code__)
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated. # in PC/launcher.c must also be updated.
MAGIC_NUMBER = (3513).to_bytes(2, 'little') + b'\r\n' MAGIC_NUMBER = (3514).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c

View File

@ -82,7 +82,7 @@ def_op('INTERPRETER_EXIT', 3)
def_op('END_FOR', 4) def_op('END_FOR', 4)
def_op('NOP', 9) def_op('NOP', 9)
def_op('UNARY_POSITIVE', 10)
def_op('UNARY_NEGATIVE', 11) def_op('UNARY_NEGATIVE', 11)
def_op('UNARY_NOT', 12) def_op('UNARY_NOT', 12)
@ -120,12 +120,10 @@ def_op('LOAD_BUILD_CLASS', 71)
def_op('LOAD_ASSERTION_ERROR', 74) def_op('LOAD_ASSERTION_ERROR', 74)
def_op('RETURN_GENERATOR', 75) def_op('RETURN_GENERATOR', 75)
def_op('LIST_TO_TUPLE', 82)
def_op('RETURN_VALUE', 83) def_op('RETURN_VALUE', 83)
def_op('SETUP_ANNOTATIONS', 85) def_op('SETUP_ANNOTATIONS', 85)
def_op('ASYNC_GEN_WRAP', 87)
def_op('PREP_RERAISE_STAR', 88) def_op('PREP_RERAISE_STAR', 88)
def_op('POP_EXCEPT', 89) def_op('POP_EXCEPT', 89)

View File

@ -54,7 +54,7 @@ class TestLLTrace(unittest.TestCase):
""") """)
self.assertIn("GET_ITER", stdout) self.assertIn("GET_ITER", stdout)
self.assertIn("FOR_ITER", stdout) self.assertIn("FOR_ITER", stdout)
self.assertIn("UNARY_POSITIVE", stdout) self.assertIn("CALL_INTRINSIC_1", stdout)
self.assertIn("POP_TOP", stdout) self.assertIn("POP_TOP", stdout)
self.assertNotIn("BINARY_OP", stdout) self.assertNotIn("BINARY_OP", stdout)
self.assertNotIn("UNARY_NEGATIVE", stdout) self.assertNotIn("UNARY_NEGATIVE", stdout)

View File

@ -0,0 +1,2 @@
Remove :opcode:`UNARY_POSITIVE`, :opcode:`ASYNC_GEN_WRAP` and
:opcode:`LIST_TO_TUPLE`, replacing them with intrinsics.

View File

@ -1970,13 +1970,13 @@ PyTypeObject _PyAsyncGenWrappedValue_Type = {
PyObject * PyObject *
_PyAsyncGenValueWrapperNew(PyObject *val) _PyAsyncGenValueWrapperNew(PyThreadState *tstate, PyObject *val)
{ {
_PyAsyncGenWrappedValue *o; _PyAsyncGenWrappedValue *o;
assert(val); assert(val);
#if _PyAsyncGen_MAXFREELIST > 0 #if _PyAsyncGen_MAXFREELIST > 0
struct _Py_async_gen_state *state = get_async_gen_state(); struct _Py_async_gen_state *state = &tstate->interp->async_gen;
#ifdef Py_DEBUG #ifdef Py_DEBUG
// _PyAsyncGenValueWrapperNew() must not be called after _PyAsyncGen_Fini() // _PyAsyncGenValueWrapperNew() must not be called after _PyAsyncGen_Fini()
assert(state->value_numfree != -1); assert(state->value_numfree != -1);

View File

@ -173,12 +173,6 @@ dummy_func(
macro(END_FOR) = POP_TOP + POP_TOP; macro(END_FOR) = POP_TOP + POP_TOP;
inst(UNARY_POSITIVE, (value -- res)) {
res = PyNumber_Positive(value);
DECREF_INPUTS();
ERROR_IF(res == NULL, error);
}
inst(UNARY_NEGATIVE, (value -- res)) { inst(UNARY_NEGATIVE, (value -- res)) {
res = PyNumber_Negative(value); res = PyNumber_Negative(value);
DECREF_INPUTS(); DECREF_INPUTS();
@ -757,13 +751,6 @@ dummy_func(
} }
} }
inst(ASYNC_GEN_WRAP, (v -- w)) {
assert(frame->f_code->co_flags & CO_ASYNC_GENERATOR);
w = _PyAsyncGenValueWrapperNew(v);
DECREF_INPUTS();
ERROR_IF(w == NULL, error);
}
inst(YIELD_VALUE, (retval -- unused)) { inst(YIELD_VALUE, (retval -- unused)) {
// NOTE: It's important that YIELD_VALUE never raises an exception! // NOTE: It's important that YIELD_VALUE never raises an exception!
// The compiler treats any exception raised here as a failed close() // The compiler treats any exception raised here as a failed close()
@ -1348,12 +1335,6 @@ dummy_func(
PUSH(list); PUSH(list);
} }
inst(LIST_TO_TUPLE, (list -- tuple)) {
tuple = PyList_AsTuple(list);
DECREF_INPUTS();
ERROR_IF(tuple == NULL, error);
}
inst(LIST_EXTEND, (iterable -- )) { inst(LIST_EXTEND, (iterable -- )) {
PyObject *list = PEEK(oparg + 1); // iterable is still on the stack PyObject *list = PEEK(oparg + 1); // iterable is still on the stack
PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable);

View File

@ -1090,7 +1090,6 @@ stack_effect(int opcode, int oparg, int jump)
return -2; return -2;
/* Unary operators */ /* Unary operators */
case UNARY_POSITIVE:
case UNARY_NEGATIVE: case UNARY_NEGATIVE:
case UNARY_NOT: case UNARY_NOT:
case UNARY_INVERT: case UNARY_INVERT:
@ -1123,7 +1122,6 @@ stack_effect(int opcode, int oparg, int jump)
return -1; return -1;
case SETUP_ANNOTATIONS: case SETUP_ANNOTATIONS:
return 0; return 0;
case ASYNC_GEN_WRAP:
case YIELD_VALUE: case YIELD_VALUE:
return 0; return 0;
case POP_BLOCK: case POP_BLOCK:
@ -1296,8 +1294,6 @@ stack_effect(int opcode, int oparg, int jump)
return 1; return 1;
case LOAD_ASSERTION_ERROR: case LOAD_ASSERTION_ERROR:
return 1; return 1;
case LIST_TO_TUPLE:
return 0;
case LIST_EXTEND: case LIST_EXTEND:
case SET_UPDATE: case SET_UPDATE:
case DICT_MERGE: case DICT_MERGE:
@ -4122,8 +4118,6 @@ unaryop(unaryop_ty op)
return UNARY_INVERT; return UNARY_INVERT;
case Not: case Not:
return UNARY_NOT; return UNARY_NOT;
case UAdd:
return UNARY_POSITIVE;
case USub: case USub:
return UNARY_NEGATIVE; return UNARY_NEGATIVE;
default: default:
@ -4191,7 +4185,7 @@ addop_binary(struct compiler *c, location loc, operator_ty binop,
static int static int
addop_yield(struct compiler *c, location loc) { addop_yield(struct compiler *c, location loc) {
if (c->u->u_ste->ste_generator && c->u->u_ste->ste_coroutine) { if (c->u->u_ste->ste_generator && c->u->u_ste->ste_coroutine) {
ADDOP(c, loc, ASYNC_GEN_WRAP); ADDOP_I(c, loc, CALL_INTRINSIC_1, INTRINSIC_ASYNC_GEN_WRAP);
} }
ADDOP_I(c, loc, YIELD_VALUE, 0); ADDOP_I(c, loc, YIELD_VALUE, 0);
ADDOP_I(c, loc, RESUME, 1); ADDOP_I(c, loc, RESUME, 1);
@ -4358,7 +4352,7 @@ starunpack_helper(struct compiler *c, location loc,
ADDOP_LOAD_CONST_NEW(c, loc, folded); ADDOP_LOAD_CONST_NEW(c, loc, folded);
ADDOP_I(c, loc, extend, 1); ADDOP_I(c, loc, extend, 1);
if (tuple) { if (tuple) {
ADDOP(c, loc, LIST_TO_TUPLE); ADDOP_I(c, loc, CALL_INTRINSIC_1, INTRINSIC_LIST_TO_TUPLE);
} }
} }
return SUCCESS; return SUCCESS;
@ -4409,7 +4403,7 @@ starunpack_helper(struct compiler *c, location loc,
} }
assert(sequence_built); assert(sequence_built);
if (tuple) { if (tuple) {
ADDOP(c, loc, LIST_TO_TUPLE); ADDOP_I(c, loc, CALL_INTRINSIC_1, INTRINSIC_LIST_TO_TUPLE);
} }
return SUCCESS; return SUCCESS;
} }
@ -5784,7 +5778,12 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
break; break;
case UnaryOp_kind: case UnaryOp_kind:
VISIT(c, expr, e->v.UnaryOp.operand); VISIT(c, expr, e->v.UnaryOp.operand);
ADDOP(c, loc, unaryop(e->v.UnaryOp.op)); if (e->v.UnaryOp.op == UAdd) {
ADDOP_I(c, loc, CALL_INTRINSIC_1, INTRINSIC_UNARY_POSITIVE);
}
else {
ADDOP(c, loc, unaryop(e->v.UnaryOp.op));
}
break; break;
case Lambda_kind: case Lambda_kind:
return compiler_lambda(c, e); return compiler_lambda(c, e);

View File

@ -202,16 +202,6 @@
DISPATCH(); DISPATCH();
} }
TARGET(UNARY_POSITIVE) {
PyObject *value = PEEK(1);
PyObject *res;
res = PyNumber_Positive(value);
Py_DECREF(value);
if (res == NULL) goto pop_1_error;
POKE(1, res);
DISPATCH();
}
TARGET(UNARY_NEGATIVE) { TARGET(UNARY_NEGATIVE) {
PyObject *value = PEEK(1); PyObject *value = PEEK(1);
PyObject *res; PyObject *res;
@ -921,17 +911,6 @@
DISPATCH(); DISPATCH();
} }
TARGET(ASYNC_GEN_WRAP) {
PyObject *v = PEEK(1);
PyObject *w;
assert(frame->f_code->co_flags & CO_ASYNC_GENERATOR);
w = _PyAsyncGenValueWrapperNew(v);
Py_DECREF(v);
if (w == NULL) goto pop_1_error;
POKE(1, w);
DISPATCH();
}
TARGET(YIELD_VALUE) { TARGET(YIELD_VALUE) {
PyObject *retval = PEEK(1); PyObject *retval = PEEK(1);
// NOTE: It's important that YIELD_VALUE never raises an exception! // NOTE: It's important that YIELD_VALUE never raises an exception!
@ -1566,16 +1545,6 @@
DISPATCH(); DISPATCH();
} }
TARGET(LIST_TO_TUPLE) {
PyObject *list = PEEK(1);
PyObject *tuple;
tuple = PyList_AsTuple(list);
Py_DECREF(list);
if (tuple == NULL) goto pop_1_error;
POKE(1, tuple);
DISPATCH();
}
TARGET(LIST_EXTEND) { TARGET(LIST_EXTEND) {
PyObject *iterable = PEEK(1); PyObject *iterable = PEEK(1);
PyObject *list = PEEK(oparg + 1); // iterable is still on the stack PyObject *list = PEEK(oparg + 1); // iterable is still on the stack

View File

@ -185,10 +185,26 @@ stopiteration_error(PyThreadState* tstate, PyObject *exc)
return Py_NewRef(exc); return Py_NewRef(exc);
} }
static PyObject *
unary_pos(PyThreadState* unused, PyObject *value)
{
return PyNumber_Positive(value);
}
static PyObject *
list_to_tuple(PyThreadState* unused, PyObject *v)
{
assert(PyList_Check(v));
return _PyTuple_FromArray(((PyListObject *)v)->ob_item, Py_SIZE(v));
}
instrinsic_func1 instrinsic_func1
_PyIntrinsics_UnaryFunctions[] = { _PyIntrinsics_UnaryFunctions[] = {
[0] = no_intrinsic, [0] = no_intrinsic,
[INTRINSIC_PRINT] = print_expr, [INTRINSIC_PRINT] = print_expr,
[INTRINSIC_IMPORT_STAR] = import_star, [INTRINSIC_IMPORT_STAR] = import_star,
[INTRINSIC_STOPITERATION_ERROR] = stopiteration_error, [INTRINSIC_STOPITERATION_ERROR] = stopiteration_error,
[INTRINSIC_ASYNC_GEN_WRAP] = _PyAsyncGenValueWrapperNew,
[INTRINSIC_UNARY_POSITIVE] = unary_pos,
[INTRINSIC_LIST_TO_TUPLE] = list_to_tuple,
}; };

View File

@ -26,7 +26,6 @@ static const struct {
[POP_TOP] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [POP_TOP] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[PUSH_NULL] = { 0, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [PUSH_NULL] = { 0, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[END_FOR] = { 2, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [END_FOR] = { 2, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[UNARY_POSITIVE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[UNARY_NEGATIVE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [UNARY_NEGATIVE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[UNARY_NOT] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [UNARY_NOT] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[UNARY_INVERT] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [UNARY_INVERT] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
@ -59,7 +58,6 @@ static const struct {
[GET_ANEXT] = { 1, 2, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [GET_ANEXT] = { 1, 2, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[GET_AWAITABLE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [GET_AWAITABLE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[SEND] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [SEND] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[ASYNC_GEN_WRAP] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[YIELD_VALUE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [YIELD_VALUE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[POP_EXCEPT] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [POP_EXCEPT] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[RERAISE] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [RERAISE] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
@ -93,7 +91,6 @@ static const struct {
[BUILD_STRING] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [BUILD_STRING] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[BUILD_TUPLE] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [BUILD_TUPLE] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[BUILD_LIST] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [BUILD_LIST] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[LIST_TO_TUPLE] = { 1, 1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[LIST_EXTEND] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [LIST_EXTEND] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[SET_UPDATE] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [SET_UPDATE] = { 1, 0, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },
[BUILD_SET] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" }, [BUILD_SET] = { -1, -1, DIR_NONE, DIR_NONE, DIR_NONE, true, "IB" },

View File

@ -9,13 +9,12 @@ static void *opcode_targets[256] = {
&&TARGET_BINARY_OP_ADD_UNICODE, &&TARGET_BINARY_OP_ADD_UNICODE,
&&TARGET_BINARY_OP_INPLACE_ADD_UNICODE, &&TARGET_BINARY_OP_INPLACE_ADD_UNICODE,
&&TARGET_NOP, &&TARGET_NOP,
&&TARGET_UNARY_POSITIVE, &&TARGET_BINARY_OP_MULTIPLY_FLOAT,
&&TARGET_UNARY_NEGATIVE, &&TARGET_UNARY_NEGATIVE,
&&TARGET_UNARY_NOT, &&TARGET_UNARY_NOT,
&&TARGET_BINARY_OP_MULTIPLY_FLOAT,
&&TARGET_BINARY_OP_MULTIPLY_INT, &&TARGET_BINARY_OP_MULTIPLY_INT,
&&TARGET_UNARY_INVERT,
&&TARGET_BINARY_OP_SUBTRACT_FLOAT, &&TARGET_BINARY_OP_SUBTRACT_FLOAT,
&&TARGET_UNARY_INVERT,
&&TARGET_BINARY_OP_SUBTRACT_INT, &&TARGET_BINARY_OP_SUBTRACT_INT,
&&TARGET_BINARY_SUBSCR_DICT, &&TARGET_BINARY_SUBSCR_DICT,
&&TARGET_BINARY_SUBSCR_GETITEM, &&TARGET_BINARY_SUBSCR_GETITEM,
@ -24,20 +23,20 @@ static void *opcode_targets[256] = {
&&TARGET_CALL_PY_EXACT_ARGS, &&TARGET_CALL_PY_EXACT_ARGS,
&&TARGET_CALL_PY_WITH_DEFAULTS, &&TARGET_CALL_PY_WITH_DEFAULTS,
&&TARGET_CALL_BOUND_METHOD_EXACT_ARGS, &&TARGET_CALL_BOUND_METHOD_EXACT_ARGS,
&&TARGET_CALL_BUILTIN_CLASS,
&&TARGET_BINARY_SUBSCR, &&TARGET_BINARY_SUBSCR,
&&TARGET_BINARY_SLICE, &&TARGET_BINARY_SLICE,
&&TARGET_STORE_SLICE, &&TARGET_STORE_SLICE,
&&TARGET_CALL_BUILTIN_CLASS,
&&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS, &&TARGET_CALL_BUILTIN_FAST_WITH_KEYWORDS,
&&TARGET_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS,
&&TARGET_GET_LEN, &&TARGET_GET_LEN,
&&TARGET_MATCH_MAPPING, &&TARGET_MATCH_MAPPING,
&&TARGET_MATCH_SEQUENCE, &&TARGET_MATCH_SEQUENCE,
&&TARGET_MATCH_KEYS, &&TARGET_MATCH_KEYS,
&&TARGET_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, &&TARGET_CALL_NO_KW_BUILTIN_FAST,
&&TARGET_PUSH_EXC_INFO, &&TARGET_PUSH_EXC_INFO,
&&TARGET_CHECK_EXC_MATCH, &&TARGET_CHECK_EXC_MATCH,
&&TARGET_CHECK_EG_MATCH, &&TARGET_CHECK_EG_MATCH,
&&TARGET_CALL_NO_KW_BUILTIN_FAST,
&&TARGET_CALL_NO_KW_BUILTIN_O, &&TARGET_CALL_NO_KW_BUILTIN_O,
&&TARGET_CALL_NO_KW_ISINSTANCE, &&TARGET_CALL_NO_KW_ISINSTANCE,
&&TARGET_CALL_NO_KW_LEN, &&TARGET_CALL_NO_KW_LEN,
@ -48,6 +47,7 @@ static void *opcode_targets[256] = {
&&TARGET_CALL_NO_KW_STR_1, &&TARGET_CALL_NO_KW_STR_1,
&&TARGET_CALL_NO_KW_TUPLE_1, &&TARGET_CALL_NO_KW_TUPLE_1,
&&TARGET_CALL_NO_KW_TYPE_1, &&TARGET_CALL_NO_KW_TYPE_1,
&&TARGET_COMPARE_OP_FLOAT_JUMP,
&&TARGET_WITH_EXCEPT_START, &&TARGET_WITH_EXCEPT_START,
&&TARGET_GET_AITER, &&TARGET_GET_AITER,
&&TARGET_GET_ANEXT, &&TARGET_GET_ANEXT,
@ -55,38 +55,38 @@ static void *opcode_targets[256] = {
&&TARGET_BEFORE_WITH, &&TARGET_BEFORE_WITH,
&&TARGET_END_ASYNC_FOR, &&TARGET_END_ASYNC_FOR,
&&TARGET_CLEANUP_THROW, &&TARGET_CLEANUP_THROW,
&&TARGET_COMPARE_OP_FLOAT_JUMP,
&&TARGET_COMPARE_OP_INT_JUMP, &&TARGET_COMPARE_OP_INT_JUMP,
&&TARGET_COMPARE_OP_STR_JUMP, &&TARGET_COMPARE_OP_STR_JUMP,
&&TARGET_FOR_ITER_LIST, &&TARGET_FOR_ITER_LIST,
&&TARGET_FOR_ITER_TUPLE,
&&TARGET_STORE_SUBSCR, &&TARGET_STORE_SUBSCR,
&&TARGET_DELETE_SUBSCR, &&TARGET_DELETE_SUBSCR,
&&TARGET_FOR_ITER_TUPLE,
&&TARGET_FOR_ITER_RANGE, &&TARGET_FOR_ITER_RANGE,
&&TARGET_FOR_ITER_GEN, &&TARGET_FOR_ITER_GEN,
&&TARGET_LOAD_ATTR_CLASS, &&TARGET_LOAD_ATTR_CLASS,
&&TARGET_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN, &&TARGET_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN,
&&TARGET_LOAD_ATTR_INSTANCE_VALUE, &&TARGET_LOAD_ATTR_INSTANCE_VALUE,
&&TARGET_LOAD_ATTR_MODULE,
&&TARGET_GET_ITER, &&TARGET_GET_ITER,
&&TARGET_GET_YIELD_FROM_ITER, &&TARGET_GET_YIELD_FROM_ITER,
&&TARGET_LOAD_ATTR_MODULE,
&&TARGET_LOAD_BUILD_CLASS,
&&TARGET_LOAD_ATTR_PROPERTY, &&TARGET_LOAD_ATTR_PROPERTY,
&&TARGET_LOAD_BUILD_CLASS,
&&TARGET_LOAD_ATTR_SLOT, &&TARGET_LOAD_ATTR_SLOT,
&&TARGET_LOAD_ATTR_WITH_HINT,
&&TARGET_LOAD_ASSERTION_ERROR, &&TARGET_LOAD_ASSERTION_ERROR,
&&TARGET_RETURN_GENERATOR, &&TARGET_RETURN_GENERATOR,
&&TARGET_LOAD_ATTR_WITH_HINT,
&&TARGET_LOAD_ATTR_METHOD_LAZY_DICT, &&TARGET_LOAD_ATTR_METHOD_LAZY_DICT,
&&TARGET_LOAD_ATTR_METHOD_NO_DICT, &&TARGET_LOAD_ATTR_METHOD_NO_DICT,
&&TARGET_LOAD_ATTR_METHOD_WITH_VALUES, &&TARGET_LOAD_ATTR_METHOD_WITH_VALUES,
&&TARGET_LOAD_CONST__LOAD_FAST, &&TARGET_LOAD_CONST__LOAD_FAST,
&&TARGET_LOAD_FAST__LOAD_CONST, &&TARGET_LOAD_FAST__LOAD_CONST,
&&TARGET_LIST_TO_TUPLE,
&&TARGET_RETURN_VALUE,
&&TARGET_LOAD_FAST__LOAD_FAST, &&TARGET_LOAD_FAST__LOAD_FAST,
&&TARGET_SETUP_ANNOTATIONS,
&&TARGET_LOAD_GLOBAL_BUILTIN, &&TARGET_LOAD_GLOBAL_BUILTIN,
&&TARGET_ASYNC_GEN_WRAP, &&TARGET_RETURN_VALUE,
&&TARGET_LOAD_GLOBAL_MODULE,
&&TARGET_SETUP_ANNOTATIONS,
&&TARGET_STORE_ATTR_INSTANCE_VALUE,
&&TARGET_STORE_ATTR_SLOT,
&&TARGET_PREP_RERAISE_STAR, &&TARGET_PREP_RERAISE_STAR,
&&TARGET_POP_EXCEPT, &&TARGET_POP_EXCEPT,
&&TARGET_STORE_NAME, &&TARGET_STORE_NAME,
@ -112,7 +112,7 @@ static void *opcode_targets[256] = {
&&TARGET_JUMP_FORWARD, &&TARGET_JUMP_FORWARD,
&&TARGET_JUMP_IF_FALSE_OR_POP, &&TARGET_JUMP_IF_FALSE_OR_POP,
&&TARGET_JUMP_IF_TRUE_OR_POP, &&TARGET_JUMP_IF_TRUE_OR_POP,
&&TARGET_LOAD_GLOBAL_MODULE, &&TARGET_STORE_ATTR_WITH_HINT,
&&TARGET_POP_JUMP_IF_FALSE, &&TARGET_POP_JUMP_IF_FALSE,
&&TARGET_POP_JUMP_IF_TRUE, &&TARGET_POP_JUMP_IF_TRUE,
&&TARGET_LOAD_GLOBAL, &&TARGET_LOAD_GLOBAL,
@ -120,7 +120,7 @@ static void *opcode_targets[256] = {
&&TARGET_CONTAINS_OP, &&TARGET_CONTAINS_OP,
&&TARGET_RERAISE, &&TARGET_RERAISE,
&&TARGET_COPY, &&TARGET_COPY,
&&TARGET_STORE_ATTR_INSTANCE_VALUE, &&TARGET_STORE_FAST__LOAD_FAST,
&&TARGET_BINARY_OP, &&TARGET_BINARY_OP,
&&TARGET_SEND, &&TARGET_SEND,
&&TARGET_LOAD_FAST, &&TARGET_LOAD_FAST,
@ -140,9 +140,9 @@ static void *opcode_targets[256] = {
&&TARGET_STORE_DEREF, &&TARGET_STORE_DEREF,
&&TARGET_DELETE_DEREF, &&TARGET_DELETE_DEREF,
&&TARGET_JUMP_BACKWARD, &&TARGET_JUMP_BACKWARD,
&&TARGET_STORE_ATTR_SLOT, &&TARGET_STORE_FAST__STORE_FAST,
&&TARGET_CALL_FUNCTION_EX, &&TARGET_CALL_FUNCTION_EX,
&&TARGET_STORE_ATTR_WITH_HINT, &&TARGET_STORE_SUBSCR_DICT,
&&TARGET_EXTENDED_ARG, &&TARGET_EXTENDED_ARG,
&&TARGET_LIST_APPEND, &&TARGET_LIST_APPEND,
&&TARGET_SET_ADD, &&TARGET_SET_ADD,
@ -152,20 +152,20 @@ static void *opcode_targets[256] = {
&&TARGET_YIELD_VALUE, &&TARGET_YIELD_VALUE,
&&TARGET_RESUME, &&TARGET_RESUME,
&&TARGET_MATCH_CLASS, &&TARGET_MATCH_CLASS,
&&TARGET_STORE_FAST__LOAD_FAST, &&TARGET_STORE_SUBSCR_LIST_INT,
&&TARGET_STORE_FAST__STORE_FAST, &&TARGET_UNPACK_SEQUENCE_LIST,
&&TARGET_FORMAT_VALUE, &&TARGET_FORMAT_VALUE,
&&TARGET_BUILD_CONST_KEY_MAP, &&TARGET_BUILD_CONST_KEY_MAP,
&&TARGET_BUILD_STRING, &&TARGET_BUILD_STRING,
&&TARGET_STORE_SUBSCR_DICT,
&&TARGET_STORE_SUBSCR_LIST_INT,
&&TARGET_UNPACK_SEQUENCE_LIST,
&&TARGET_UNPACK_SEQUENCE_TUPLE, &&TARGET_UNPACK_SEQUENCE_TUPLE,
&&TARGET_UNPACK_SEQUENCE_TWO_TUPLE,
&&_unknown_opcode,
&&_unknown_opcode,
&&TARGET_LIST_EXTEND, &&TARGET_LIST_EXTEND,
&&TARGET_SET_UPDATE, &&TARGET_SET_UPDATE,
&&TARGET_DICT_MERGE, &&TARGET_DICT_MERGE,
&&TARGET_DICT_UPDATE, &&TARGET_DICT_UPDATE,
&&TARGET_UNPACK_SEQUENCE_TWO_TUPLE, &&_unknown_opcode,
&&_unknown_opcode, &&_unknown_opcode,
&&_unknown_opcode, &&_unknown_opcode,
&&_unknown_opcode, &&_unknown_opcode,