Skip to content

Self-host M3: native compile unit probe on lib/Parser.php slice #2409

Description

@PurHur

Problem

M3 unit probes today cover Compiler (#2216), JIT (#2332 ✅ script), and VM (#2354 ✅ script) — but not the CFG parse front-end (PHPCfg\Parser via lib/Compiler.php → vendor ircmaxell/php-cfg). Contributors cannot tell whether native link failures are in emit/lowering vs parseStmt/parseExpr paths that block self-host on real PHP 8 syntax.

There is no test/selfhost/parser_unit_probe/ tree or bootstrap-selfhost-parser-unit-probe.sh yet (title references CFG Parser slice, not a lib/Parser.php file).

Goal

  1. test/selfhost/parser_unit_probe/main.php — smallest honest require_once chain that loads lib/Compiler.php and exercises a fixed parse-only or compile-to-CFG path on a tiny fixture (no full spine).
  2. script/bootstrap-selfhost-parser-unit-probe.sh — native AOT link + run printing parser_unit_probe bundle OK (mirror Self-host M3: native compile-driver unit probe on lib/JIT.php slice #2332 / Self-host M3: native compile unit probe on lib/VM.php slice #2354).
  3. Document in docs/bootstrap-selfhost.md M3 probes table + make bootstrap-selfhost-parser-unit-probe.
  4. Follow-ups: CI gate (new issue after this lands), north-star3-verify step 5, default-on flip.

Implementation hints

Piece Path Notes
Probe tree test/selfhost/parser_unit_probe/main.php Start from compiler_minimal-scale deps; add lib/Compiler.php + lint helpers only
Vendor CFG vendor/ircmaxell/php-cfg/lib/PHPCfg/Parser.php Patched via script/apply-patches.sh — probe must run after patches
Emit driver Reuse php bin/compile.php -l / bootstrap-selfhost-compile-smoke-probe.sh env PHP_COMPILER_SELFHOST_AOT=1, BOOTSTRAP_M3_COMPILE_DRIVER_REAL_LOWERING=1 when strict
Allowlist lib/JIT.php isM3CompileDriverRealLoweringName() Expand per #1768 — do not duplicate batch tracker
Makefile Makefile bootstrap-selfhost-parser-unit-probe target
Test test/unit/BootstrapParserUnitProbeTest.php Assert script + expected stdout substring

Suggested slice (first PR)

Unblock order

#1768 honest lowering batches → #1937 strict emit → #2216 compiler probe → this probe → #1520 stub retirement

Acceptance criteria

./script/bootstrap-selfhost-parser-unit-probe.sh
php bin/compile.php -l test/selfhost/parser_unit_probe/main.php

Harness (Runforge — do not use raw bind-mount docker run):

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./script/bootstrap-selfhost-parser-unit-probe.sh'
  • Native binary prints parser_unit_probe bundle OK
  • Skip message when LLVM 9 missing (same as other bootstrap probes)
  • No .github/workflows/* changes

Dependencies

Links

No activity

Activity on this issue will appear here.

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