Skip to content

Self-host M4: full revision rebuild — native argv bin/compile.php compiles compiler tree #2880

@PurHur

Description

@PurHur

Milestone

M4 (bootstrap loop) — parent #1492 / closed scaffold #1498

Problem

M4 ladder slices are green on harness 2026-05-28:

  • make bootstrap-loop-probe → gen-1→gen-2 native + gen-2→gen-3 spine, exit 0
  • ./script/bootstrap-loop-gen1-full-spine-emit.shemit_path=native for 725-unit spine bundle

Remaining M4 gap in docs/self-host-target.md: full revision / argv CLI — a gen-2+ binary must compile the compiler product (e.g. bin/compile.php with real $argv) to produce the next native driver, not only pre-bundled test/selfhost/* entrypoints.

Today build/bin-compile-aot is produced by bootstrap-selfhost-driver-smoke.sh (stages 3–4) but is not on the default make bootstrap-loop-probe path; ad-hoc argv dispatch is undocumented/unprobed.

Scope

Path Work
lib/Cli/ or src/cli_driver.php Native $argv bridge for bin/compile.php -o out entry.php on compiled driver
script/bootstrap-selfhost-driver-smoke.sh Already builds build/bin-compile-aot — extend or add revision probe
script/bootstrap-loop-probe.sh Optional gate: gen-2 bin-compile-aot recompiles bin/compile.php → gen-3 driver
lib/Runtime.php, lib/Compiler.php Lowering for full driver CFG (beyond bundle smoke)
docs/bootstrap-generations.md Document gen-N full-revision artifact names

Repro

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

# Target (define exact script/env in PR):
./script/docker-exec.sh -- bash -lc '
  BOOTSTRAP_M5_DRIVER_SMOKE=1 make bootstrap-selfhost-driver-smoke
  test -x build/bin-compile-aot
  build/bin-compile-aot -o build/gen3-bin-compile bin/compile.php
  # emit_path=native; gen-3 driver runs without Zend on compile step
'

Done when

  • Documented make/script target proves gen-2 build/bin-compile-aot (or successor) native-compiles bin/compile.php → runnable gen-3 compile driver
  • docs/self-host-target.md M4 row full revision / argv CLI → ✅
  • No Zend on the compile step of that probe (link-only Zend gen-0 acceptable once per tree)

Labels

self-host, bootstrap, IMPORTANT

Links

#1492 · #1498 ✅ · #1521 · #2794 · #1937

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