GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599)

This commit is contained in:
Mark Shannon 2023-07-11 11:33:59 +01:00 committed by GitHub
parent 1f2921b72c
commit c0c041a31b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 283 additions and 237 deletions

View file

@ -35,6 +35,7 @@
#define _BINARY_OP_ADD_UNICODE 313
#define _LOAD_LOCALS 314
#define _LOAD_FROM_DICT_OR_GLOBALS 315
#define IS_NONE 316
#ifndef NEED_OPCODE_METADATA
extern int _PyOpcode_num_popped(int opcode, int oparg, bool jump);
@ -328,10 +329,10 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
return 1;
case POP_JUMP_IF_TRUE:
return 1;
case POP_JUMP_IF_NOT_NONE:
return 1;
case POP_JUMP_IF_NONE:
return 1;
case POP_JUMP_IF_NOT_NONE:
return 1;
case JUMP_BACKWARD_NO_INTERRUPT:
return 0;
case GET_LEN:
@ -772,10 +773,10 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
return 0;
case POP_JUMP_IF_TRUE:
return 0;
case POP_JUMP_IF_NOT_NONE:
return 0;
case POP_JUMP_IF_NONE:
return 0;
case POP_JUMP_IF_NOT_NONE:
return 0;
case JUMP_BACKWARD_NO_INTERRUPT:
return 0;
case GET_LEN:
@ -1104,8 +1105,8 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[512] = {
[ENTER_EXECUTOR] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_FALSE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_TRUE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[POP_JUMP_IF_NOT_NONE] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[JUMP_BACKWARD_NO_INTERRUPT] = { true, INSTR_FMT_IB, HAS_ARG_FLAG | HAS_JUMP_FLAG },
[GET_LEN] = { true, INSTR_FMT_IX, 0 },
[MATCH_CLASS] = { true, INSTR_FMT_IB, HAS_ARG_FLAG },
@ -1310,6 +1311,7 @@ const char * const _PyOpcode_uop_name[512] = {
[313] = "_BINARY_OP_ADD_UNICODE",
[314] = "_LOAD_LOCALS",
[315] = "_LOAD_FROM_DICT_OR_GLOBALS",
[316] = "IS_NONE",
};
#endif // NEED_OPCODE_METADATA
#endif