Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/bootstrap-selfhost.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

| Gate | Command | Status |
|------|---------|--------|
| Phase A inventory | `php script/bootstrap-inventory.php --check` | ✅ **586** files on `bin/vm.php` path; **0** source blockers (excluded paths: `lib/JIT/Builtin/StringPregMatch.php`; `lib/VM/HashTable.php` bundled via `ArrayIterator`) |
| Phase A inventory | `php script/bootstrap-inventory.php --check` | ✅ **586** files on `bin/vm.php` path; **0** source blockers (excluded paths: `lib/AOT/Linker.php`, `lib/JIT/Builtin/StringPregMatch.php`; `lib/VM/HashTable.php` bundled via `ArrayIterator`) |
| Phase B lib AOT lint | `php bin/compile.php -l lib/*.php` (with `script/php-env.sh`) | ✅ **14/14** top-level `lib/*.php` units ([#534](https://github.com/PurHur/php-compiler/pull/534)) |
| Phase B fixture lint | `php script/bootstrap-aot-lint.php` | ✅ **13** procedural targets under `test/bootstrap-aot/` + `examples/000-HelloWorld` |
| Phase C native run | `make bootstrap-aot-link` or `./script/bootstrap-aot-link.sh` | ✅ **71/71** link targets OK |
Expand All @@ -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` | ✅ **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 lint | `php bin/compile.php -l test/selfhost/compiler_lib_spine_smoke/main.php` | ✅ **567** units (`compiler_minimal` **109** + **459** M2 spine; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1419](https://github.com/PurHur/php-compiler/issues/1419), [#1497](https://github.com/PurHur/php-compiler/issues/1497)) |
| 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) |
Expand Down
10 changes: 5 additions & 5 deletions docs/pages/development-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ Indicative composite toward a **web-capable, self-hosting** compiler (not line-c

| Area | Progress | Summary |
|------|----------|---------|
| **Foundation** (CI, CLI, Docker) | ~88% | `phpc` CLI; **local/Docker CI is the merge gate** (`./script/ci-local.sh`, `make test-docker`) — [local-ci-matrix.md](https://github.com/PurHur/php-compiler/blob/master/docs/local-ci-matrix.md); GHA + CircleCI disabled ([#394](https://github.com/PurHur/php-compiler/issues/394), [#1338](https://github.com/PurHur/php-compiler/pull/1338), [#1340](https://github.com/PurHur/php-compiler/pull/1340)) |
| **Foundation** (CI, CLI, Docker) | ~88% | `phpc` CLI, local/Docker CI; GitHub Actions + CircleCI disabled ([#1338](https://github.com/PurHur/php-compiler/pull/1338), [#1340](https://github.com/PurHur/php-compiler/pull/1340)); contributor CI matrix doc in repo only |
| **Language** (OOP, types, CFG) | ~74% | VM/JIT OOP largely works; wave-3 language **10/13** on master; open: attributes ([#1354](https://github.com/PurHur/php-compiler/issues/1354)), readonly ([#1360](https://github.com/PurHur/php-compiler/issues/1360) / [#1473](https://github.com/PurHur/php-compiler/pull/1473)) |
| **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 **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) |
| **Self-host** (North Star 2, M0–M5) | ~97% | M0–M1 ✅; M2 spine **567/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.

Expand Down Expand Up @@ -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) | 🚧 **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)) |
| **M2 — Lib spine growth** | `compiler_lib_spine_smoke` bundle toward full `bin/vm.php` inventory (**586** files) | 🚧 **567** / 586 units (~97%; [#1056](https://github.com/PurHur/php-compiler/issues/1056), [#1497](https://github.com/PurHur/php-compiler/issues/1497)) |
| **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)) |
Expand All @@ -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) | **446** | vm.php-path lib/ + ext/standard growth bundle |
| `compiler_lib_spine_smoke` (M2) | **567** | 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`) |

Expand Down Expand Up @@ -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` (**446** units) |
| M2 spine native link | `BOOTSTRAP_LIB_SPINE_SMOKE=1 make bootstrap-selfhost-lib-spine-smoke` | ✅ `compiler_lib_spine_smoke bundle OK` (**567** 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 |
Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap-wave3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:** **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).
**M2 spine:** **567** / **586** inventory (`compiler_lib_spine_smoke` native link ✅; [#1056](https://github.com/PurHur/php-compiler/issues/1056), M2 batches [#1419](https://github.com/PurHur/php-compiler/issues/1419), [#1497](https://github.com/PurHur/php-compiler/issues/1497)). Target doc: [self-host-target.md](self-host-target.md).

## Language (#1354–#1366)

Expand Down
10 changes: 5 additions & 5 deletions docs/self-host-target.md
Original file line number Diff line number Diff line change
Expand Up @@ -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** | **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%** |
| **Bundle size** | **567** curated `require_once` in spine smoke (108 minimal overlap + **459** M2-only) | **586** inventory files |
| **Inventory coverage** | **~97%** of vm.php path in spine smoke (**567/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 |
Expand All @@ -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 | 🚧 **446/586** units | **~76%** |
| **M2** | Spine grows toward full `bin/vm.php` inventory | 🚧 **567/586** units | **~97%** |
| **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% |
Expand All @@ -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 | **446 / 586 ≈ 76%** |
| **M2 spine progress** | `require_once` units in `compiler_lib_spine_smoke` ÷ Phase A inventory file count | **567 / 586 ≈ 97%** |
| **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%** |

Expand Down Expand Up @@ -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` | **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_lib_spine_smoke/main.php` | **567** | M2 growth (ext/standard + Vm* spine batch) |
| `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)) |

Expand Down
3 changes: 2 additions & 1 deletion ext/standard/JitChdir.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
/** LLVM lowering for chdir() via libc chdir(2). */
final class JitChdir
{
/** @return Value i1 — true when chdir(2) returns 0 */
/** @return Value
* true when chdir(2) returns 0 */
public static function invoke(Context $context, Value $pathStr): Value
{
$map = $context->structFieldMap['__string__'];
Expand Down
3 changes: 2 additions & 1 deletion ext/standard/JitChmod.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
/** LLVM lowering for chmod() via libc chmod(2). */
final class JitChmod
{
/** @return Value i1 — true when chmod(2) returns 0 */
/** @return Value
* true when chmod(2) returns 0 */
public static function invoke(Context $context, Value $pathStr, Value $modeI32): Value
{
$map = $context->structFieldMap['__string__'];
Expand Down
3 changes: 2 additions & 1 deletion ext/standard/JitCopy.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
/** LLVM lowering for copy() via __compiler_copy (native fread/fwrite). */
final class JitCopy
{
/** @return Value i1 — true when __compiler_copy returns 1 */
/** @return Value
* true when __compiler_copy returns 1 */
public static function invoke(Context $context, Value $fromStr, Value $toStr): Value
{
$i32 = $context->getTypeFromString('int32');
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/JitDeployPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/** LLVM lowering for phpc_deploy_path() via {@see \PHPCompiler\JIT\Builtin\StringDeployPath}. */
final class JitDeployPath
{
/** @return Value __string__* */
/** @return Value */
public static function invoke(Context $context, Value $rel, Value $fallback): Value
{
return $context->builder->call(
Expand Down
Loading