mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-105481: add pseudo-instructions to the bytecodes DSL (#105506)
This commit is contained in:
parent
20a56d8bec
commit
58f5227d7c
8 changed files with 507 additions and 267 deletions
|
@ -416,9 +416,13 @@ normalize_jumps_in_block(cfg_builder *g, basicblock *b) {
|
|||
bool is_forward = last->i_target->b_visited == 0;
|
||||
switch(last->i_opcode) {
|
||||
case JUMP:
|
||||
assert(SAME_OPCODE_METADATA(JUMP, JUMP_FORWARD));
|
||||
assert(SAME_OPCODE_METADATA(JUMP, JUMP_BACKWARD));
|
||||
last->i_opcode = is_forward ? JUMP_FORWARD : JUMP_BACKWARD;
|
||||
return SUCCESS;
|
||||
case JUMP_NO_INTERRUPT:
|
||||
assert(SAME_OPCODE_METADATA(JUMP_NO_INTERRUPT, JUMP_FORWARD));
|
||||
assert(SAME_OPCODE_METADATA(JUMP_NO_INTERRUPT, JUMP_BACKWARD_NO_INTERRUPT));
|
||||
last->i_opcode = is_forward ?
|
||||
JUMP_FORWARD : JUMP_BACKWARD_NO_INTERRUPT;
|
||||
return SUCCESS;
|
||||
|
@ -2071,9 +2075,11 @@ _PyCfg_ConvertPseudoOps(basicblock *entryblock)
|
|||
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) {
|
||||
assert(SAME_OPCODE_METADATA(instr->i_opcode, NOP));
|
||||
INSTR_SET_OP0(instr, NOP);
|
||||
}
|
||||
else if (instr->i_opcode == STORE_FAST_MAYBE_NULL) {
|
||||
assert(SAME_OPCODE_METADATA(STORE_FAST_MAYBE_NULL, STORE_FAST));
|
||||
instr->i_opcode = STORE_FAST;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue