summaryrefslogtreecommitdiffstats
path: root/Python/opcode_metadata.h
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-02-07 20:37:43 (GMT)
committerGitHub <noreply@github.com>2023-02-07 20:37:43 (GMT)
commitdec1ab03879e959f7efb910a723caf4a9ce453cf (patch)
tree4339eb2f4fc3f4fd383ef83fde76e8ef3fc59ab3 /Python/opcode_metadata.h
parentf87f6e23964d7a4c38b655089cda65538a24ec36 (diff)
downloadcpython-dec1ab03879e959f7efb910a723caf4a9ce453cf.zip
cpython-dec1ab03879e959f7efb910a723caf4a9ce453cf.tar.gz
cpython-dec1ab03879e959f7efb910a723caf4a9ce453cf.tar.bz2
gh-98831: rewrite UNPACK_EX, UNPACK_SEQUENCE, UNPACK_SEQUENCE_TWO_TUPLE in the instruction definition DSL (#101641)
Diffstat (limited to 'Python/opcode_metadata.h')
-rw-r--r--Python/opcode_metadata.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index ed26ff0..d258535 100644
--- a/Python/opcode_metadata.h
+++ b/Python/opcode_metadata.h
@@ -121,15 +121,15 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
case DELETE_NAME:
return 0;
case UNPACK_SEQUENCE:
- return -1;
+ return 1;
case UNPACK_SEQUENCE_TWO_TUPLE:
- return -1;
+ return 1;
case UNPACK_SEQUENCE_TUPLE:
return -1;
case UNPACK_SEQUENCE_LIST:
return -1;
case UNPACK_EX:
- return -1;
+ return 1;
case STORE_ATTR:
return 2;
case DELETE_ATTR:
@@ -467,15 +467,15 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
case DELETE_NAME:
return 0;
case UNPACK_SEQUENCE:
- return -1;
+ return oparg;
case UNPACK_SEQUENCE_TWO_TUPLE:
- return -1;
+ return 2;
case UNPACK_SEQUENCE_TUPLE:
return -1;
case UNPACK_SEQUENCE_LIST:
return -1;
case UNPACK_EX:
- return -1;
+ return (oparg & 0xFF) + (oparg >> 8) + 1;
case STORE_ATTR:
return 0;
case DELETE_ATTR:
@@ -759,8 +759,8 @@ struct opcode_metadata {
[LOAD_BUILD_CLASS] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
[STORE_NAME] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[DELETE_NAME] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
- [UNPACK_SEQUENCE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
- [UNPACK_SEQUENCE_TWO_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
+ [UNPACK_SEQUENCE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
+ [UNPACK_SEQUENCE_TWO_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IXC },
[UNPACK_SEQUENCE_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[UNPACK_SEQUENCE_LIST] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[UNPACK_EX] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },