2009-01-25 16:34:23 +00:00
|
|
|
static void *opcode_targets[256] = {
|
2010-05-09 15:52:27 +00:00
|
|
|
&&_unknown_opcode,
|
|
|
|
&&TARGET_POP_TOP,
|
2022-02-18 17:19:08 +00:00
|
|
|
&&TARGET_PUSH_NULL,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_CACHE,
|
2021-11-11 06:56:22 +00:00
|
|
|
&&TARGET_BINARY_OP_ADAPTIVE,
|
|
|
|
&&TARGET_BINARY_OP_ADD_INT,
|
|
|
|
&&TARGET_BINARY_OP_ADD_FLOAT,
|
|
|
|
&&TARGET_BINARY_OP_ADD_UNICODE,
|
|
|
|
&&TARGET_BINARY_OP_INPLACE_ADD_UNICODE,
|
2022-01-26 20:47:45 +00:00
|
|
|
&&TARGET_NOP,
|
|
|
|
&&TARGET_UNARY_POSITIVE,
|
|
|
|
&&TARGET_UNARY_NEGATIVE,
|
|
|
|
&&TARGET_UNARY_NOT,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_BINARY_OP_MULTIPLY_INT,
|
2022-02-18 17:19:08 +00:00
|
|
|
&&TARGET_BINARY_OP_MULTIPLY_FLOAT,
|
2022-01-26 20:47:45 +00:00
|
|
|
&&TARGET_UNARY_INVERT,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_BINARY_OP_SUBTRACT_INT,
|
2022-02-18 17:19:08 +00:00
|
|
|
&&TARGET_BINARY_OP_SUBTRACT_FLOAT,
|
2021-12-03 11:29:12 +00:00
|
|
|
&&TARGET_COMPARE_OP_ADAPTIVE,
|
|
|
|
&&TARGET_COMPARE_OP_FLOAT_JUMP,
|
|
|
|
&&TARGET_COMPARE_OP_INT_JUMP,
|
|
|
|
&&TARGET_COMPARE_OP_STR_JUMP,
|
2021-10-14 14:56:33 +00:00
|
|
|
&&TARGET_BINARY_SUBSCR_ADAPTIVE,
|
2021-11-18 11:02:14 +00:00
|
|
|
&&TARGET_BINARY_SUBSCR_GETITEM,
|
2021-10-14 14:56:33 +00:00
|
|
|
&&TARGET_BINARY_SUBSCR_LIST_INT,
|
2022-01-26 20:47:45 +00:00
|
|
|
&&TARGET_BINARY_SUBSCR,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_BINARY_SUBSCR_TUPLE_INT,
|
2022-02-18 17:19:08 +00:00
|
|
|
&&TARGET_BINARY_SUBSCR_DICT,
|
2021-12-03 11:29:12 +00:00
|
|
|
&&TARGET_STORE_SUBSCR_ADAPTIVE,
|
|
|
|
&&TARGET_STORE_SUBSCR_LIST_INT,
|
2022-01-26 20:47:45 +00:00
|
|
|
&&TARGET_GET_LEN,
|
|
|
|
&&TARGET_MATCH_MAPPING,
|
|
|
|
&&TARGET_MATCH_SEQUENCE,
|
|
|
|
&&TARGET_MATCH_KEYS,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_STORE_SUBSCR_DICT,
|
2022-01-26 20:47:45 +00:00
|
|
|
&&TARGET_PUSH_EXC_INFO,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_CALL_ADAPTIVE,
|
2022-01-28 12:42:30 +00:00
|
|
|
&&TARGET_CALL_PY_EXACT_ARGS,
|
|
|
|
&&TARGET_CALL_PY_WITH_DEFAULTS,
|
|
|
|
&&TARGET_JUMP_ABSOLUTE_QUICK,
|
|
|
|
&&TARGET_LOAD_ATTR_ADAPTIVE,
|
|
|
|
&&TARGET_LOAD_ATTR_INSTANCE_VALUE,
|
2022-02-18 17:19:08 +00:00
|
|
|
&&TARGET_LOAD_ATTR_WITH_HINT,
|
2021-12-15 15:03:42 +00:00
|
|
|
&&TARGET_LOAD_ATTR_SLOT,
|
2021-12-03 11:29:12 +00:00
|
|
|
&&TARGET_LOAD_ATTR_MODULE,
|
|
|
|
&&TARGET_LOAD_GLOBAL_ADAPTIVE,
|
2021-11-19 10:30:37 +00:00
|
|
|
&&TARGET_LOAD_GLOBAL_MODULE,
|
|
|
|
&&TARGET_LOAD_GLOBAL_BUILTIN,
|
2022-02-22 14:57:01 +00:00
|
|
|
&&TARGET_LOAD_METHOD_ADAPTIVE,
|
|
|
|
&&TARGET_WITH_EXCEPT_START,
|
|
|
|
&&TARGET_GET_AITER,
|
|
|
|
&&TARGET_GET_ANEXT,
|
|
|
|
&&TARGET_BEFORE_ASYNC_WITH,
|
|
|
|
&&TARGET_BEFORE_WITH,
|
|
|
|
&&TARGET_END_ASYNC_FOR,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_LOAD_METHOD_CLASS,
|
2022-02-22 14:57:01 +00:00
|
|
|
&&TARGET_LOAD_METHOD_MODULE,
|
|
|
|
&&TARGET_LOAD_METHOD_NO_DICT,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_LOAD_METHOD_WITH_DICT,
|
|
|
|
&&TARGET_LOAD_METHOD_WITH_VALUES,
|
2022-02-22 14:57:01 +00:00
|
|
|
&&TARGET_STORE_SUBSCR,
|
|
|
|
&&TARGET_DELETE_SUBSCR,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_PRECALL_ADAPTIVE,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_PRECALL_BUILTIN_CLASS,
|
2022-02-22 14:57:01 +00:00
|
|
|
&&TARGET_PRECALL_NO_KW_BUILTIN_O,
|
|
|
|
&&TARGET_PRECALL_NO_KW_BUILTIN_FAST,
|
|
|
|
&&TARGET_PRECALL_BUILTIN_FAST_WITH_KEYWORDS,
|
|
|
|
&&TARGET_PRECALL_NO_KW_LEN,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_GET_ITER,
|
Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:
1. Coroutines now have a distinct, separate from generators
type at the C level: PyGen_Type, and a new typedef PyCoroObject.
PyCoroObject shares the initial segment of struct layout with
PyGenObject, making it possible to reuse existing generators
machinery. The new type is exposed as 'types.CoroutineType'.
As a consequence of having a new type, CO_GENERATOR flag is
no longer applied to coroutines.
2. Having a separate type for coroutines made it possible to add
an __await__ method to the type. Although it is not used by the
interpreter (see details on that below), it makes coroutines
naturally (without using __instancecheck__) conform to
collections.abc.Coroutine and collections.abc.Awaitable ABCs.
[The __instancecheck__ is still used for generator-based
coroutines, as we don't want to add __await__ for generators.]
3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to
allow passing native coroutines to the YIELD_FROM opcode.
Before this change, 'yield from o' expression was compiled to:
(o)
GET_ITER
LOAD_CONST
YIELD_FROM
Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.
The reason for adding a new opcode is that GET_ITER is used
in some contexts (such as 'for .. in' loops) where passing
a coroutine object is invalid.
4. Add two new introspection functions to the inspec module:
getcoroutinestate(c) and getcoroutinelocals(c).
5. inspect.iscoroutine(o) is updated to test if 'o' is a native
coroutine object. Before this commit it used abc.Coroutine,
and it was requested to update inspect.isgenerator(o) to use
abc.Generator; it was decided, however, that inspect functions
should really be tailored for checking for native types.
6. sys.set_coroutine_wrapper(w) API is updated to work with only
native coroutines. Since types.coroutine decorator supports
any type of callables now, it would be confusing that it does
not work for all types of coroutines.
7. Exceptions logic in generators C implementation was updated
to raise clearer messages for coroutines:
Before: TypeError("generator raised StopIteration")
After: TypeError("coroutine raised StopIteration")
2015-06-22 16:19:30 +00:00
|
|
|
&&TARGET_GET_YIELD_FROM_ITER,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_PRINT_EXPR,
|
|
|
|
&&TARGET_LOAD_BUILD_CLASS,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_PRECALL_NO_KW_ISINSTANCE,
|
2022-03-04 12:41:17 +00:00
|
|
|
&&TARGET_PRECALL_NO_KW_LIST_APPEND,
|
2019-08-25 09:44:09 +00:00
|
|
|
&&TARGET_LOAD_ASSERTION_ERROR,
|
2022-01-20 11:46:39 +00:00
|
|
|
&&TARGET_RETURN_GENERATOR,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_PRECALL_NO_KW_METHOD_DESCRIPTOR_O,
|
2022-02-22 14:57:01 +00:00
|
|
|
&&TARGET_PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS,
|
|
|
|
&&TARGET_PRECALL_NO_KW_STR_1,
|
|
|
|
&&TARGET_PRECALL_NO_KW_TUPLE_1,
|
|
|
|
&&TARGET_PRECALL_NO_KW_TYPE_1,
|
2022-03-04 12:41:17 +00:00
|
|
|
&&TARGET_PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST,
|
2020-01-23 09:25:17 +00:00
|
|
|
&&TARGET_LIST_TO_TUPLE,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_RETURN_VALUE,
|
|
|
|
&&TARGET_IMPORT_STAR,
|
2016-09-09 03:50:03 +00:00
|
|
|
&&TARGET_SETUP_ANNOTATIONS,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_YIELD_VALUE,
|
2022-01-24 11:08:53 +00:00
|
|
|
&&TARGET_ASYNC_GEN_WRAP,
|
2021-12-14 16:48:15 +00:00
|
|
|
&&TARGET_PREP_RERAISE_STAR,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_POP_EXCEPT,
|
|
|
|
&&TARGET_STORE_NAME,
|
|
|
|
&&TARGET_DELETE_NAME,
|
|
|
|
&&TARGET_UNPACK_SEQUENCE,
|
|
|
|
&&TARGET_FOR_ITER,
|
|
|
|
&&TARGET_UNPACK_EX,
|
|
|
|
&&TARGET_STORE_ATTR,
|
|
|
|
&&TARGET_DELETE_ATTR,
|
|
|
|
&&TARGET_STORE_GLOBAL,
|
|
|
|
&&TARGET_DELETE_GLOBAL,
|
2022-01-26 20:47:45 +00:00
|
|
|
&&TARGET_SWAP,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_LOAD_CONST,
|
|
|
|
&&TARGET_LOAD_NAME,
|
|
|
|
&&TARGET_BUILD_TUPLE,
|
|
|
|
&&TARGET_BUILD_LIST,
|
|
|
|
&&TARGET_BUILD_SET,
|
|
|
|
&&TARGET_BUILD_MAP,
|
|
|
|
&&TARGET_LOAD_ATTR,
|
|
|
|
&&TARGET_COMPARE_OP,
|
|
|
|
&&TARGET_IMPORT_NAME,
|
|
|
|
&&TARGET_IMPORT_FROM,
|
|
|
|
&&TARGET_JUMP_FORWARD,
|
|
|
|
&&TARGET_JUMP_IF_FALSE_OR_POP,
|
|
|
|
&&TARGET_JUMP_IF_TRUE_OR_POP,
|
|
|
|
&&TARGET_JUMP_ABSOLUTE,
|
|
|
|
&&TARGET_POP_JUMP_IF_FALSE,
|
|
|
|
&&TARGET_POP_JUMP_IF_TRUE,
|
|
|
|
&&TARGET_LOAD_GLOBAL,
|
2020-01-14 10:12:45 +00:00
|
|
|
&&TARGET_IS_OP,
|
|
|
|
&&TARGET_CONTAINS_OP,
|
2020-12-17 13:55:28 +00:00
|
|
|
&&TARGET_RERAISE,
|
2021-10-27 09:45:35 +00:00
|
|
|
&&TARGET_COPY,
|
2020-01-14 10:12:45 +00:00
|
|
|
&&TARGET_JUMP_IF_NOT_EXC_MATCH,
|
2021-11-11 06:56:22 +00:00
|
|
|
&&TARGET_BINARY_OP,
|
2021-12-15 10:30:09 +00:00
|
|
|
&&TARGET_SEND,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_LOAD_FAST,
|
|
|
|
&&TARGET_STORE_FAST,
|
|
|
|
&&TARGET_DELETE_FAST,
|
2021-12-14 16:48:15 +00:00
|
|
|
&&TARGET_JUMP_IF_NOT_EG_MATCH,
|
2022-01-06 11:38:35 +00:00
|
|
|
&&TARGET_POP_JUMP_IF_NOT_NONE,
|
|
|
|
&&TARGET_POP_JUMP_IF_NONE,
|
2022-01-04 19:38:32 +00:00
|
|
|
&&TARGET_RAISE_VARARGS,
|
2022-03-04 12:41:17 +00:00
|
|
|
&&TARGET_GET_AWAITABLE,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_MAKE_FUNCTION,
|
|
|
|
&&TARGET_BUILD_SLICE,
|
2022-01-20 11:46:39 +00:00
|
|
|
&&TARGET_JUMP_NO_INTERRUPT,
|
2021-06-08 22:01:34 +00:00
|
|
|
&&TARGET_MAKE_CELL,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_LOAD_CLOSURE,
|
|
|
|
&&TARGET_LOAD_DEREF,
|
|
|
|
&&TARGET_STORE_DEREF,
|
2010-09-10 21:39:53 +00:00
|
|
|
&&TARGET_DELETE_DEREF,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_PRECALL_BOUND_METHOD,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_PRECALL_PYFUNC,
|
2016-09-09 17:17:08 +00:00
|
|
|
&&TARGET_CALL_FUNCTION_EX,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_RESUME_QUICK,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&TARGET_EXTENDED_ARG,
|
|
|
|
&&TARGET_LIST_APPEND,
|
|
|
|
&&TARGET_SET_ADD,
|
|
|
|
&&TARGET_MAP_ADD,
|
2013-04-30 13:41:40 +00:00
|
|
|
&&TARGET_LOAD_CLASSDEREF,
|
2021-11-23 09:53:24 +00:00
|
|
|
&&TARGET_COPY_FREE_VARS,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_STORE_ATTR_ADAPTIVE,
|
2022-01-06 13:09:25 +00:00
|
|
|
&&TARGET_RESUME,
|
2021-02-26 22:51:55 +00:00
|
|
|
&&TARGET_MATCH_CLASS,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_STORE_ATTR_INSTANCE_VALUE,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_STORE_ATTR_SLOT,
|
2015-11-03 17:45:05 +00:00
|
|
|
&&TARGET_FORMAT_VALUE,
|
2016-06-11 21:39:41 +00:00
|
|
|
&&TARGET_BUILD_CONST_KEY_MAP,
|
2016-09-06 19:07:53 +00:00
|
|
|
&&TARGET_BUILD_STRING,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_STORE_ATTR_WITH_HINT,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_UNPACK_SEQUENCE_ADAPTIVE,
|
2016-12-14 00:03:51 +00:00
|
|
|
&&TARGET_LOAD_METHOD,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_UNPACK_SEQUENCE_LIST,
|
2020-01-23 09:25:17 +00:00
|
|
|
&&TARGET_LIST_EXTEND,
|
|
|
|
&&TARGET_SET_UPDATE,
|
2020-01-27 09:57:45 +00:00
|
|
|
&&TARGET_DICT_MERGE,
|
|
|
|
&&TARGET_DICT_UPDATE,
|
2022-02-18 17:19:08 +00:00
|
|
|
&&TARGET_PRECALL,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_UNPACK_SEQUENCE_TUPLE,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_UNPACK_SEQUENCE_TWO_TUPLE,
|
2022-02-22 14:57:01 +00:00
|
|
|
&&TARGET_LOAD_FAST__LOAD_FAST,
|
|
|
|
&&TARGET_STORE_FAST__LOAD_FAST,
|
2022-01-28 12:42:30 +00:00
|
|
|
&&TARGET_CALL,
|
|
|
|
&&TARGET_KW_NAMES,
|
2022-02-25 12:11:34 +00:00
|
|
|
&&TARGET_LOAD_FAST__LOAD_CONST,
|
2022-02-24 19:34:57 +00:00
|
|
|
&&TARGET_LOAD_CONST__LOAD_FAST,
|
2022-02-22 14:57:01 +00:00
|
|
|
&&TARGET_STORE_FAST__STORE_FAST,
|
2022-03-03 23:31:00 +00:00
|
|
|
&&_unknown_opcode,
|
2010-05-09 15:52:27 +00:00
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
|
|
|
&&_unknown_opcode,
|
2021-10-05 10:01:11 +00:00
|
|
|
&&TARGET_DO_TRACING
|
2009-01-25 16:34:23 +00:00
|
|
|
};
|