summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-06-17 16:00:16 (GMT)
committerGitHub <noreply@github.com>2023-06-17 16:00:16 (GMT)
commit14d01262dad02579b3dffe5965f640ce21c38896 (patch)
treed3e4dc72599c95f5dc3b3dd7eec5a1f4f3d673b0 /Python/compile.c
parent34e93d3998bab8acd651c50724eb1977f4860a08 (diff)
downloadcpython-14d01262dad02579b3dffe5965f640ce21c38896.zip
cpython-14d01262dad02579b3dffe5965f640ce21c38896.tar.gz
cpython-14d01262dad02579b3dffe5965f640ce21c38896.tar.bz2
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/Python/compile.c b/Python/compile.c
index afb7b7d..cfa945b 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -134,9 +134,8 @@ enum {
int
_PyCompile_InstrSize(int opcode, int oparg)
{
- assert(IS_PSEUDO_OPCODE(opcode) == IS_PSEUDO_INSTR(opcode));
assert(!IS_PSEUDO_INSTR(opcode));
- assert(HAS_ARG(opcode) || oparg == 0);
+ assert(OPCODE_HAS_ARG(opcode) || oparg == 0);
int extended_args = (0xFFFFFF < oparg) + (0xFFFF < oparg) + (0xFF < oparg);
int caches = _PyOpcode_Caches[opcode];
return extended_args + 1 + caches;
@@ -248,15 +247,9 @@ instr_sequence_use_label(instr_sequence *seq, int lbl) {
static int
instr_sequence_addop(instr_sequence *seq, int opcode, int oparg, location loc)
{
- /* compare old and new opcode macros - use ! to compare as bools. */
- assert(!HAS_ARG(opcode) == !OPCODE_HAS_ARG(opcode));
- assert(!HAS_CONST(opcode) == !OPCODE_HAS_CONST(opcode));
- assert(!OPCODE_HAS_JUMP(opcode) == !OPCODE_HAS_JUMP(opcode));
-
assert(0 <= opcode && opcode <= MAX_OPCODE);
- assert(IS_PSEUDO_OPCODE(opcode) == IS_PSEUDO_INSTR(opcode));
assert(IS_WITHIN_OPCODE_RANGE(opcode));
- assert(HAS_ARG(opcode) || HAS_TARGET(opcode) || oparg == 0);
+ assert(OPCODE_HAS_ARG(opcode) || HAS_TARGET(opcode) || oparg == 0);
assert(0 <= oparg && oparg < (1 << 30));
int idx = instr_sequence_next_inst(seq);
@@ -874,7 +867,7 @@ PyCompile_OpcodeStackEffect(int opcode, int oparg)
static int
codegen_addop_noarg(instr_sequence *seq, int opcode, location loc)
{
- assert(!HAS_ARG(opcode));
+ assert(!OPCODE_HAS_ARG(opcode));
assert(!IS_ASSEMBLER_OPCODE(opcode));
return instr_sequence_addop(seq, opcode, 0, loc);
}
@@ -1151,7 +1144,7 @@ codegen_addop_j(instr_sequence *seq, location loc,
}
#define ADDOP_N(C, LOC, OP, O, TYPE) { \
- assert(!HAS_CONST(OP)); /* use ADDOP_LOAD_CONST_NEW */ \
+ assert(!OPCODE_HAS_CONST(OP)); /* use ADDOP_LOAD_CONST_NEW */ \
if (compiler_addop_o((C)->u, (LOC), (OP), (C)->u->u_metadata.u_ ## TYPE, (O)) < 0) { \
Py_DECREF((O)); \
return ERROR; \
@@ -7798,7 +7791,7 @@ instructions_to_instr_sequence(PyObject *instructions, instr_sequence *seq)
goto error;
}
int oparg;
- if (HAS_ARG(opcode)) {
+ if (OPCODE_HAS_ARG(opcode)) {
oparg = PyLong_AsLong(PyTuple_GET_ITEM(item, 1));
if (PyErr_Occurred()) {
goto error;