Skip to content

Regression: restore standalone AOT GC LLVM cycle scan (#18630)#18726

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-18630-gc-aot-regression-fix
Jul 13, 2026
Merged

Regression: restore standalone AOT GC LLVM cycle scan (#18630)#18726
PurHur merged 1 commit into
masterfrom
agent/issue-18630-gc-aot-regression-fix

Conversation

@PurHur

@PurHur PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes a master regression introduced by #18640 (#18630): nested-JIT of GcCollectCyclesNativeScanJitHelper during standalone AOT init produced invalid LLVM IR (__value__writeHashtable type mismatch), breaking all bin/compile.php standalone builds including HelloWorld, hash, and password_hash AOT fixtures.

Root cause: #18640 set usesPhpRegistry() always true and routed standalone phpc_gc_collect_cycles_impl through PHP array scan helpers; nested JIT of those helpers fails module verify.

Fix: Restore pre-#18640 dual path — embed uses PHP registry (GcCollectCyclesRegistryJitHelper); standalone uses GcCollectCyclesStandaloneLlvm for cycle scan/registry LLVM (same as #17015). Keeps #18630 PHP-in-PHP goal for embed; defers standalone PHP scan until nested array JIT is safe.

php-src reference

  • Zend/zend_gc.c — gc_collect_cycles / root buffer

Verification

source script/php-env.sh

# HelloWorld AOT (was Module verification failed)
./vendor/bin/phpunit --filter ExamplesHelloWorldAotRegressionTest
# OK (4 tests, 22 assertions)

# GC standalone ABI
./vendor/bin/phpunit --filter 'GcCollectCyclesRuntimeStandaloneTest|GcCollectCyclesStandaloneLlvmShrinkTest'
# OK

# Simple compile
tmpdir=$(mktemp -d)
php bin/compile.php -o "$tmpdir/h" -r 'echo "hello\n";' && "$tmpdir/h"
# hello

# Hash incremental VM + AOT
php bin/vm.php test/repro/hash_context_incremental.php
# b94d27b9… ×2
export PHP_COMPILER_AOT_USER_SCRIPT=1
php bin/compile.php -o "$tmpdir/hc" test/repro/hash_context_incremental.php && "$tmpdir/hc"
# b94d27b9… ×2

export PHP_COMPILER_AOT_USER_SCRIPT=1
php bin/compile.php -o "$tmpdir/h" -r 'echo hash("sha256","hello"),"\n";' && "$tmpdir/h"
# 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824

Closes #18630 (regression follow-up — full standalone PHP GC scan remains future work)

Made with Cursor

#18640 nested-JIT of GcCollectCyclesNativeScanJitHelper broke all standalone
AOT compiles (LLVM module verify: writeHashtable type mismatch). Restore
GcCollectCyclesStandaloneLlvm for standalone collect/registry; keep PHP registry
on embed. Hash context incremental AOT + HelloWorld compile green again.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit b3f7e87 into master Jul 13, 2026
@PurHur PurHur deleted the agent/issue-18630-gc-aot-regression-fix branch July 13, 2026 21:33
PurHur added a commit that referenced this pull request Jul 13, 2026
…) (#18735)

#18726 restored standalone AOT GC LLVM cycle scan but left the file off the
compile spine; ci-fast spine-coverage gate failed on master.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur

PurHur commented Jul 13, 2026

Copy link
Copy Markdown
Owner Author

Merged spine follow-up #18735 — added GcCollectCyclesStandaloneLlvm.php to compiler_lib_spine_smoke/main.php; check-selfhost-spine-coverage-sync OK (4794/4794).

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.

php-in-php: delete GcCollectCyclesStandaloneLlvm — route standalone AOT GC registry/collect through PHP helpers (#1492)

1 participant