Skip to content

Fix wave 12 bootstrap array ops AOT lowering (#1112)#1162

Merged
PurHur merged 1 commit into
masterfrom
fix/wave12-array-ops-bootstrap
May 23, 2026
Merged

Fix wave 12 bootstrap array ops AOT lowering (#1112)#1162
PurHur merged 1 commit into
masterfrom
fix/wave12-array-ops-bootstrap

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 23, 2026

Summary

  • Register wave 12 array builtins (array_push, array_unshift, array_filter, array_combine, sort, compact, extract, etc.) in SelfHostBuiltinPolicy::CATEGORY_ARRAY so self-host AOT uses real Internal JIT lowering instead of ExternalMethod stubs.
  • Fix hashtable persistence: set packed-list metadata after materializeNativeArrayForCall, re-box native arrays as TYPE_VALUE after in-place mutation, and write back after sort().
  • Add unit test guarding wave 12 array ops stay on real lowering under PHP_COMPILER_SELFHOST_AOT=1.

Closes #1112 (partial — wave 12 bootstrap array fixtures). Supersedes #1151.

Verification (Docker, tar sync — harness bind-mount stale)

tar -cf - --exclude='.git' --exclude='.llvm' . | docker run --rm -i -w /compiler -m 10g \
  -e PHP_COMPILER_CI_RAM_GB=8 -e PHP_COMPILER_MEMORY_LIMIT=1536M \
  php-compiler:22.04-dev bash -c 'tar -xf - -C /compiler && source script/ci-defaults.env && export PHP_COMPILER_LLVM_PATH=/compiler/.llvm && php vendor/bin/phpunit test/unit/SelfHostBuiltinPolicyTest.php && php -d memory_limit=1536M bin/compile.php -o /tmp/ops test/bootstrap-aot/stdlib_array_ops.php && /tmp/ops'

Expected stdout: 42671 (matches Zend).

Test plan

  • SelfHostBuiltinPolicyTest (4 tests)
  • stdlib_array_ops.php AOT compile + execute matches Zend
  • Full ./script/ci-local.sh (master currently has unrelated fast-suite failures in this harness)

Made with Cursor

Keep array_push, sort, compact, and related builtins on real JIT under
self-host AOT, and fix hashtable materialization/writeback so
stdlib_array_ops bootstrap fixtures compile and match Zend output.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit dd92fa6 into master May 23, 2026
1 check passed
@PurHur PurHur deleted the fix/wave12-array-ops-bootstrap branch May 23, 2026 19:18
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.

📦 ext/standard JIT backlog (umbrella) — parallel work queue

1 participant