Skip to content

Self-host M5: fix new Runtime() LLVM 9 segfault under SELFHOST_AOT (#2600) - #2696

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-2600-runtime-selfhost-aot
May 27, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-2600-runtime-selfhost-aot

Conversation

@PurHur

@PurHur PurHur commented May 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Under PHP_COMPILER_SELFHOST_AOT=1, external PHPCompiler\Runtime now registers a minimal object layout (mode only) so new Runtime(...) JIT lowering no longer segfaults LLVM 9 during property init.
  • Route M3 compile-driver Runtime::__construct through the native vmContext stub (fixes compile-driver path that previously fell through to full PHP CFG lowering).
  • Set PHP_COMPILER_M3_COMPILE_DRIVER=1 in M3 emit sidecar host-compile env for bin/compile.php.

Verification

./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  export PHP_COMPILER_SELFHOST_AOT=1
  php bin/compile.php -o /tmp/t-out /tmp/t.php  # t.php: new Runtime(MODE_AOT)
  make bootstrap-selfhost-helloworld-compile-bin
  make bootstrap-selfhost-helloworld
'

Remaining blocker (#2600)

php bin/compile.php -o … bin/compile.php still fails at Runtime::standalone() with LLVM module verification (Terminator found in the middle of a basic block). Native emit of bin/compile.php via make bootstrap-selfhost-helloworld-compile-bin remains blocked at parseAndCompile returned null until the sidecar host-compile succeeds.

Closes #2600 partially — next slice is Runtime::standalone spine lowering for production driver AOT link.

Made with Cursor

…OT (#2600).

Use a minimal external Runtime object layout for self-host AOT so allocate()
does not init the full spine property graph. Route M3 compile-driver
Runtime::__construct through the native vmContext stub instead of PHP CFG
lowering that never ran under PHP_COMPILER_M3_COMPILE_DRIVER.

bin/compile.php AOT link still fails at Runtime::standalone LLVM verify;
native emit via sidecar remains blocked until that spine slice lands.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 18767e7 into master May 27, 2026
@PurHur
PurHur deleted the agent/issue-2600-runtime-selfhost-aot branch May 27, 2026 10:44
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.

Self-host M5: gen-1 binary compiles bin/compile.php spine (full driver, not loop smoke slice)

1 participant