diff options
author | Mark Shannon <mark@hotpy.org> | 2023-02-13 11:24:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-13 11:24:55 (GMT) |
commit | 160f2fe2b90ed5ec7838cb4141dd35768422891f (patch) | |
tree | 2d9617e40227da45aa8e3c4452eaa0f389a0d879 /Python/opcode_metadata.h | |
parent | a1f08f5f19753c7c9295f51b5ae1262c7a1c838f (diff) | |
download | cpython-160f2fe2b90ed5ec7838cb4141dd35768422891f.zip cpython-160f2fe2b90ed5ec7838cb4141dd35768422891f.tar.gz cpython-160f2fe2b90ed5ec7838cb4141dd35768422891f.tar.bz2 |
GH-87849: Simplify stack effect of SEND and specialize it for generators and coroutines. (GH-101788)
Diffstat (limited to 'Python/opcode_metadata.h')
-rw-r--r-- | Python/opcode_metadata.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index db1dfd3..d622eb1 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -104,6 +104,8 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case SEND: return 2; + case SEND_GEN: + return 2; case YIELD_VALUE: return 1; case POP_EXCEPT: @@ -453,7 +455,9 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { case GET_AWAITABLE: return 1; case SEND: - return ((!jump) ? 1 : 0) + 1; + return 2; + case SEND_GEN: + return 1; case YIELD_VALUE: return 1; case POP_EXCEPT: @@ -465,7 +469,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { case END_ASYNC_FOR: return 0; case CLEANUP_THROW: - return 1; + return 2; case LOAD_ASSERTION_ERROR: return 1; case LOAD_BUILD_CLASS: @@ -763,7 +767,8 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [GET_AITER] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX }, [GET_ANEXT] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX }, [GET_AWAITABLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB }, - [SEND] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB }, + [SEND] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC }, + [SEND_GEN] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC }, [YIELD_VALUE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX }, [POP_EXCEPT] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX }, [RERAISE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB }, |