Perf: lazy native-long / hot path (no value-box) (#36386) - #37054
Merged
Conversation
Exact int/int division stays TYPE_NATIVE_LONG with a cold f64 slot — peer of ±/× overflow lazy materialize. Also box on named assign / return coerce so `$x = PHP_INT_MAX + 1` matches Zend (leftover of #37051). php-src: Zend/zend_operators.c div_function. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
int/int/staysTYPE_NATIVE_LONGwith a cold f64 slot — peer of ±/× lazy overflow (Perf: lazy f64 overflow slot for native-long ±/× (#36386) #37051 / Performance: v2.0 targets and the codegen roadmap to reach them — typed code ≥ 3x Zend, untyped ≤ 1.5x slower, web request ≥ php-fpm: inline caches for property/method access, escape analysis for arrays/strings, guarded speculation, per-function O1 by default (lib/JIT.php, lib/JIT/Builtin/Type/Object_.php, lib/JIT/Analyzer.php) #36386); noentryAllocaValueBoxon the hot path.$x = PHP_INT_MAX + 1andvar_dump($a / $b)match Zend (leftover of Perf: lazy f64 overflow slot for native-long ±/× (#36386) #37051).: intreturn of non-exact/TypeErrors via promote-flag check.php-src:
Zend/zend_operators.cdiv_function.Part of #36386.
Test plan
./script/phpunit.sh --filter 'NativeLongDivHeapLazyAotTest|NativeLongOverflowHeapLazyAotTest|IntArithOverflowPromote31964AotTest'→ 6/6./script/aot-smoke.sh→ 9/9 + size gate OKmake north-star5-verify-fast→ OK (spine 8343/8343)show_div(10,2|7,2)+show_ov(PHP_INT_MAX)identical AOT/Zendscript/differential-sweep.sh --aot --repeat 3— arith/c*/e*/g*/i36386* paths green;i36386_nothrow_strlen_literalDIFF (300 vs 201) reproduces on master (not this PR); intermittent core dumps under dual-run load not attributed to this slice