Skip to content

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

@PurHur

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions