Skip to content

M5: Prelink vendor (php-cfg, php-types, php-llvm) — no composer at cold boot #1416

@PurHur

Description

@PurHur

Problem

North Star 2 M5 requires no vendor/autoload.php at cold bootstrap while the compiler remains PHP (lib/ + ext/). Today Zend runs bin/compile.php; the self-host bundle uses PHP_COMPILER_SELFHOST_AOT stubs for compiler paths but still expects Composer vendor on disk for php-parser/php-cfg/php-llvm at link time.

Vendor PHP is not compiled from source inside the self-host binary today (see docs/bootstrap-selfhost.md non-goals).

Goal (M5 v1)

Prelink bootstrap vendor as native objects or bitcode (same pattern as lib/AOT/runtime/*.c):

Package Role
nikic/php-parser AST
ircmaxell/php-cfg CFG
ircmaxell/php-types Types
ircmaxell/php-llvm LLVM FFI
pre/plugin Parser plugin

Inventory: php script/bootstrap-vendor-inventory.phpdocs/bootstrap-vendor-inventory.md (~497 PHP files).

Deliverable: linked native compiler binary runs script/bootstrap-wave-check.sh without vendor/ tree on PATH.

Implementation hints

Piece Path Notes
Inventory script/bootstrap-vendor-inventory.php Already lists files; extend with blocker tags
Build Makefile target bootstrap-vendor-objects Emit build/bootstrap-vendor/*.o via AOT or clang from generated C
Link lib/AOT/Linker.php Link prelinked archive + compiler_minimal / full spine objects
CI BOOTSTRAP_VENDOR_PRELINK_GATE=01 in ci-local.sh tail Opt-in until green
Docs docs/bootstrap-m5-fast-path.md Cold-boot story for #1492

Prerequisites (do not skip)

Acceptance criteria

php script/bootstrap-vendor-inventory.php --check
make bootstrap-vendor-objects   # when target exists
# Cold boot probe (no vendor/):
BOOTSTRAP_VENDOR_PRELINK_GATE=1 ./script/bootstrap-wave-check.sh
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev make bootstrap-selfhost-probe
  • CI builds build/bootstrap-vendor/*.o (or .bc archive)
  • lib/AOT/Linker.php links prelinked vendor + generated compiler .o
  • Self-host probe runs without vendor/ on disk
  • Documented in docs/bootstrap-m5-fast-path.md

Non-goals

Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions