8000 gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions by iritkatriel · Pull Request #105865 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
replace usages of HAS_CONST by OPCODE_HAS_CONST
  • Loading branch information
iritkatriel committed Jun 15, 2023
commit eeb0290a2ee56897b5bb7c92f0afd77668f949de
2 changes: 1 addition & 1 deletion Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,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; \
Expand Down
12 changes: 6 additions & 6 deletions Python/flowgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ static PyObject*
get_const_value(int opcode, int oparg, PyObject *co_consts)
{
PyObject *constant = NULL;
assert(HAS_CONST(opcode));
assert(OPCODE_HAS_CONST(opcode));
if (opcode == LOAD_CONST) {
constant = PyList_GET_ITEM(co_consts, oparg);
}
Expand Down Expand Up @@ -1139,7 +1139,7 @@ fold_tuple_on_constants(PyObject *const_cache,
assert(inst[n].i_oparg == n);

for (int i = 0; i < n; i++) {
if (!HAS_CONST(inst[i].i_opcode)) {
if (!OPCODE_HAS_CONST(inst[i].i_opcode)) {
return SUCCESS;
}
}
Expand Down Expand Up @@ -1542,8 +1542,8 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts)
}
break;
default:
/* All HAS_CONST opcodes should be handled with LOAD_CONST */
assert (!HAS_CONST(inst->i_opcode));
/* All OPCODE_HAS_CONST opcodes should be handled with LOAD_CONST */
assert (!OPCODE_HAS_CONST(inst->i_opcode));
}
}

Expand Down Expand Up @@ -1793,7 +1793,7 @@ remove_unused_consts(basicblock *entryblock, PyObject *consts)
/* mark used consts */
for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
for (int i = 0; i < b->b_iused; i++) {
if (HAS_CONST(b->b_instr[i].i_opcode)) {
if (OPCODE_HAS_CONST(b->b_instr[i].i_opcode)) {
int index = b->b_instr[i].i_oparg;
index_map[index] = index;
}
Expand Down Expand Up @@ -1846,7 +1846,7 @@ remove_unused_consts(basicblock *entryblock, PyObject *consts)

for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
for (int i = 0; i < b->b_iused; i++) {
if (HAS_CONST(b->b_instr[i].i_opcode)) {
if (OPCODE_HAS_CONST(b->b_instr[i].i_opcode)) {
int index = b->b_instr[i].i_oparg;
assert(reverse_index_map[index] >= 0);
assert(reverse_index_map[index] < n_used_consts);
Expand Down
0