Skip to content

M5: Bootstrap driver — run compiled bin/compile.php instead of Zend php #1521

Description

@PurHur

Milestone

M5 — compiled bootstrap driver replaces Zend loop (parent #1492)

Problem

Every bootstrap gate still invokes php bin/compile.php for link/emit. M3 strict and M4 loop slice are green on harness 2026-05-27 (emit_path=native), but the production driver is not yet emitted by gen-1:

Target Native emit via ./script/bootstrap-selfhost-helloworld-compile-bin.sh Notes
examples/000-HelloWorld/example.php ✅ M3 strict
lib/Compiler.php ✅ M3 sidecar fast path
bin/compile.php ❌ #2697 — link-time sidecar segfault
bin/vm.php, src/cli_driver.php ❌ #2699

Scope

Path Work
bin/compile.php Gen-0 output target; gen-1 must compile next revision
test/selfhost/compiler_helloworld_smoke/compile_driver.php Native compile dispatch (PHP_COMPILER_M3_RUNTIME_COMPILE=1)
script/bootstrap-selfhost-helloworld-compile-bin.sh M5 repro script (exists; extend for driver matrix)
script/bootstrap-selfhost-link.sh Gen-0 Zend link (stays until cold boot #1416)
Bootstrap scripts Replace php bin/compile.php invocations with build/selfhost-compile-driver when green
lib/JIT.php, lib/Cli/ Driver hot path lowering (#2697)

Repro (today)

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

# M5 blocker — driver emit:
./script/docker-exec.sh -- bash -lc '
  export PHP_COMPILER_M3_SOURCE=/compiler/bin/compile.php
  export PHP_COMPILER_M3_OUT=/compiler/build/compile-php-aot
  ./script/bootstrap-selfhost-helloworld-compile-bin.sh
'
# helloworld_compile_smoke: parseAndCompile returned null — see #2697

Done when

  • Documented two-stage bootstrap: (1) Zend gen-0 link, (2) gen-0+ native-emits bin/compile.php → gen-1 driver
  • make bootstrap-selfhost-driver-smoke (or equivalent) uses compiled driver for a tiny fixture — no php bin/compile.php on emit step
  • docs/bootstrap-selfhost.md row “Bootstrap driver” = compiled path ✅
  • Opt-in BOOTSTRAP_M5_DRIVER_GATE=1 in ci-local.sh llvm tail; default-on follow-up after stable
  • Unblocks retiring Zend from routine bootstrap (M5: Prelink vendor (php-cfg, php-types, php-llvm) — no composer at cold boot #1416 cold boot is separate)

Unblock order

#2697 bin/compile.php sidecar/AOT segfault
  → #2699 bin/vm.php + src/cli_driver.php
  → this issue (#1521) swap bootstrap scripts to compiled driver
  → #1416 vendor prelink (no composer at cold boot)

Links

#1492 · #2600 · #2697 · #2699 · #1416 · #1520 (stub retirement)

Activity

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