Skip to content

Commit

Permalink
pythongh-107901: compiler replaces POP_BLOCK instruction by NOPs befo…
Browse files Browse the repository at this point in the history
…re optimisations
  • Loading branch information
iritkatriel committed Jan 25, 2024
1 parent 185b872 commit 7004b26
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Python/flowgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,15 @@ label_exception_targets(basicblock *entryblock) {
PyMem_Free(except_stack);
}
}

for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
for (int i = 0; i < b->b_iused; i++) {
cfg_instr *instr = &b->b_instr[i];
if (instr->i_opcode == POP_BLOCK) {
INSTR_SET_OP0(instr, NOP);
}
}
}
#ifdef Py_DEBUG
for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
assert(b->b_exceptstack == NULL);
Expand Down Expand Up @@ -2313,7 +2322,7 @@ convert_pseudo_ops(cfg_builder *g)
for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
for (int i = 0; i < b->b_iused; i++) {
cfg_instr *instr = &b->b_instr[i];
if (is_block_push(instr) || instr->i_opcode == POP_BLOCK) {
if (is_block_push(instr)) {
INSTR_SET_OP0(instr, NOP);
}
else if (instr->i_opcode == LOAD_CLOSURE) {
Expand Down

0 comments on commit 7004b26

Please sign in to comment.