summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorBrandt Bucher <brandt@python.org>2022-01-26 20:47:45 (GMT)
committerGitHub <noreply@github.com>2022-01-26 20:47:45 (GMT)
commit85483668647e7840c7b9a1877caaf2ef14a4443f (patch)
tree48c1ba3dc17fb6c39d100e114178e1cc9ca19e88 /Include
parentd4a85f104bf9d2e368f25c9a567eaaa2cc39a96a (diff)
downloadcpython-85483668647e7840c7b9a1877caaf2ef14a4443f.zip
cpython-85483668647e7840c7b9a1877caaf2ef14a4443f.tar.gz
cpython-85483668647e7840c7b9a1877caaf2ef14a4443f.tar.bz2
bpo-46528: Simplify the VM's stack manipulations (GH-30902)
Diffstat (limited to 'Include')
-rw-r--r--Include/opcode.h117
1 files changed, 56 insertions, 61 deletions
diff --git a/Include/opcode.h b/Include/opcode.h
index 985758d..02cdf42 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -8,11 +8,6 @@ extern "C" {
/* Instruction opcodes for compiled code */
#define POP_TOP 1
-#define ROT_TWO 2
-#define ROT_THREE 3
-#define DUP_TOP 4
-#define DUP_TOP_TWO 5
-#define ROT_FOUR 6
#define NOP 9
#define UNARY_POSITIVE 10
#define UNARY_NEGATIVE 11
@@ -57,7 +52,7 @@ extern "C" {
#define DELETE_ATTR 96
#define STORE_GLOBAL 97
#define DELETE_GLOBAL 98
-#define ROT_N 99
+#define SWAP 99
#define LOAD_CONST 100
#define LOAD_NAME 101
#define BUILD_TUPLE 102
@@ -117,61 +112,61 @@ extern "C" {
#define PRECALL_METHOD 168
#define CALL_NO_KW 169
#define CALL_KW 170
-#define BINARY_OP_ADAPTIVE 7
-#define BINARY_OP_ADD_INT 8
-#define BINARY_OP_ADD_FLOAT 13
-#define BINARY_OP_ADD_UNICODE 14
-#define BINARY_OP_INPLACE_ADD_UNICODE 16
-#define BINARY_OP_MULTIPLY_INT 17
-#define BINARY_OP_MULTIPLY_FLOAT 18
-#define BINARY_OP_SUBTRACT_INT 19
-#define BINARY_OP_SUBTRACT_FLOAT 20
-#define COMPARE_OP_ADAPTIVE 21
-#define COMPARE_OP_FLOAT_JUMP 22
-#define COMPARE_OP_INT_JUMP 23
-#define COMPARE_OP_STR_JUMP 24
-#define BINARY_SUBSCR_ADAPTIVE 26
-#define BINARY_SUBSCR_GETITEM 27
-#define BINARY_SUBSCR_LIST_INT 28
-#define BINARY_SUBSCR_TUPLE_INT 29
-#define BINARY_SUBSCR_DICT 34
-#define STORE_SUBSCR_ADAPTIVE 36
-#define STORE_SUBSCR_LIST_INT 37
-#define STORE_SUBSCR_DICT 38
-#define CALL_NO_KW_ADAPTIVE 39
-#define CALL_NO_KW_BUILTIN_O 40
-#define CALL_NO_KW_BUILTIN_FAST 41
-#define CALL_NO_KW_LEN 42
-#define CALL_NO_KW_ISINSTANCE 43
-#define CALL_NO_KW_PY_SIMPLE 44
-#define CALL_NO_KW_LIST_APPEND 45
-#define CALL_NO_KW_METHOD_DESCRIPTOR_O 46
-#define CALL_NO_KW_TYPE_1 47
-#define CALL_NO_KW_BUILTIN_CLASS_1 48
-#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 55
-#define JUMP_ABSOLUTE_QUICK 56
-#define LOAD_ATTR_ADAPTIVE 57
-#define LOAD_ATTR_INSTANCE_VALUE 58
-#define LOAD_ATTR_WITH_HINT 59
-#define LOAD_ATTR_SLOT 62
-#define LOAD_ATTR_MODULE 63
-#define LOAD_GLOBAL_ADAPTIVE 64
-#define LOAD_GLOBAL_MODULE 65
-#define LOAD_GLOBAL_BUILTIN 66
-#define LOAD_METHOD_ADAPTIVE 67
-#define LOAD_METHOD_CACHED 72
-#define LOAD_METHOD_CLASS 76
-#define LOAD_METHOD_MODULE 77
-#define LOAD_METHOD_NO_DICT 78
-#define STORE_ATTR_ADAPTIVE 79
-#define STORE_ATTR_INSTANCE_VALUE 80
-#define STORE_ATTR_SLOT 81
-#define STORE_ATTR_WITH_HINT 131
-#define LOAD_FAST__LOAD_FAST 140
-#define STORE_FAST__LOAD_FAST 141
-#define LOAD_FAST__LOAD_CONST 143
-#define LOAD_CONST__LOAD_FAST 150
-#define STORE_FAST__STORE_FAST 153
+#define BINARY_OP_ADAPTIVE 2
+#define BINARY_OP_ADD_INT 3
+#define BINARY_OP_ADD_FLOAT 4
+#define BINARY_OP_ADD_UNICODE 5
+#define BINARY_OP_INPLACE_ADD_UNICODE 6
+#define BINARY_OP_MULTIPLY_INT 7
+#define BINARY_OP_MULTIPLY_FLOAT 8
+#define BINARY_OP_SUBTRACT_INT 13
+#define BINARY_OP_SUBTRACT_FLOAT 14
+#define COMPARE_OP_ADAPTIVE 16
+#define COMPARE_OP_FLOAT_JUMP 17
+#define COMPARE_OP_INT_JUMP 18
+#define COMPARE_OP_STR_JUMP 19
+#define BINARY_SUBSCR_ADAPTIVE 20
+#define BINARY_SUBSCR_GETITEM 21
+#define BINARY_SUBSCR_LIST_INT 22
+#define BINARY_SUBSCR_TUPLE_INT 23
+#define BINARY_SUBSCR_DICT 24
+#define STORE_SUBSCR_ADAPTIVE 26
+#define STORE_SUBSCR_LIST_INT 27
+#define STORE_SUBSCR_DICT 28
+#define CALL_NO_KW_ADAPTIVE 29
+#define CALL_NO_KW_BUILTIN_O 34
+#define CALL_NO_KW_BUILTIN_FAST 36
+#define CALL_NO_KW_LEN 37
+#define CALL_NO_KW_ISINSTANCE 38
+#define CALL_NO_KW_PY_SIMPLE 39
+#define CALL_NO_KW_LIST_APPEND 40
+#define CALL_NO_KW_METHOD_DESCRIPTOR_O 41
+#define CALL_NO_KW_TYPE_1 42
+#define CALL_NO_KW_BUILTIN_CLASS_1 43
+#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 44
+#define JUMP_ABSOLUTE_QUICK 45
+#define LOAD_ATTR_ADAPTIVE 46
+#define LOAD_ATTR_INSTANCE_VALUE 47
+#define LOAD_ATTR_WITH_HINT 48
+#define LOAD_ATTR_SLOT 55
+#define LOAD_ATTR_MODULE 56
+#define LOAD_GLOBAL_ADAPTIVE 57
+#define LOAD_GLOBAL_MODULE 58
+#define LOAD_GLOBAL_BUILTIN 59
+#define LOAD_METHOD_ADAPTIVE 62
+#define LOAD_METHOD_CACHED 63
+#define LOAD_METHOD_CLASS 64
+#define LOAD_METHOD_MODULE 65
+#define LOAD_METHOD_NO_DICT 66
+#define STORE_ATTR_ADAPTIVE 67
+#define STORE_ATTR_INSTANCE_VALUE 72
+#define STORE_ATTR_SLOT 76
+#define STORE_ATTR_WITH_HINT 77
+#define LOAD_FAST__LOAD_FAST 78
+#define STORE_FAST__LOAD_FAST 79
+#define LOAD_FAST__LOAD_CONST 80
+#define LOAD_CONST__LOAD_FAST 81
+#define STORE_FAST__STORE_FAST 131
#define DO_TRACING 255
#ifdef NEED_OPCODE_JUMP_TABLES
static uint32_t _PyOpcode_RelativeJump[8] = {