Skip to content

Self-host M5: gen-0 bootstrap link scripts still shell out to Zend php bin/compile.php #2842

@PurHur

Description

@PurHur

Milestone

M5 (bootstrap driver) — parent #1492 (closed #1521 proved native driver smoke; gen-0 entrypoints still Zend)

Problem

M4 ladder is green (make bootstrap-loop-probe, gen-2→gen-3 717/717), and BOOTSTRAP_M5_DRIVER_SMOKE=1 make bootstrap-selfhost-driver-smoke uses a compiled gen-2 driver for emit+run. Yet every fresh tree still requires host Zend for the first native link:

script/bootstrap-selfhost-link.sh (and siblings) call:

php "${ROOT}/bin/compile.php" -o "${OUT}" "${ENTRY}"

Harness 2026-05-27: build/selfhost-compile-driver and PHP_COMPILER_M3_SOURCE=bin/compile.php helloworld-compile-bin are green, but bootstrap-selfhost-link does not use them for gen-0.

Scope

Path Work
script/bootstrap-selfhost-link.sh After one-time gen-0 link, prefer build/selfhost-compile-driver or build/bin-compile-aot when present
script/bootstrap-selfhost-lib-spine-smoke-link.sh Same pattern for spine link
script/bootstrap-loop-gen1-link.sh Ensure gen-1 path does not re-invoke Zend when compiled driver exists
lib/JIT.php, lib/Cli/ Any remaining driver symbols for inventory-scale link
Makefile Document two-stage bootstrap env vars

Repro

# Green M4/M5 slices (compiled driver):
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-driver-smoke'
./script/docker-exec.sh -- bash -lc '
  export PHP_COMPILER_M3_SOURCE=bin/compile.php
  ./script/bootstrap-selfhost-helloworld-compile-bin.sh
'

# Still Zend on gen-0:
grep -n 'php.*bin/compile.php' script/bootstrap-selfhost-link.sh
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-link'
# uses php bin/compile.php (requires host php + vendor/)

Done when

  • Documented two-stage bootstrap: (1) optional Zend gen-0 link once, (2) all routine make bootstrap-* use compiled driver when build/selfhost-compile-driver exists
  • make bootstrap-selfhost-link succeeds on a host without php when gen-0 artifact + compiled driver already built (or skip gen-0 with env)
  • docs/bootstrap-selfhost.md row “Bootstrap driver” reflects compiled path as default
  • Unblocks shrinking Zend from developer loop before full Language: enum implements metadata in CFG/VM (#2299) #2830-class cold boot

Labels

self-host, bootstrap, IMPORTANT

Links

#1492 · #1521 ✅ · #2697 ✅ · #1416 (cold boot)

Metadata

Metadata

Assignees

No one assigned

    Labels

    MOST IMPORTANTThis are the most important targetsphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions