summaryrefslogtreecommitdiffstats
path: root/Python/opcode_metadata.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-02-01 21:12:49 (GMT)
committerGitHub <noreply@github.com>2023-02-01 21:12:49 (GMT)
commitae9b38f4241a7d62ec4e9b775d4436d762b11fb3 (patch)
treeb6796e203f66e47414b9867f145319fabee8effe /Python/opcode_metadata.h
parenteda60916bc88f8af736790ffd52381e8bb83ae83 (diff)
downloadcpython-ae9b38f4241a7d62ec4e9b775d4436d762b11fb3.zip
cpython-ae9b38f4241a7d62ec4e9b775d4436d762b11fb3.tar.gz
cpython-ae9b38f4241a7d62ec4e9b775d4436d762b11fb3.tar.bz2
gh-98831: Modernize the LOAD_GLOBAL family (#101502)
Diffstat (limited to 'Python/opcode_metadata.h')
-rw-r--r--Python/opcode_metadata.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index c9f9759..f0bdede 100644
--- a/Python/opcode_metadata.h
+++ b/Python/opcode_metadata.h
@@ -141,11 +141,11 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
case LOAD_NAME:
return 0;
case LOAD_GLOBAL:
- return -1;
+ return 0;
case LOAD_GLOBAL_MODULE:
- return -1;
+ return 0;
case LOAD_GLOBAL_BUILTIN:
- return -1;
+ return 0;
case DELETE_FAST:
return 0;
case MAKE_CELL:
@@ -487,11 +487,11 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
case LOAD_NAME:
return 1;
case LOAD_GLOBAL:
- return -1;
+ return ((oparg & 1) ? 1 : 0) + 1;
case LOAD_GLOBAL_MODULE:
- return -1;
+ return ((oparg & 1) ? 1 : 0) + 1;
case LOAD_GLOBAL_BUILTIN:
- return -1;
+ return ((oparg & 1) ? 1 : 0) + 1;
case DELETE_FAST:
return 0;
case MAKE_CELL:
@@ -694,7 +694,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
}
#endif
enum Direction { DIR_NONE, DIR_READ, DIR_WRITE };
-enum InstructionFormat { INSTR_FMT_IB, INSTR_FMT_IBC, INSTR_FMT_IBC0, INSTR_FMT_IBC000, INSTR_FMT_IBC00000000, INSTR_FMT_IBIB, INSTR_FMT_IX, INSTR_FMT_IXC, INSTR_FMT_IXC000 };
+enum InstructionFormat { INSTR_FMT_IB, INSTR_FMT_IBC, INSTR_FMT_IBC0, INSTR_FMT_IBC000, INSTR_FMT_IBC0000, INSTR_FMT_IBC00000000, INSTR_FMT_IBIB, INSTR_FMT_IX, INSTR_FMT_IXC, INSTR_FMT_IXC000 };
struct opcode_metadata {
enum Direction dir_op1;
enum Direction dir_op2;
@@ -769,9 +769,9 @@ struct opcode_metadata {
[STORE_GLOBAL] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[DELETE_GLOBAL] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[LOAD_NAME] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
- [LOAD_GLOBAL] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
- [LOAD_GLOBAL_MODULE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
- [LOAD_GLOBAL_BUILTIN] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
+ [LOAD_GLOBAL] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC0000 },
+ [LOAD_GLOBAL_MODULE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC0000 },
+ [LOAD_GLOBAL_BUILTIN] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC0000 },
[DELETE_FAST] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[MAKE_CELL] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[DELETE_DEREF] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },