Skip to content

Self-host M5: bootstrap gen-0 link prefers compiled driver when build/bin-compile-aot exists #2894

@PurHur

Description

@PurHur

Milestone

M5 (retire Zend bootstrap) — parent #1492. Follow-up to closed #2842.

Problem

script/bootstrap-resolve-compile-invoke.sh can invoke compiled build/bin-compile-aot / build/bin-compile-aot-inventory, but a fresh harness tree (build/ empty) still uses Zend for routine M0/M2 compiles until driver-smoke populates artifacts:

bootstrap-compile-invoke: php …/bin/compile.php -o … (gen-0 Zend)

Tar-copy Docker (#2963) drops build/ between docker-exec invocations, so every backlog-architect run re-pays Zend on first link even when master logic supports compiled drivers.

Scope (implementation checklist)

1. script/bootstrap-resolve-compile-invoke.sh

  • Resolution order (document in header):

    1. build/bin-compile-aot-inventory if present and probe requests inventory argv
    2. build/bin-compile-aot if present
    3. build/selfhost-native-compile-driver / helloworld compile driver when M3 link env set
    4. Zend php bin/compile.php only when BOOTSTRAP_GEN0_ZEND_ONLY=1 or no artifact and BOOTSTRAP_ALLOW_GEN0_ZEND=1 (default 1 for empty tree)
  • Log line must say gen-0 compiled vs gen-0 Zend explicitly.

2. script/bootstrap-selfhost-link.sh + Makefile

  • Optional target dependency: bootstrap-selfhost-driver-smoke once per tree or document that first north-star5-verify / loop probe seeds drivers.
  • Do not require full M4 ladder for minimal link — only ensure bootstrap-ensure-inventory-argv-driver runs before spine if BOOTSTRAP_USE_INVENTORY_DRIVER=1.

3. script/docker-exec.sh tar-fallback (#2963)

  • Persist minimum driver set to host build/ between invocations:
    • bin-compile-aot-inventory
    • selfhost-helloworld-compile (or gen-0 seed script output)
  • Sync list in SYNC_BACK_PATHS auto-detection for bootstrap targets.

4. docs/bootstrap-generations.md

  • Table: gen-0 Zend (empty tree) → gen-1 after driver-smoke → gen-2 loop.

Not in scope: vendor cold boot (#3022); cli_driver LLVM (#3023).

Repro

docker info >/dev/null
rm -rf build/
./script/docker-exec.sh -- bash -lc 'make bootstrap-selfhost-link' 2>&1 | grep bootstrap-compile-invoke
# Today: gen-0 Zend

./script/docker-exec.sh -- bash -lc '
  make bootstrap-selfhost-driver-smoke >/dev/null
  make bootstrap-selfhost-link
' 2>&1 | grep bootstrap-compile-invoke
# Today: may use compiled driver inside same container; host build/ still empty on next docker-exec

Done when

  • Second docker-exec make bootstrap-selfhost-link on host with populated build/bin-compile-aot-inventory uses compiled driver (no Zend) without re-running driver-smoke.
  • Fresh empty build/ still works (Zend fallback documented).
  • Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492 M0 row no longer lists gen-0 Zend as routine path when drivers exist on host.

Labels

M5 bootstrap generations — compiler-adjacent script work tied to real driver artifacts, not CI-only polish.

Metadata

Metadata

Assignees

No one assigned

    Labels

    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions