diff options
author | Guido van Rossum <guido@python.org> | 2023-09-15 15:39:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 15:39:05 (GMT) |
commit | a7a079798d1c3542ecbb041a868429d515639e35 (patch) | |
tree | ef391bd0e77cdc27a4a36718613b4884b8e4feaa /Include/internal | |
parent | 47af18859385fd996bf7f8fa4b33600c59a6d626 (diff) | |
download | cpython-a7a079798d1c3542ecbb041a868429d515639e35.zip cpython-a7a079798d1c3542ecbb041a868429d515639e35.tar.gz cpython-a7a079798d1c3542ecbb041a868429d515639e35.tar.bz2 |
gh-109287: Desugar inst(X) to op(X); macro(X) = X (#109294)
This makes the internal representation in the code generator simpler: there's a list of ops, and a list of macros, and there's no special-casing needed for ops that aren't macros. (There's now special-casing for ops that are also macros, but that's simpler.)
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_opcode_metadata.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Include/internal/pycore_opcode_metadata.h b/Include/internal/pycore_opcode_metadata.h index 856c3ac..bb37e9a 100644 --- a/Include/internal/pycore_opcode_metadata.h +++ b/Include/internal/pycore_opcode_metadata.h @@ -170,6 +170,8 @@ int _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 2; case BINARY_OP_ADD_UNICODE: return 2; + case _BINARY_OP_INPLACE_ADD_UNICODE: + return 2; case BINARY_OP_INPLACE_ADD_UNICODE: return 2; case BINARY_SUBSCR: @@ -430,6 +432,8 @@ int _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 0; case _ITER_CHECK_LIST: return 1; + case _ITER_JUMP_LIST: + return 1; case _IS_ITER_EXHAUSTED_LIST: return 1; case _ITER_NEXT_LIST: @@ -438,6 +442,8 @@ int _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case _ITER_CHECK_TUPLE: return 1; + case _ITER_JUMP_TUPLE: + return 1; case _IS_ITER_EXHAUSTED_TUPLE: return 1; case _ITER_NEXT_TUPLE: @@ -446,6 +452,8 @@ int _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case _ITER_CHECK_RANGE: return 1; + case _ITER_JUMP_RANGE: + return 1; case _IS_ITER_EXHAUSTED_RANGE: return 1; case _ITER_NEXT_RANGE: @@ -702,6 +710,8 @@ int _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 1; case BINARY_OP_ADD_UNICODE: return 1; + case _BINARY_OP_INPLACE_ADD_UNICODE: + return 0; case BINARY_OP_INPLACE_ADD_UNICODE: return 0; case BINARY_SUBSCR: @@ -962,6 +972,8 @@ int _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 0; case _ITER_CHECK_LIST: return 1; + case _ITER_JUMP_LIST: + return 1; case _IS_ITER_EXHAUSTED_LIST: return 2; case _ITER_NEXT_LIST: @@ -970,6 +982,8 @@ int _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 2; case _ITER_CHECK_TUPLE: return 1; + case _ITER_JUMP_TUPLE: + return 1; case _IS_ITER_EXHAUSTED_TUPLE: return 2; case _ITER_NEXT_TUPLE: @@ -978,6 +992,8 @@ int _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 2; case _ITER_CHECK_RANGE: return 1; + case _ITER_JUMP_RANGE: + return 1; case _IS_ITER_EXHAUSTED_RANGE: return 2; case _ITER_NEXT_RANGE: @@ -1905,11 +1921,11 @@ const uint8_t _PyOpcode_Caches[256] = { [COMPARE_OP] = 1, [POP_JUMP_IF_FALSE] = 1, [POP_JUMP_IF_TRUE] = 1, + [POP_JUMP_IF_NONE] = 1, + [POP_JUMP_IF_NOT_NONE] = 1, [FOR_ITER] = 1, [CALL] = 3, [BINARY_OP] = 1, - [POP_JUMP_IF_NONE] = 1, - [POP_JUMP_IF_NOT_NONE] = 1, [JUMP_BACKWARD] = 1, }; #endif // NEED_OPCODE_METADATA |