summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-01-05 16:05:51 (GMT)
committerGitHub <noreply@github.com>2023-01-05 16:05:51 (GMT)
commit28187141cc34063ef857976ddbca87ba09a882c2 (patch)
tree852d652bd98f0f7e322a30f6d648a1a4ce9612b2 /Include
parentf20c553a458659f247fac1fb829f8172aa32f69a (diff)
downloadcpython-28187141cc34063ef857976ddbca87ba09a882c2.zip
cpython-28187141cc34063ef857976ddbca87ba09a882c2.tar.gz
cpython-28187141cc34063ef857976ddbca87ba09a882c2.tar.bz2
GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)
* Remove PRINT_EXPR instruction * Remove STOPITERATION_ERROR instruction * Remove IMPORT_STAR instruction
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_intrinsics.h10
-rw-r--r--Include/internal/pycore_opcode.h50
-rw-r--r--Include/opcode.h58
3 files changed, 63 insertions, 55 deletions
diff --git a/Include/internal/pycore_intrinsics.h b/Include/internal/pycore_intrinsics.h
new file mode 100644
index 0000000..92f06c7
--- /dev/null
+++ b/Include/internal/pycore_intrinsics.h
@@ -0,0 +1,10 @@
+
+#define INTRINSIC_PRINT 1
+#define INTRINSIC_IMPORT_STAR 2
+#define INTRINSIC_STOPITERATION_ERROR 3
+
+#define MAX_INTRINSIC_1 3
+
+typedef PyObject *(*instrinsic_func1)(PyThreadState* tstate, PyObject *value);
+
+extern instrinsic_func1 _PyIntrinsics_UnaryFunctions[];
diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h
index 685ad53..e952690 100644
--- a/Include/internal/pycore_opcode.h
+++ b/Include/internal/pycore_opcode.h
@@ -85,6 +85,7 @@ const uint8_t _PyOpcode_Deopt[256] = {
[CALL_BUILTIN_CLASS] = CALL,
[CALL_BUILTIN_FAST_WITH_KEYWORDS] = CALL,
[CALL_FUNCTION_EX] = CALL_FUNCTION_EX,
+ [CALL_INTRINSIC_1] = CALL_INTRINSIC_1,
[CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = CALL,
[CALL_NO_KW_BUILTIN_FAST] = CALL,
[CALL_NO_KW_BUILTIN_O] = CALL,
@@ -134,7 +135,6 @@ const uint8_t _PyOpcode_Deopt[256] = {
[GET_YIELD_FROM_ITER] = GET_YIELD_FROM_ITER,
[IMPORT_FROM] = IMPORT_FROM,
[IMPORT_NAME] = IMPORT_NAME,
- [IMPORT_STAR] = IMPORT_STAR,
[INTERPRETER_EXIT] = INTERPRETER_EXIT,
[IS_OP] = IS_OP,
[JUMP_BACKWARD] = JUMP_BACKWARD,
@@ -187,7 +187,6 @@ const uint8_t _PyOpcode_Deopt[256] = {
[POP_JUMP_IF_TRUE] = POP_JUMP_IF_TRUE,
[POP_TOP] = POP_TOP,
[PREP_RERAISE_STAR] = PREP_RERAISE_STAR,
- [PRINT_EXPR] = PRINT_EXPR,
[PUSH_EXC_INFO] = PUSH_EXC_INFO,
[PUSH_NULL] = PUSH_NULL,
[RAISE_VARARGS] = RAISE_VARARGS,
@@ -199,7 +198,6 @@ const uint8_t _PyOpcode_Deopt[256] = {
[SETUP_ANNOTATIONS] = SETUP_ANNOTATIONS,
[SET_ADD] = SET_ADD,
[SET_UPDATE] = SET_UPDATE,
- [STOPITERATION_ERROR] = STOPITERATION_ERROR,
[STORE_ATTR] = STORE_ATTR,
[STORE_ATTR_INSTANCE_VALUE] = STORE_ATTR,
[STORE_ATTR_SLOT] = STORE_ATTR,
@@ -294,30 +292,30 @@ static const char *const _PyOpcode_OpName[263] = {
[STORE_SUBSCR] = "STORE_SUBSCR",
[DELETE_SUBSCR] = "DELETE_SUBSCR",
[FOR_ITER_TUPLE] = "FOR_ITER_TUPLE",
- [STOPITERATION_ERROR] = "STOPITERATION_ERROR",
[FOR_ITER_RANGE] = "FOR_ITER_RANGE",
[FOR_ITER_GEN] = "FOR_ITER_GEN",
[LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS",
[LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN",
+ [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE",
[GET_ITER] = "GET_ITER",
[GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER",
- [PRINT_EXPR] = "PRINT_EXPR",
- [LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS",
- [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE",
[LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE",
- [LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR",
- [RETURN_GENERATOR] = "RETURN_GENERATOR",
+ [LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS",
[LOAD_ATTR_PROPERTY] = "LOAD_ATTR_PROPERTY",
[LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT",
+ [LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR",
+ [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_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT",
[LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES",
+ [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST",
+ [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST",
[LIST_TO_TUPLE] = "LIST_TO_TUPLE",
[RETURN_VALUE] = "RETURN_VALUE",
- [IMPORT_STAR] = "IMPORT_STAR",
+ [LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST",
[SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS",
- [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST",
+ [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN",
[ASYNC_GEN_WRAP] = "ASYNC_GEN_WRAP",
[PREP_RERAISE_STAR] = "PREP_RERAISE_STAR",
[POP_EXCEPT] = "POP_EXCEPT",
@@ -344,7 +342,7 @@ static const char *const _PyOpcode_OpName[263] = {
[JUMP_FORWARD] = "JUMP_FORWARD",
[JUMP_IF_FALSE_OR_POP] = "JUMP_IF_FALSE_OR_POP",
[JUMP_IF_TRUE_OR_POP] = "JUMP_IF_TRUE_OR_POP",
- [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST",
+ [LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE",
[POP_JUMP_IF_FALSE] = "POP_JUMP_IF_FALSE",
[POP_JUMP_IF_TRUE] = "POP_JUMP_IF_TRUE",
[LOAD_GLOBAL] = "LOAD_GLOBAL",
@@ -352,7 +350,7 @@ static const char *const _PyOpcode_OpName[263] = {
[CONTAINS_OP] = "CONTAINS_OP",
[RERAISE] = "RERAISE",
[COPY] = "COPY",
- [LOAD_FAST__LOAD_FAST] = "LOAD_FAST__LOAD_FAST",
+ [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE",
[BINARY_OP] = "BINARY_OP",
[SEND] = "SEND",
[LOAD_FAST] = "LOAD_FAST",
@@ -372,9 +370,9 @@ static const char *const _PyOpcode_OpName[263] = {
[STORE_DEREF] = "STORE_DEREF",
[DELETE_DEREF] = "DELETE_DEREF",
[JUMP_BACKWARD] = "JUMP_BACKWARD",
- [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN",
+ [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT",
[CALL_FUNCTION_EX] = "CALL_FUNCTION_EX",
- [LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE",
+ [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT",
[EXTENDED_ARG] = "EXTENDED_ARG",
[LIST_APPEND] = "LIST_APPEND",
[SET_ADD] = "SET_ADD",
@@ -384,27 +382,27 @@ static const char *const _PyOpcode_OpName[263] = {
[YIELD_VALUE] = "YIELD_VALUE",
[RESUME] = "RESUME",
[MATCH_CLASS] = "MATCH_CLASS",
- [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE",
- [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT",
+ [STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST",
+ [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST",
[FORMAT_VALUE] = "FORMAT_VALUE",
[BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP",
[BUILD_STRING] = "BUILD_STRING",
- [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT",
- [STORE_FAST__LOAD_FAST] = "STORE_FAST__LOAD_FAST",
- [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST",
[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",
[LIST_EXTEND] = "LIST_EXTEND",
[SET_UPDATE] = "SET_UPDATE",
[DICT_MERGE] = "DICT_MERGE",
[DICT_UPDATE] = "DICT_UPDATE",
- [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT",
- [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST",
- [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE",
[UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE",
+ [167] = "<167>",
+ [168] = "<168>",
+ [169] = "<169>",
[170] = "<170>",
[CALL] = "CALL",
[KW_NAMES] = "KW_NAMES",
- [173] = "<173>",
+ [CALL_INTRINSIC_1] = "CALL_INTRINSIC_1",
[174] = "<174>",
[175] = "<175>",
[176] = "<176>",
@@ -498,8 +496,10 @@ static const char *const _PyOpcode_OpName[263] = {
#endif
#define EXTRA_CASES \
+ case 167: \
+ case 168: \
+ case 169: \
case 170: \
- case 173: \
case 174: \
case 175: \
case 176: \
diff --git a/Include/opcode.h b/Include/opcode.h
index 246a463..44b7725 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -37,16 +37,13 @@ extern "C" {
#define CLEANUP_THROW 55
#define STORE_SUBSCR 60
#define DELETE_SUBSCR 61
-#define STOPITERATION_ERROR 63
#define GET_ITER 68
#define GET_YIELD_FROM_ITER 69
-#define PRINT_EXPR 70
#define LOAD_BUILD_CLASS 71
#define LOAD_ASSERTION_ERROR 74
#define RETURN_GENERATOR 75
#define LIST_TO_TUPLE 82
#define RETURN_VALUE 83
-#define IMPORT_STAR 84
#define SETUP_ANNOTATIONS 85
#define ASYNC_GEN_WRAP 87
#define PREP_RERAISE_STAR 88
@@ -120,6 +117,7 @@ extern "C" {
#define DICT_UPDATE 165
#define CALL 171
#define KW_NAMES 172
+#define CALL_INTRINSIC_1 173
#define MIN_PSEUDO_OPCODE 256
#define SETUP_FINALLY 256
#define SETUP_CLEANUP 257
@@ -163,33 +161,33 @@ extern "C" {
#define COMPARE_OP_STR_JUMP 58
#define FOR_ITER_LIST 59
#define FOR_ITER_TUPLE 62
-#define FOR_ITER_RANGE 64
-#define FOR_ITER_GEN 65
-#define LOAD_ATTR_CLASS 66
-#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 67
-#define LOAD_ATTR_INSTANCE_VALUE 72
-#define LOAD_ATTR_MODULE 73
-#define LOAD_ATTR_PROPERTY 76
-#define LOAD_ATTR_SLOT 77
-#define LOAD_ATTR_WITH_HINT 78
-#define LOAD_ATTR_METHOD_LAZY_DICT 79
-#define LOAD_ATTR_METHOD_NO_DICT 80
-#define LOAD_ATTR_METHOD_WITH_VALUES 81
-#define LOAD_CONST__LOAD_FAST 86
-#define LOAD_FAST__LOAD_CONST 113
-#define LOAD_FAST__LOAD_FAST 121
-#define LOAD_GLOBAL_BUILTIN 141
-#define LOAD_GLOBAL_MODULE 143
-#define STORE_ATTR_INSTANCE_VALUE 153
-#define STORE_ATTR_SLOT 154
-#define STORE_ATTR_WITH_HINT 158
-#define STORE_FAST__LOAD_FAST 159
-#define STORE_FAST__STORE_FAST 160
-#define STORE_SUBSCR_DICT 161
-#define STORE_SUBSCR_LIST_INT 166
-#define UNPACK_SEQUENCE_LIST 167
-#define UNPACK_SEQUENCE_TUPLE 168
-#define UNPACK_SEQUENCE_TWO_TUPLE 169
+#define FOR_ITER_RANGE 63
+#define FOR_ITER_GEN 64
+#define LOAD_ATTR_CLASS 65
+#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 66
+#define LOAD_ATTR_INSTANCE_VALUE 67
+#define LOAD_ATTR_MODULE 70
+#define LOAD_ATTR_PROPERTY 72
+#define LOAD_ATTR_SLOT 73
+#define LOAD_ATTR_WITH_HINT 76
+#define LOAD_ATTR_METHOD_LAZY_DICT 77
+#define LOAD_ATTR_METHOD_NO_DICT 78
+#define LOAD_ATTR_METHOD_WITH_VALUES 79
+#define LOAD_CONST__LOAD_FAST 80
+#define LOAD_FAST__LOAD_CONST 81
+#define LOAD_FAST__LOAD_FAST 84
+#define LOAD_GLOBAL_BUILTIN 86
+#define LOAD_GLOBAL_MODULE 113
+#define STORE_ATTR_INSTANCE_VALUE 121
+#define STORE_ATTR_SLOT 141
+#define STORE_ATTR_WITH_HINT 143
+#define STORE_FAST__LOAD_FAST 153
+#define STORE_FAST__STORE_FAST 154
+#define STORE_SUBSCR_DICT 158
+#define STORE_SUBSCR_LIST_INT 159
+#define UNPACK_SEQUENCE_LIST 160
+#define UNPACK_SEQUENCE_TUPLE 161
+#define UNPACK_SEQUENCE_TWO_TUPLE 166
#define DO_TRACING 255
#define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\