Skip to content

Perf: keep native-long +/−/* on TYPE_NATIVE_LONG hot path (#36189) - #36280

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-36189-native-long-overflow-fastpath
Sep 2, 2026
Merged

Perf: keep native-long +/−/* on TYPE_NATIVE_LONG hot path (#36189)#36280
PurHur merged 1 commit into
masterfrom
agent/issue-36189-native-long-overflow-fastpath

Conversation

@PurHur

@PurHur PurHur commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #36189

Root cause

#31964 (#89867d206f) routed all native-long arithmetic through writeBoxedBinary, forcing 7-way value dispatch on every n-2 / + in fibo_r.

Verification

./script/aot-smoke.sh                                    → 8/8
make dev-verify-fast                                     → OK (66s)
make north-star5-verify-fast                               → OK
./script/phpunit.sh --filter 'IntArithOverflowPromote31964AotTest|IntSubOverflowPromote32422AotTest' → 3/3

# fibo(30) in Docker:
php bin/compile.php -o /tmp/fibo30 "benchmarks/fibo(30).php"
time /tmp/fibo30                                         → 0.012s (was ~0.13s)
objdump -d --disassemble=fibo_r /tmp/fibo30 | grep __value__ | wc -l → 0 (was ~400 insn path)

test/repro/issue_int_sub_overflow.php AOT               → float promotion OK

Not covered

  • script/differential-sweep.sh --aot --repeat 3 (not run this run — no lowering-shape change beyond native-long pair fast path)
  • Runtime overflow on variable⊗variable native-long pairs without constant fold (rare; boxed paths unchanged)

Made with Cursor

binaryNativeLong() was boxing every result into __value__ after #31964,
turning typed recursion (fibo_r) into ~400-instruction value dispatch.
Restore direct i64 results for native-long pairs; literals still fold via
tryFoldBinary and boxed operands still use writeBoxedBinary overflow paths.

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

1 participant