Commit 57ed81d
pythongh-100239: Propagate compact-int result type through BINARY_OP_EXTEND
Add a `result_compact_int` flag to _PyBinaryOpSpecializationDescr. When
set, the tier 2 optimizer emits `sym_new_compact_int` for the
_BINARY_OP_EXTEND result instead of a generic PyLong_Type symbol. This
lets downstream int-typed uops (_GUARD_TOS_INT / _GUARD_NOS_INT)
recognize that the value is already compact and elide their guards.
Mark the six compactlongs bitwise entries (OR/AND/XOR and inplace
variants) and the two RSHIFT entries as compact: bitwise ops and right
shift of compact longs always stay within compact range. LSHIFT is
left unmarked because `compact << rhs` with `rhs <= 16` can reach
~2^46, which is not compact.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 06900f5 commit 57ed81d
4 files changed
Lines changed: 40 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
518 | 523 | | |
519 | 524 | | |
520 | 525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
531 | 538 | | |
532 | 539 | | |
533 | 540 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2308 | 2308 | | |
2309 | 2309 | | |
2310 | 2310 | | |
2311 | | - | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
2318 | | - | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
2322 | | - | |
2323 | | - | |
2324 | | - | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
2325 | 2330 | | |
2326 | 2331 | | |
2327 | 2332 | | |
| |||
0 commit comments