Skip to content

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

Closed

Description

@PurHur

Milestone

M5 — gen-1 native binary compiles the production bootstrap driver (parent #1492 / #1521)

Problem

M4 loop slice is green on master (2026-05-27 harness):

./script/docker-exec.sh -- bash -lc 'make bootstrap-loop-probe'
# bootstrap-loop-probe: M4 gen-1→gen-2 native slice OK (exit 0)

That only compiles test/selfhost/bootstrap_loop_smoke/ → compiler smoke via compile_smoke_m3_emit_native_entry.php. It does not prove gen-1 can compile bin/compile.php / full spine for the next compiler revision.

First observed M5 failure (2026-05-27): native emit of bin/compile.php via helloworld emit helper:

helloworld_compile_smoke: parseAndCompile returned null (parser/CFG spine)
helloworld_compile_smoke: native emit failed at phase=parseAndCompile

Tracked in detail: #2633 (child issue).

Scope

Path Work
bin/compile.php Gen-1 compile target (or documented spine slice toward full entry)
test/selfhost/bootstrap_loop_smoke/compile_driver.php Extend dispatch toward bin/compile.php path
script/bootstrap-loop-gen1-link.sh New env e.g. BOOTSTRAP_M5_GEN1_COMPILE_BIN_COMPILE=1
lib/Compiler.php, lib/JIT.php, spine bundle Lowering/stubs for full driver hot path (#2632 spine growth)
lib/AOT/Linker.php M5 external-clang floor (#2514)

Repro

# Green today (slice only):
./script/docker-exec.sh -- bash -lc 'make bootstrap-loop-probe'

# Fails today — native emit production driver:
./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  BOOTSTRAP_M3_HELLOWORLD_STRICT=1 make bootstrap-selfhost-helloworld
  PHP_COMPILER_M3_COMPILE_MODE=compile \
  PHP_COMPILER_M3_SOURCE=bin/compile.php \
  PHP_COMPILER_M3_OUT=/tmp/bin-compile-aot \
  ./build/selfhost-helloworld-emit
'
# parseAndCompile returned null — see #2633

# Not yet defined — add in PR:
./script/docker-exec.sh -- bash -lc '
  source script/php-env.sh
  BOOTSTRAP_M5_GEN1_COMPILE_BIN_COMPILE=1 \
  BOOTSTRAP_M4_LINK_COMPILE_DRIVER=1 \
  BOOTSTRAP_M4_RUNTIME_COMPILE=1 \
  ./script/bootstrap-loop-gen1-link.sh
'

Done when

Labels

self-host, bootstrap, IMPORTANT

Links

#2633 · #2632 · #2551 ✅ · #2611 ✅ · #1521 · #1467 · #1492

Activity

  1. added a commit that references this issue on May 27, 2026
  2. added a commit that references this issue on May 27, 2026
  3. PurHur commented on May 27, 2026

    @PurHur
    OwnerAuthor

    Merged #2696 (partial #2600):

    • ✅ `new Runtime(MODE_AOT)` under `PHP_COMPILER_SELFHOST_AOT=1` no longer segfaults LLVM 9 (minimal external Runtime layout + native ctor routing for M3 compile-driver).
    • ✅ `make bootstrap-selfhost-helloworld-compile-bin` / strict HelloWorld emit still green.

    Still open: host AOT of `bin/compile.php` fails at `Runtime::standalone()` with LLVM module verification (`Terminator found in the middle of a basic block`). Sidecar `.m3_bin_compile_aot_blob` is not registered; `make bootstrap-selfhost-helloworld-compile-bin` with `PHP_COMPILER_M3_SOURCE=bin/compile.php` still reports `parseAndCompile returned null`.

    Next slice: Runtime::standalone / production-driver spine lowering for honest bin/compile.php sidecar host-compile.

  4. PurHur commented on May 27, 2026

    @PurHur
    OwnerAuthor

    Backlog reprioritize (2026-05-27 harness)

    M4 loop slice is green. First M5 compile-path failure is now isolated:

    Implement #2697 before expanding gen-1 driver probes in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions