Skip to content

Perf: lazy f64 overflow slot for native-long ±/× (#36386) - #37051

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-36386-native-long-ov-heap-box
Sep 6, 2026
Merged

Perf: lazy f64 overflow slot for native-long ±/× (#36386)#37051
PurHur merged 1 commit into
masterfrom
agent/issue-36386-native-long-ov-heap-box

Conversation

@PurHur

@PurHur PurHur commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Typed int +/-/* overflow no longer does entryAllocaValueBox + TYPE_NULL init on every arith site. The cold path stores an f64 in a plain entry alloca; __value__ boxing happens only in materializeOverflowableNativeLong (var_dump / untyped consumers).
  • Hot path merges the long via an i64 phi (dummy 0 on overflow) and keeps the llvm.*.with.overflow.i64 i1 SSA as the flag — no i1/i64 shadow allocas.
  • fibo_r IR: 0 alloca %__value__, 0 __value__writeDouble (was 3 each).
  • php-src: Zend/zend_operators.h ZEND_SIGNED_*_OVERFLOW / fast_long_sub_function.

Part of #36386 (does not close the epic).

Test plan

  • ./script/phpunit.sh --filter 'NativeLongOverflowHeapLazyAotTest|IntArithOverflowPromote31964AotTest'3/3
  • ./script/aot-smoke.sh9/9 + size gate OK
  • fibo_r IR: alloca %__value__ = 0, phi i64 present, run fibo_r(10)55
  • Note: IntSubOverflowPromote32422AotTest / StrIntOverflow* AOT cases with PHP_COMPILER_HELPER_RUNTIME_O=0 already segfault on master (reproduced without this diff); not a regression from this PR.

Made with Cursor

Keep typed int arith hot path free of entryAllocaValueBox: overflow stores
an f64 and only boxes on materialize (var_dump / untyped). fibo_r no longer
allocates three dead %__value__ per +/- site.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant