diff --git a/README.md b/README.md index 0687c2d03e7..c879aa1d653 100755 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Matrix details: [docs/local-ci-matrix.md](docs/local-ci-matrix.md). |-----------|----------------|--------| | **M0 — Bundled subset runs** | ~**109** literal `require_once` units in `test/selfhost/compiler_minimal/main.php` compile+link under AOT; native binary prints `compiler_minimal bundle OK` | ✅ ([#557](https://github.com/PurHur/php-compiler/issues/557), [#913](https://github.com/PurHur/php-compiler/issues/913)) | | **M1 — Compiler-shaped bundle** | Same bundle **lints** as one translation unit; **compile-smoke** links a tiny fixture and runs AOT echo (`compiler smoke`); driver smoke bundles `bin/compile.php`-adjacent units | ✅ ([#1025](https://github.com/PurHur/php-compiler/issues/1025)) | -| **M2 — Full top-level `lib/` + spine** | All **14** top-level `lib/*.php` lint ✅; **`compiler_lib_spine_smoke`** (**445** / **586** inventory units) native link ✅; grow toward full `bin/vm.php` path | 🚧 ~76% of inventory | +| **M2 — Full top-level `lib/` + spine** | All **14** top-level `lib/*.php` lint ✅; **`compiler_lib_spine_smoke`** (**446** / **586** inventory units) native link ✅; grow toward full `bin/vm.php` path | 🚧 ~76% of inventory | | **M3 — Native compiles PHP** | Self-host bundle links; HelloWorld AOT **runs** natively; **compile emit still Zend fallback** | 🚧 partial | | **M4 — Bootstrap loop** | Native toolchain rebuilds the **next** compiler sources | ⬜ | | **M5 — Full self-host** | Real `bin/vm.php` / `bin/compile.php` on full inventory; **no Zend bootstrap** | ⬜ **north star** ([#1056](https://github.com/PurHur/php-compiler/issues/1056)) | diff --git a/docs/bootstrap-selfhost.md b/docs/bootstrap-selfhost.md index 303caf02d8a..f7bc905c5b0 100644 --- a/docs/bootstrap-selfhost.md +++ b/docs/bootstrap-selfhost.md @@ -20,7 +20,7 @@ | Self-host probe in full CI | `./script/ci-local.sh` (LLVM tail) | ✅ default-on when LLVM 9 present; `BOOTSTRAP_SELFHOST_PROBE_GATE=0` to skip ([#829](https://github.com/PurHur/php-compiler/issues/829)) | | Wave gate in full CI | `./script/ci-local.sh` (LLVM tail) | ✅ default-on when LLVM 9 present; `BOOTSTRAP_WAVE_CHECK=0` to skip; `./script/bootstrap-wave-check.sh --fail-fast` | | Self-host native link | `./script/bootstrap-selfhost-link.sh` | ✅ `build/selfhost` prints `compiler_minimal bundle OK` ([#557](https://github.com/PurHur/php-compiler/issues/557), [#913](https://github.com/PurHur/php-compiler/issues/913)) | -| M2 lib spine smoke lint | `php bin/compile.php -l test/selfhost/compiler_lib_spine_smoke/main.php` | ✅ **445** units (`compiler_minimal` **109** + **337** M2 spine; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1741](https://github.com/PurHur/php-compiler/issues/1741), [#1725](https://github.com/PurHur/php-compiler/issues/1725), [#1701](https://github.com/PurHur/php-compiler/issues/1701), [#1731](https://github.com/PurHur/php-compiler/issues/1731), [#1734](https://github.com/PurHur/php-compiler/issues/1734), [#1686](https://github.com/PurHur/php-compiler/issues/1686), [#1728](https://github.com/PurHur/php-compiler/issues/1728)) | +| M2 lib spine smoke lint | `php bin/compile.php -l test/selfhost/compiler_lib_spine_smoke/main.php` | ✅ **446** units (`compiler_minimal` **109** + **338** M2 spine; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1741](https://github.com/PurHur/php-compiler/issues/1741), [#1725](https://github.com/PurHur/php-compiler/issues/1725), [#1726](https://github.com/PurHur/php-compiler/issues/1726), [#1701](https://github.com/PurHur/php-compiler/issues/1701), [#1731](https://github.com/PurHur/php-compiler/issues/1731), [#1734](https://github.com/PurHur/php-compiler/issues/1734), [#1686](https://github.com/PurHur/php-compiler/issues/1686), [#1728](https://github.com/PurHur/php-compiler/issues/1728)) | | M2 lib spine smoke native run | `./script/bootstrap-selfhost-lib-spine-smoke-link.sh` or `BOOTSTRAP_LIB_SPINE_SMOKE=1 make bootstrap-selfhost-lib-spine-smoke` | ✅ `build/selfhost-lib-spine-smoke` prints `compiler_lib_spine_smoke bundle OK` | | M3 HelloWorld self-host probe lint | `php bin/compile.php -l test/selfhost/compiler_helloworld_smoke/main.php` | ✅ `compiler_compile_smoke` spine + `helloworld_compile_smoke` driver (linkable) | | M3 HelloWorld compile driver lint | `php bin/compile.php -l test/selfhost/compiler_helloworld_smoke/compile_driver.php` | ✅ `Runtime::parseAndCompile` + mode-file dispatch (native link opt-in) | diff --git a/docs/pages/development-status.md b/docs/pages/development-status.md index 587f1d9f06f..37241b439bd 100644 --- a/docs/pages/development-status.md +++ b/docs/pages/development-status.md @@ -51,7 +51,7 @@ Indicative composite toward a **web-capable, self-hosting** compiler (not line-c | **Stdlib** | ~58% | Wave-3 batch ([#1367](https://github.com/PurHur/php-compiler/issues/1367)–[#1379](https://github.com/PurHur/php-compiler/issues/1379)): 12/13 closed; `debug_backtrace` ([#1378](https://github.com/PurHur/php-compiler/issues/1378)) in [#1404](https://github.com/PurHur/php-compiler/pull/1404) | | **Web AOT** (build, deploy) | ~65% | Project link ✅; home-route execute ✅; PATH_INFO / layout chain 🚧 | | **Reference app** (MiniWebApp) | ~55% | VM ✅; AOT link ✅; AOT execute **partial** | -| **Self-host** (North Star 2, M0–M5) | ~76% | M0–M1 ✅; M2 spine **445/586**; M3 partial (native run ✅, Zend emit); M4–M5 ⬜ — [self-host-target.md](https://github.com/PurHur/php-compiler/blob/master/docs/self-host-target.md) | +| **Self-host** (North Star 2, M0–M5) | ~76% | M0–M1 ✅; M2 spine **446/586**; M3 partial (native run ✅, Zend emit); M4–M5 ⬜ — [self-host-target.md](https://github.com/PurHur/php-compiler/blob/master/docs/self-host-target.md) | **Overall (indicative): ~52%** toward the stated north stars below. @@ -200,7 +200,7 @@ Zend PHP still runs `bin/compile.php` during bootstrap. The output is a **curate |-----------|---------|--------| | **M0 — Bundled subset runs** | ~109 literal `require_once` units in `test/selfhost/compiler_minimal/main.php` → `build/selfhost` prints `compiler_minimal bundle OK` | ✅ [#557](https://github.com/PurHur/php-compiler/issues/557), [#913](https://github.com/PurHur/php-compiler/issues/913) | | **M1 — Compiler-shaped bundle** | Bundled `Compiler.php` AOT lint; compile-smoke native link + AOT echo (`compiler smoke`); driver smoke toward `bin/compile.php` | ✅ [#1025](https://github.com/PurHur/php-compiler/issues/1025), [#1095](https://github.com/PurHur/php-compiler/issues/1095) | -| **M2 — Lib spine growth** | `compiler_lib_spine_smoke` bundle toward full `bin/vm.php` inventory (**586** files) | 🚧 **445** / 586 units (~76%; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1741](https://github.com/PurHur/php-compiler/issues/1741), [#1725](https://github.com/PurHur/php-compiler/issues/1725), [#1701](https://github.com/PurHur/php-compiler/issues/1701), [#1731](https://github.com/PurHur/php-compiler/issues/1731), [#1734](https://github.com/PurHur/php-compiler/issues/1734), [#1686](https://github.com/PurHur/php-compiler/issues/1686), [#1728](https://github.com/PurHur/php-compiler/issues/1728)) | +| **M2 — Lib spine growth** | `compiler_lib_spine_smoke` bundle toward full `bin/vm.php` inventory (**586** files) | 🚧 **446** / 586 units (~76%; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1741](https://github.com/PurHur/php-compiler/issues/1741), [#1725](https://github.com/PurHur/php-compiler/issues/1725), [#1726](https://github.com/PurHur/php-compiler/issues/1726), [#1701](https://github.com/PurHur/php-compiler/issues/1701), [#1731](https://github.com/PurHur/php-compiler/issues/1731), [#1734](https://github.com/PurHur/php-compiler/issues/1734), [#1686](https://github.com/PurHur/php-compiler/issues/1686), [#1728](https://github.com/PurHur/php-compiler/issues/1728)) | | **M3 — Native compiles PHP** | Self-hosted bundle links; HelloWorld AOT **runs** natively; **emit still uses Zend** `bin/compile.php` fallback | 🚧 partial ([#1056](https://github.com/PurHur/php-compiler/issues/1056)) | | **M4 — Bootstrap loop** | Native toolchain rebuilds the **next** compiler sources (same tree, new revision) | ⬜ | | **M5 — Full self-host** | Real `bin/vm.php` / `bin/compile.php` path on full inventory; **no Zend bootstrap** | ⬜ **north star** ([#1056](https://github.com/PurHur/php-compiler/issues/1056)) | @@ -210,7 +210,7 @@ Zend PHP still runs `bin/compile.php` during bootstrap. The output is a **curate | Set | ~Files | Notes | |-----|--------|-------| | `compiler_minimal` bundle (M0) | **109** | Literal `require_once` closure | -| `compiler_lib_spine_smoke` (M2) | **445** | vm.php-path lib/ + ext/standard growth bundle | +| `compiler_lib_spine_smoke` (M2) | **446** | vm.php-path lib/ + ext/standard growth bundle | | Top-level `lib/*.php` | **14** | Per-file AOT lint ✅ | | Full vm.php inventory | **586** | Phase A inventory (`php script/bootstrap-inventory.php`) | @@ -245,7 +245,7 @@ Details: [self-host-target.md](https://github.com/PurHur/php-compiler/blob/maste | Native link + run | `./script/bootstrap-selfhost-link.sh` | ✅ M0 | | Compile smoke link | `make bootstrap-selfhost-compile-smoke` | ✅ M1 | | Compile smoke AOT echo | `make bootstrap-selfhost-compile-smoke-run` | ✅ M1 | -| M2 spine native link | `BOOTSTRAP_LIB_SPINE_SMOKE=1 make bootstrap-selfhost-lib-spine-smoke` | ✅ `compiler_lib_spine_smoke bundle OK` (**445** units) | +| M2 spine native link | `BOOTSTRAP_LIB_SPINE_SMOKE=1 make bootstrap-selfhost-lib-spine-smoke` | ✅ `compiler_lib_spine_smoke bundle OK` (**446** units) | | M3 HelloWorld probe | `make bootstrap-selfhost-helloworld` | 🚧 partial — native **run** ✅; emit Zend fallback | | Wave gate | `./script/bootstrap-wave-check.sh` | ✅ locally / Docker; GHA workflow disabled | | Next includes probe | `php script/bootstrap-selfhost-next-includes.php` | 🚧 bundle growth | diff --git a/docs/roadmap-wave3.md b/docs/roadmap-wave3.md index c1bde76f006..148359462bc 100644 --- a/docs/roadmap-wave3.md +++ b/docs/roadmap-wave3.md @@ -17,7 +17,7 @@ Regenerate capability truth: `php script/capability-matrix.php`, `php script/cap Related merges outside this wave: `goto` ([#1228](https://github.com/PurHur/php-compiler/issues/1228) / [#1333](https://github.com/PurHur/php-compiler/pull/1333)), anonymous classes ([#1233](https://github.com/PurHur/php-compiler/issues/1233) / [#1386](https://github.com/PurHur/php-compiler/pull/1386)). -**M2 spine:** **445** / **586** inventory (`compiler_lib_spine_smoke` native link ✅; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1741](https://github.com/PurHur/php-compiler/issues/1741), [#1725](https://github.com/PurHur/php-compiler/issues/1725), [#1701](https://github.com/PurHur/php-compiler/issues/1701), [#1731](https://github.com/PurHur/php-compiler/issues/1731), [#1734](https://github.com/PurHur/php-compiler/issues/1734), [#1686](https://github.com/PurHur/php-compiler/issues/1686), [#1728](https://github.com/PurHur/php-compiler/issues/1728)). Target doc: [self-host-target.md](self-host-target.md). +**M2 spine:** **446** / **586** inventory (`compiler_lib_spine_smoke` native link ✅; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1741](https://github.com/PurHur/php-compiler/issues/1741), [#1725](https://github.com/PurHur/php-compiler/issues/1725), [#1726](https://github.com/PurHur/php-compiler/issues/1726), [#1701](https://github.com/PurHur/php-compiler/issues/1701), [#1731](https://github.com/PurHur/php-compiler/issues/1731), [#1734](https://github.com/PurHur/php-compiler/issues/1734), [#1686](https://github.com/PurHur/php-compiler/issues/1686), [#1728](https://github.com/PurHur/php-compiler/issues/1728)). Target doc: [self-host-target.md](self-host-target.md). ## Language (#1354–#1366) diff --git a/docs/self-host-target.md b/docs/self-host-target.md index 1972d8f0ae0..8c0bcf11f03 100644 --- a/docs/self-host-target.md +++ b/docs/self-host-target.md @@ -34,8 +34,8 @@ That is **M5**. Everything below is the honest path from today’s bootstrap to | Layer | Today | Target | |-------|-------|--------| | **Bootstrap driver** | Zend runs `php bin/compile.php` | Compiled `bin/compile.php` | -| **Bundle size** | **445** curated `require_once` in spine smoke (108 minimal overlap + **337** M2-only) | **586** inventory files | -| **Inventory coverage** | **~76%** of vm.php path in spine smoke (**445/586**) | **100%** | +| **Bundle size** | **446** curated `require_once` in spine smoke (108 minimal overlap + **338** M2-only) | **586** inventory files | +| **Inventory coverage** | **~76%** of vm.php path in spine smoke (**446/586**) | **100%** | | **HelloWorld** | Native **run** ✅; **emit** still Zend fallback | Native compile + emit | | **Bootstrap loop (M4)** | Gen-1 link + gen-2 Zend partial | Native gen-2 emit + full tree rebuild | | **Vendor** | `composer install` + patches on host | Prelinked artifacts only | @@ -61,7 +61,7 @@ That is **M5**. Everything below is the honest path from today’s bootstrap to |-----------|----------------|--------|-----| | **M0** | AOT can link a **small** honest `lib/` subset | ✅ | 100% | | **M1** | Bundle is **compiler-shaped** (lint + compile-smoke) | ✅ | 100% | -| **M2** | Spine grows toward full `bin/vm.php` inventory | 🚧 **445/586** units | **~76%** | +| **M2** | Spine grows toward full `bin/vm.php` inventory | 🚧 **446/586** units | **~76%** | | **M3** | Self-host binary **compiles external PHP** (HelloWorld) without Zend emit | 🚧 partial | **~45%** | | **M4** | Self-host binary **rebuilds** the next compiler tree | ⬜ | 0% | | **M5** | Full self-host; Zend retired from loop | ⬜ north star | 0% | @@ -72,7 +72,7 @@ That is **M5**. Everything below is the honest path from today’s bootstrap to | Indicator | Formula | May 2026 | |-----------|---------|----------| -| **M2 spine progress** | `require_once` units in `compiler_lib_spine_smoke` ÷ Phase A inventory file count | **445 / 586 ≈ 76%** | +| **M2 spine progress** | `require_once` units in `compiler_lib_spine_smoke` ÷ Phase A inventory file count | **446 / 586 ≈ 76%** | | **Public “Self-host” row** | Same M2 ratio until M3–M5 gates add weight ([`development-status.md`](pages/development-status.md)) | **~61%** | | **Composite (internal)** | Milestone weights in table above (M0–M1 = 100%, M2 = spine %, M3–M5 = gate %) | **~54%** | @@ -124,7 +124,7 @@ Parallel batches ([#1419](https://github.com/PurHur/php-compiler/issues/1419), [ | Entry | Units | Role | |-------|------:|------| | `test/selfhost/compiler_minimal/main.php` | **109** | M0 core | -| `test/selfhost/compiler_lib_spine_smoke/main.php` | **445** | M2 growth ([#1741](https://github.com/PurHur/php-compiler/issues/1741) Linker, [#1725](https://github.com/PurHur/php-compiler/issues/1725) tempnam, [#1701](https://github.com/PurHur/php-compiler/issues/1701) stream_context_create, [#1731](https://github.com/PurHur/php-compiler/issues/1731) unlink, [#1734](https://github.com/PurHur/php-compiler/issues/1734) usort_, [#1686](https://github.com/PurHur/php-compiler/issues/1686) sqrt, [#1728](https://github.com/PurHur/php-compiler/issues/1728) uasort_) | +| `test/selfhost/compiler_lib_spine_smoke/main.php` | **446** | M2 growth ([#1741](https://github.com/PurHur/php-compiler/issues/1741) Linker, [#1725](https://github.com/PurHur/php-compiler/issues/1725) tempnam, [#1726](https://github.com/PurHur/php-compiler/issues/1726) touch_, [#1701](https://github.com/PurHur/php-compiler/issues/1701) stream_context_create, [#1731](https://github.com/PurHur/php-compiler/issues/1731) unlink, [#1734](https://github.com/PurHur/php-compiler/issues/1734) usort_, [#1686](https://github.com/PurHur/php-compiler/issues/1686) sqrt, [#1728](https://github.com/PurHur/php-compiler/issues/1728) uasort_) | | `test/selfhost/compiler_helloworld_smoke/` | — | M3 probe + compile driver | | `test/selfhost/bootstrap_loop_smoke/` | — | M4 scaffold (gen-1→gen-2 loop probe; [#1498](https://github.com/PurHur/php-compiler/issues/1498)) | diff --git a/test/selfhost/compiler_lib_spine_smoke/main.php b/test/selfhost/compiler_lib_spine_smoke/main.php index be553a56b4e..2808ce85827 100644 --- a/test/selfhost/compiler_lib_spine_smoke/main.php +++ b/test/selfhost/compiler_lib_spine_smoke/main.php @@ -434,6 +434,7 @@ require_once __DIR__.'/../../../ext/standard/substr_count.php'; require_once __DIR__.'/../../../ext/standard/sys_get_temp_dir.php'; require_once __DIR__.'/../../../ext/standard/tempnam.php'; +require_once __DIR__.'/../../../ext/standard/touch_.php'; require_once __DIR__.'/../../../ext/standard/trigger_error_.php'; require_once __DIR__.'/../../../ext/standard/uasort_.php'; require_once __DIR__.'/../../../ext/standard/ucfirst.php'; diff --git a/test/unit/BootstrapSelfhostBundleTest.php b/test/unit/BootstrapSelfhostBundleTest.php index 02b622c5991..9b347b17f76 100644 --- a/test/unit/BootstrapSelfhostBundleTest.php +++ b/test/unit/BootstrapSelfhostBundleTest.php @@ -308,6 +308,7 @@ final class BootstrapSelfhostBundleTest extends TestCase 'ext/standard/string_trim.php', 'ext/standard/strip_tags.php', 'ext/standard/tempnam.php', + 'ext/standard/touch_.php', 'ext/standard/stripos.php', 'ext/standard/stristr.php', 'ext/standard/strncasecmp.php', @@ -361,7 +362,7 @@ public function testCompilerLibSpineSmokeBundleUnitCountAndKeyUnits(): void $this->assertFileExists($entry); $contents = (string) file_get_contents($entry); $count = substr_count($contents, 'require_once __DIR__'); - $this->assertSame(445, $count, '108 compiler_minimal units + 337 M2 spine units (#1741 Linker, #1725 tempnam, #1701 stream_context_create, #1731 unlink, #1734 usort_, #1686 sqrt, #1728 uasort_); array_pop/shift/search + preg/array_combine wrappers skipped (AOT types); src/cli.php deferred #1467'); + $this->assertSame(446, $count, '108 compiler_minimal units + 338 M2 spine units (#1741 Linker, #1725 tempnam, #1726 touch_, #1701 stream_context_create, #1731 unlink, #1734 usort_, #1686 sqrt, #1728 uasort_); array_pop/shift/search + preg/array_combine wrappers skipped (AOT types); src/cli.php deferred #1467'); foreach (self::LIB_SPINE_SMOKE_NEW_UNITS as $unit) { $this->assertStringContainsString( "require_once __DIR__.'/../../../{$unit}';",