diff options
| author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-02-01 19:38:06 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-01 19:38:06 (GMT) |
| commit | b91b42d236c81bd7cbe402b322c82bfcd0d883a1 (patch) | |
| tree | 4b94ef6a601374197e1ceaf9b2b073d9215e257d /Python/opcode_metadata.h | |
| parent | 7840ff3cdbdf64f517c9f981f57eff232e676104 (diff) | |
| download | cpython-b91b42d236c81bd7cbe402b322c82bfcd0d883a1.zip cpython-b91b42d236c81bd7cbe402b322c82bfcd0d883a1.tar.gz cpython-b91b42d236c81bd7cbe402b322c82bfcd0d883a1.tar.bz2 | |
gh-98831: rewrite PUSH_EXC_INFO and conditional jumps in the instruction definition DSL (#101481)
Diffstat (limited to 'Python/opcode_metadata.h')
| -rw-r--r-- | Python/opcode_metadata.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 96e57be..c9f9759 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -4,7 +4,7 @@ #ifndef NDEBUG static int -_PyOpcode_num_popped(int opcode, int oparg) { +_PyOpcode_num_popped(int opcode, int oparg, bool jump) { switch(opcode) { case NOP: return 0; @@ -233,17 +233,17 @@ _PyOpcode_num_popped(int opcode, int oparg) { case JUMP_BACKWARD: return 0; case POP_JUMP_IF_FALSE: - return -1; + return 1; case POP_JUMP_IF_TRUE: - return -1; + return 1; case POP_JUMP_IF_NOT_NONE: - return -1; + return 1; case POP_JUMP_IF_NONE: - return -1; + return 1; case JUMP_IF_FALSE_OR_POP: - return -1; + return 1; case JUMP_IF_TRUE_OR_POP: - return -1; + return 1; case JUMP_BACKWARD_NO_INTERRUPT: return 0; case GET_LEN: @@ -277,7 +277,7 @@ _PyOpcode_num_popped(int opcode, int oparg) { case WITH_EXCEPT_START: return 4; case PUSH_EXC_INFO: - return -1; + return 1; case LOAD_ATTR_METHOD_WITH_VALUES: return 1; case LOAD_ATTR_METHOD_NO_DICT: @@ -350,7 +350,7 @@ _PyOpcode_num_popped(int opcode, int oparg) { #ifndef NDEBUG static int -_PyOpcode_num_pushed(int opcode, int oparg) { +_PyOpcode_num_pushed(int opcode, int oparg, bool jump) { switch(opcode) { case NOP: return 0; @@ -579,17 +579,17 @@ _PyOpcode_num_pushed(int opcode, int oparg) { case JUMP_BACKWARD: return 0; case POP_JUMP_IF_FALSE: - return -1; + return 0; case POP_JUMP_IF_TRUE: - return -1; + return 0; case POP_JUMP_IF_NOT_NONE: - return -1; + return 0; case POP_JUMP_IF_NONE: - return -1; + return 0; case JUMP_IF_FALSE_OR_POP: - return -1; + return (jump ? 1 : 0); case JUMP_IF_TRUE_OR_POP: - return -1; + return (jump ? 1 : 0); case JUMP_BACKWARD_NO_INTERRUPT: return 0; case GET_LEN: @@ -623,7 +623,7 @@ _PyOpcode_num_pushed(int opcode, int oparg) { case WITH_EXCEPT_START: return 5; case PUSH_EXC_INFO: - return -1; + return 2; case LOAD_ATTR_METHOD_WITH_VALUES: return ((oparg & 1) ? 1 : 0) + 1; case LOAD_ATTR_METHOD_NO_DICT: |
