Commit 9140ef5
authored
Bytecode parity - boolop, comprehension, CFG passes (#7631)
* Bytecode parity - boolop, comprehension, CFG passes
- Flatten nested same-op BoolOp and add IfExpr to jump_if
- Simplify is_name_imported to module-level only
- Enable inlined comprehensions in module/class scope
- Add TweakInlinedComprehensionScopes with fast_hidden tracking
- Track fb_range in FBlockInfo for with-statement line info
- Add constant subscript folding and unary Not folding
- Add emit_return_const_no_location for implicit returns
- Use JumpNoInterrupt for ternary/except jumps
- Add STACK_USE_GUIDELINE threshold for collection building
- Reorder CFG pipeline: inline small blocks earlier, resolve
line numbers before cold block extraction
- Add redirect_empty_unconditional_jump_targets,
reorder_conditional_chain_and_jump_back_blocks,
materialize_empty_conditional_exit_targets,
duplicate_shared_jump_back_targets passes
- Add borrow deoptimization for multi-handler, named-except,
protected conditional tail, and protected import joins
- Run folding/optimization passes twice around peephole
* Bytecode parity - slice augassign, async comp inline
- Augmented assignment with two-part slices uses BINARY_SLICE/STORE_SLICE
- Inline async comprehensions (remove await/async guards)
- Inlined comprehension cleanup jump uses JumpNoInterrupt
- Class firstlineno uses first decorator line when decorated
- Recurse into nested functions for static attribute collection
- Fold unary positive complex constants (+0.0j)
- Add deoptimize_borrow_for_folded_nonliteral_exprs pass
- Add inline_single_predecessor_artificial_expr_exit_blocks pass
- Skip shared artificial expr-stmt exit blocks in small-block inlining
- Mark folded boolop tail as folded_from_nonliteral_expr
* apply reviews1 parent af41d11 commit 9140ef5
14 files changed
Lines changed: 5052 additions & 1157 deletions
File tree
- Lib/test
- test_inspect
- crates
- codegen/src
- snapshots
- compiler-core/src
- vm/src
- builtins
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
511 | | - | |
512 | | - | |
513 | 511 | | |
514 | 512 | | |
515 | 513 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
1002 | | - | |
1003 | 1002 | | |
1004 | 1003 | | |
1005 | 1004 | | |
| |||
1193 | 1192 | | |
1194 | 1193 | | |
1195 | 1194 | | |
1196 | | - | |
1197 | 1195 | | |
1198 | 1196 | | |
1199 | 1197 | | |
| |||
2495 | 2493 | | |
2496 | 2494 | | |
2497 | 2495 | | |
2498 | | - | |
2499 | 2496 | | |
2500 | 2497 | | |
2501 | 2498 | | |
| |||
2579 | 2576 | | |
2580 | 2577 | | |
2581 | 2578 | | |
2582 | | - | |
2583 | 2579 | | |
2584 | 2580 | | |
2585 | 2581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1161 | 1161 | | |
1162 | 1162 | | |
1163 | 1163 | | |
1164 | | - | |
1165 | 1164 | | |
1166 | 1165 | | |
1167 | 1166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | 202 | | |
204 | 203 | | |
205 | 204 | | |
| |||
214 | 213 | | |
215 | 214 | | |
216 | 215 | | |
217 | | - | |
218 | 216 | | |
219 | 217 | | |
220 | 218 | | |
| |||
634 | 632 | | |
635 | 633 | | |
636 | 634 | | |
637 | | - | |
638 | 635 | | |
639 | 636 | | |
640 | 637 | | |
| |||
0 commit comments