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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

> **Stable line (2026)** — First maintained **stable** release **[v1.0.0](https://github.com/PurHur/php-compiler/releases/tag/v1.0.0)**; **v1.1.0** prep adds M5 fast-path stability, enum/property-hook parity, `preg_match` JIT, `spl_autoload*`, and php-in-PHP JIT helpers. Demo-ready VM + AOT for a **web-capable PHP subset**, reference examples **000–009**, and an experimental **self-host** path. Not full Zend PHP compatibility — see [what’s missing](https://purhur.github.io/php-compiler/docs/pages/missing-implementation.html).

**Snapshot (Jul 2026, `master` — v1.1.0 prep):** VM + AOT for shipped examples ✅ · examples web smoke ✅ · self-host spine **5290** / **5290** · **852** builtins · M5 fast + strict ✅ · VM probe ~**20ms**
**Snapshot (Jul 2026, `master` — v1.1.0 prep):** VM + AOT for shipped examples ✅ · examples web smoke ✅ · self-host spine **5295** / **5295** · **852** builtins · M5 fast + strict ✅ · VM probe ~**20ms**

---

Expand All @@ -23,7 +23,7 @@
| **AOT (`phpc build`)** | ✅ For curated subset | Standalone binaries for examples **000–009** and small CGI apps; not arbitrary Composer stacks |
| **JIT (`bin/jit.php`)** | 🚧 Partial | LLVM IR for many constructs; **MCJIT execute** still flaky ([#98](https://github.com/PurHur/php-compiler/issues/98)); EH scripts VM-fallback ([#2114](https://github.com/PurHur/php-compiler/issues/2114)) |
| **Language wave 3** | ✅ Closed batch | **12/12** language + **13/13** stdlib tracker items ([#1380](https://github.com/PurHur/php-compiler/issues/1380)); closures, try/catch, generators (VM), `parent::class`, backed enums (VM), intersection AOT checks |
| **Self-host north star** | ✅ ~90% | M5 fast gate green; spine **5290** / **5290**; vendor prelink **3/3** ([#1492](https://github.com/PurHur/php-compiler/issues/1492)) |
| **Self-host north star** | ✅ ~90% | M5 fast gate green; spine **5295** / **5295**; vendor prelink **3/3** ([#1492](https://github.com/PurHur/php-compiler/issues/1492)) |

### What you can rely on today

Expand All @@ -40,7 +40,7 @@ Counts from `php script/bootstrap-spine-count.php` (literal `require_once` in `c
| Milestone | Status | What it means |
|-----------|--------|----------------|
| **M0–M1** | ✅ | `compiler_minimal` + compile-smoke bundles link and run natively |
| **M2** | ✅ **5290** / **5290** | Full Phase A inventory in spine smoke; native link + lint ✅ |
| **M2** | ✅ **5295** / **5295** | Full Phase A inventory in spine smoke; native link + lint ✅ |
| **M3** | ✅ | HelloWorld strict native ✅; inventory argv `bin/compile.php` ✅ |
| **M4** | ✅ | `make bootstrap-loop-probe` full ladder ✅ (gen-1→gen-2→gen-3 + full-revision) |
| **M5** | ✅ | `make north-star5-verify-fast` (daily); `--strict` pre-merge ✅; vendor **3/3** ✅; gen-0 sidecars refreshed |
Expand Down Expand Up @@ -259,7 +259,7 @@ Full matrices (auto-generated): [`docs/capabilities.md`](docs/capabilities.md) (

**Self-host (experimental, not “stable app” scope)**

See [Current implementation status](#current-implementation-status-june-2026) for the full M0–M5 ladder. Summary: M0–M5 bootstrap gates ✅; spine **5290** / **5290**; M3 strict native + inventory argv ✅; M4 full `bootstrap-loop-probe` ✅; M5 **`north-star5-verify-fast`** (daily) + **`--strict`** pre-merge ✅ ([#1492](https://github.com/PurHur/php-compiler/issues/1492), [#8559](https://github.com/PurHur/php-compiler/issues/8559)). Recent: native spine bundle probe, fast VM execute smoke ([#2201](https://github.com/PurHur/php-compiler/issues/2201)), `GeneratorYieldSourceMarker` spine unit ([#10356](https://github.com/PurHur/php-compiler/pull/10356)).
See [Current implementation status](#current-implementation-status-june-2026) for the full M0–M5 ladder. Summary: M0–M5 bootstrap gates ✅; spine **5295** / **5295**; M3 strict native + inventory argv ✅; M4 full `bootstrap-loop-probe` ✅; M5 **`north-star5-verify-fast`** (daily) + **`--strict`** pre-merge ✅ ([#1492](https://github.com/PurHur/php-compiler/issues/1492), [#8559](https://github.com/PurHur/php-compiler/issues/8559)). Recent: native spine bundle probe, fast VM execute smoke ([#2201](https://github.com/PurHur/php-compiler/issues/2201)), `GeneratorYieldSourceMarker` spine unit ([#10356](https://github.com/PurHur/php-compiler/pull/10356)).

**What we do not target in v1.x**

Expand Down
77 changes: 61 additions & 16 deletions docs/bootstrap-inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Regenerate: `php script/bootstrap-inventory.php`

| Metric | Count |
|--------|------:|
| PHP files on vm.php path | 5290 |
| Phase A inventory files (M2 ratio SSOT) | 5290 |
| PHP files on vm.php path | 5295 |
| Phase A inventory files (M2 ratio SSOT) | 5295 |
| Phase A ratio-deferred paths | 0 |
| Source constructs flagged (blockers) | 0 |
| Source constructs flagged (warnings) | 14684 |
| Source constructs flagged (warnings) | 14704 |

## Compiler CFG gaps (`lib/Compiler.php`)

Expand Down Expand Up @@ -3387,7 +3387,7 @@ Rank live CFG gaps across inventory files: `php script/bootstrap-inventory-triag
| `ext/xml/xml_set_unparsed_entity_decl_handler.php` | 0 | 2 |
| `ext/xmlreader/BuiltinClasses.php` | 0 | 1 |
| `ext/xmlreader/Module.php` | 0 | 1 |
| `ext/xmlreader/VmXmlReader.php` | 0 | 20 |
| `ext/xmlreader/VmXmlReader.php` | 0 | 25 |
| `ext/xmlreader/XmlReaderClose.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderConstants.php` | 0 | 1 |
| `ext/xmlreader/XmlReaderExpand.php` | 0 | 3 |
Expand All @@ -3397,6 +3397,11 @@ Rank live CFG gaps across inventory files: `php script/bootstrap-inventory-triag
| `ext/xmlreader/XmlReaderFromUri.php` | 0 | 4 |
| `ext/xmlreader/XmlReaderGetAttribute.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderIsValid.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderMoveToAttribute.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderMoveToElement.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderMoveToFirstAttribute.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderMoveToNextAttribute.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderNext.php` | 0 | 3 |
| `ext/xmlreader/XmlReaderOpen.php` | 0 | 4 |
| `ext/xmlreader/XmlReaderPropertySupport.php` | 0 | 2 |
| `ext/xmlreader/XmlReaderRead.php` | 0 | 3 |
Expand Down Expand Up @@ -27925,18 +27930,23 @@ Rank live CFG gaps across inventory files: `php script/bootstrap-inventory-triag
- new XmlReaderGetAttribute (line 64)
- new XmlReaderIsValid (line 67)
- new XmlReaderExpand (line 70)
- new XmlReaderFromString (line 75)
- new XmlReaderFromUri (line 78)
- new XmlReaderFromStream (line 81)
- new Variable (line 87)
- new ObjectEntry (line 128)
- new Error (line 172)
- new Error (line 201)
- new Error (line 206)
- new XmlReaderState (line 229)
- new Error (line 303)
- new XmlReaderEvent (line 563)
- 31 class method(s)
- new XmlReaderMoveToAttribute (line 73)
- new XmlReaderMoveToFirstAttribute (line 76)
- new XmlReaderMoveToNextAttribute (line 79)
- new XmlReaderMoveToElement (line 82)
- new XmlReaderNext (line 85)
- new XmlReaderFromString (line 90)
- new XmlReaderFromUri (line 93)
- new XmlReaderFromStream (line 96)
- new Variable (line 102)
- new ObjectEntry (line 143)
- new Error (line 187)
- new Error (line 216)
- new Error (line 221)
- new XmlReaderState (line 244)
- new Error (line 457)
- new XmlReaderEvent (line 747)
- 37 class method(s)

### `ext/xmlreader/XmlReaderClose.php`

Expand Down Expand Up @@ -27998,6 +28008,41 @@ Rank live CFG gaps across inventory files: `php script/bootstrap-inventory-triag
- 1 class method(s)
- 1 closure(s)

### `ext/xmlreader/XmlReaderMoveToAttribute.php`

**Warnings** (review for bootstrap subset):
- new ArgumentCountError (line 23)
- 1 class method(s)
- 1 closure(s)

### `ext/xmlreader/XmlReaderMoveToElement.php`

**Warnings** (review for bootstrap subset):
- new ArgumentCountError (line 23)
- 1 class method(s)
- 1 closure(s)

### `ext/xmlreader/XmlReaderMoveToFirstAttribute.php`

**Warnings** (review for bootstrap subset):
- new ArgumentCountError (line 23)
- 1 class method(s)
- 1 closure(s)

### `ext/xmlreader/XmlReaderMoveToNextAttribute.php`

**Warnings** (review for bootstrap subset):
- new ArgumentCountError (line 23)
- 1 class method(s)
- 1 closure(s)

### `ext/xmlreader/XmlReaderNext.php`

**Warnings** (review for bootstrap subset):
- new ArgumentCountError (line 27)
- 1 class method(s)
- 1 closure(s)

### `ext/xmlreader/XmlReaderOpen.php`

**Warnings** (review for bootstrap subset):
Expand Down
6 changes: 3 additions & 3 deletions docs/bootstrap-selfhost.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

**Gen-0 without Zend:** `BOOTSTRAP_M5_NO_ZEND=1 make bootstrap-selfhost-link` installs `prelinked/bootstrap-gen0/bin-compile-aot` and links `compiler_minimal` without `php bin/compile.php` ([#3053](https://github.com/PurHur/php-compiler/issues/3053)). **M5 lib spine compile:** `BOOTSTRAP_NO_ZEND_FALLBACK=1 make bootstrap-selfhost-lib-spine-smoke` (default in link script) refuses host `php bin/compile.php` on the spine emit path ([#8716](https://github.com/PurHur/php-compiler/issues/8716)). **Contributor workflow:** [bootstrap-dev-workflow.md](bootstrap-dev-workflow.md) (tiered gen-1+ path, spine checklist, CI).

**Project north star:** The **compiler fully compiles itself** — native AOT from `lib/` (no `vendor/` at cold boot), then compiles PHP and rebuilds the next compiler revision without Zend. **M2 spine:** **5290** / **5290** Phase A inventory (`php script/bootstrap-spine-count.php`; `check-selfhost-spine-coverage-sync.php`). **M5 daily gate:** `make north-star5-verify-fast` (~1–2 min) ✅; **`--strict`** (~1h) pre-merge only. Committed `prelinked/bootstrap-gen0/` sidecars + vendor **3/3** cold boot. **Hot loop:** VM driver execute probe ~**20ms**; full spine relink only with `BOOTSTRAP_VM_DRIVER_EXECUTE_PROBE_FULL_LINK=1` ([#2201](https://github.com/PurHur/php-compiler/issues/2201)). **Living tracker:** [#1492](https://github.com/PurHur/php-compiler/issues/1492) (was [#1056](https://github.com/PurHur/php-compiler/issues/1056)) · **re-root doc:** [self-host-target.md](self-host-target.md) · **generation ladder:** [bootstrap-generations.md](bootstrap-generations.md) · **M5 fast path:** [bootstrap-m5-fast-path.md](bootstrap-m5-fast-path.md) · public status: [development-status § North star](https://purhur.github.io/php-compiler/development-status.html#north-star-self-host). Parent tracking: [#78](https://github.com/PurHur/php-compiler/issues/78) (roadmap), [#212](https://github.com/PurHur/php-compiler/issues/212) (closed umbrella).
**Project north star:** The **compiler fully compiles itself** — native AOT from `lib/` (no `vendor/` at cold boot), then compiles PHP and rebuilds the next compiler revision without Zend. **M2 spine:** **5295** / **5295** Phase A inventory (`php script/bootstrap-spine-count.php`; `check-selfhost-spine-coverage-sync.php`). **M5 daily gate:** `make north-star5-verify-fast` (~1–2 min) ✅; **`--strict`** (~1h) pre-merge only. Committed `prelinked/bootstrap-gen0/` sidecars + vendor **3/3** cold boot. **Hot loop:** VM driver execute probe ~**20ms**; full spine relink only with `BOOTSTRAP_VM_DRIVER_EXECUTE_PROBE_FULL_LINK=1` ([#2201](https://github.com/PurHur/php-compiler/issues/2201)). **Living tracker:** [#1492](https://github.com/PurHur/php-compiler/issues/1492) (was [#1056](https://github.com/PurHur/php-compiler/issues/1056)) · **re-root doc:** [self-host-target.md](self-host-target.md) · **generation ladder:** [bootstrap-generations.md](bootstrap-generations.md) · **M5 fast path:** [bootstrap-m5-fast-path.md](bootstrap-m5-fast-path.md) · public status: [development-status § North star](https://purhur.github.io/php-compiler/development-status.html#north-star-self-host). Parent tracking: [#78](https://github.com/PurHur/php-compiler/issues/78) (roadmap), [#212](https://github.com/PurHur/php-compiler/issues/212) (closed umbrella).

## Current gates

| Gate | Command | Status |
|------|---------|--------|
| Phase A inventory | `make bootstrap-inventory-check` | ✅ vm.php-path inventory; **0** source blockers; M2 ratio SSOT: `Phase A inventory files` row in `docs/bootstrap-inventory.md` (no ratio-deferred paths — [#2543](https://github.com/PurHur/php-compiler/issues/2543)); `lib/JIT/Builtin/StringPregMatch.php` and `lib/AOT/Linker.php` **included** in spine |
| Spine PHPCfg parse | `php script/bootstrap-spine-php-cfg-parse-check.php` (`--minimal` for M0 bundle) | ✅ no unsupported php-cfg expr/stmt on spine ([#2575](https://github.com/PurHur/php-compiler/issues/2575)); `BOOTSTRAP_SPINE_PHPCFG_PARSE_GATE=1` in `ci-fast.sh` |
| Phase B lib AOT lint | `php bin/compile.php -l lib/*.php` (with `script/php-env.sh`) | ✅ **5290/5290** top-level `lib/*.php` units ([#534](https://github.com/PurHur/php-compiler/pull/534)) |
| Phase B lib AOT lint | `php bin/compile.php -l lib/*.php` (with `script/php-env.sh`) | ✅ **5295/5295** 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` | ✅ **5290/5290** link targets OK |
| Phase C native run | `make bootstrap-aot-link` or `./script/bootstrap-aot-link.sh` | ✅ **5295/5295** link targets OK |
| Phase D `lib/` link | `make bootstrap-aot-link-lib` or `./script/bootstrap-aot-link-lib.sh` | ✅ `test/bootstrap-aot/lib_opcode/main.php` bundles `lib/OpCode.php` ([#540](https://github.com/PurHur/php-compiler/issues/540)) |
| Bundled `lib/Compiler.php` lint | `./script/bootstrap-selfhost-lint.sh` | ✅ `test/selfhost/compiler_minimal/main.php` + literal `require_once` units toward `bin/vm.php` (no `vendor/`) ([#559](https://github.com/PurHur/php-compiler/issues/559)) |
| Compiler compile smoke lint | `php bin/compile.php -l test/selfhost/compiler_compile_smoke/main.php` | ✅ `compiler_minimal` bundle + literal `require_once` of `test/bootstrap-aot/compiler_smoke.php` (named function CFG) |
Expand Down
12 changes: 6 additions & 6 deletions docs/pages/development-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ permalink: /development-status.html
| **What it is** | PHP → CFG → VM / LLVM JIT → AOT native binaries |
| **North star** | Compiler compiles itself without Zend ([#1492](https://github.com/PurHur/php-compiler/issues/1492)) |
| **v1.1.0 theme** | M5 fast-path stability; enum/property hooks; `preg_match` JIT; `spl_autoload*`; php-in-PHP JIT helpers ([#78](https://github.com/PurHur/php-compiler/issues/78)) |
| **Wave 3** | Language **5290/5290** · Stdlib **5290/5290** on master ([#1380](https://github.com/PurHur/php-compiler/issues/1380)) |
| **Spine SSOT** | `php script/bootstrap-spine-count.php` → **5290** / **5290** |
| **Wave 3** | Language **5295/5295** · Stdlib **5295/5295** on master ([#1380](https://github.com/PurHur/php-compiler/issues/1380)) |
| **Spine SSOT** | `php script/bootstrap-spine-count.php` → **5295** / **5295** |
| **Builtin matrix** | **852** functions ([`docs/capabilities.md`](https://github.com/PurHur/php-compiler/blob/master/docs/capabilities.md)) |
| **Try it** | [`docs/GETTING-STARTED.md`](https://github.com/PurHur/php-compiler/blob/master/docs/GETTING-STARTED.md) |

Expand All @@ -33,7 +33,7 @@ permalink: /development-status.html
| M5 spine runtime + bootstrap | `fix/spine-aot-jit-blockers` | Native bundle-OK probe; inventory argv spine-lint fallback; gen-0 sidecars refreshed ([#8559](https://github.com/PurHur/php-compiler/issues/8559)) |
| VM driver execute probe | [9493e806d](https://github.com/PurHur/php-compiler/commit/9493e806d) | **~20ms** feedback loop — no full relink on stale SHA; `BOOTSTRAP_VM_DRIVER_EXECUTE_PROBE_FULL_LINK=1` for rebuild ([#2201](https://github.com/PurHur/php-compiler/issues/2201)) |
| M5 presenter | `make north-star5-verify-fast` | Daily PR gate (~1–2 min); `--strict` (~1h) pre-merge only ([#1492](https://github.com/PurHur/php-compiler/issues/1492)) |
| Gen-0 refresh | [a8cffaa0e](https://github.com/PurHur/php-compiler/commit/a8cffaa0e) | Spine runtime probe + gen-0 sidecars (**5290/5290**); inventory argv spine-lint fallback ([#8559](https://github.com/PurHur/php-compiler/issues/8559)) |
| Gen-0 refresh | [a8cffaa0e](https://github.com/PurHur/php-compiler/commit/a8cffaa0e) | Spine runtime probe + gen-0 sidecars (**5295/5295**); inventory argv spine-lint fallback ([#8559](https://github.com/PurHur/php-compiler/issues/8559)) |
| Parallel compile jobs | [#10347](https://github.com/PurHur/php-compiler/pull/10347) | `PHP_COMPILER_COMPILE_JOBS` for vendor prelink + M3 sidecar warmup |
| Spine coverage | [#10356](https://github.com/PurHur/php-compiler/pull/10356) | `GeneratorYieldSourceMarker.php` in spine; inventory **3276** Phase A files |
| v1.1.0 docs sync | [#10369](https://github.com/PurHur/php-compiler/issues/10369) | README, development-status, examples README, capability matrix (**852** builtins) |
Expand All @@ -50,7 +50,7 @@ permalink: /development-status.html
### Still open (high signal)

- **MCJIT execute** — `bin/jit.php -r` SIGSEGV ([#98](https://github.com/PurHur/php-compiler/issues/98))
- **Literal spine ratio** — **5290/5290** ✅ (Jul 2026)
- **Literal spine ratio** — **5295/5295** ✅ (Jul 2026)
- **Compile-spine stub retirement** — shrink `PHP_COMPILER_SELFHOST_AOT` on M3 allowlist ([#1402](https://github.com/PurHur/php-compiler/issues/1402))
- **007-ThrowsWeb AOT execute** — invalid POST segfault at runtime (link OK; slice `EXAMPLES_AOT_SMOKE_ONLY=007`)
- **LLVM 14+ upgrade** — experimental `script/install-llvm14.sh` ([#174](https://github.com/PurHur/php-compiler/issues/174))
Expand All @@ -62,7 +62,7 @@ permalink: /development-status.html
- **`phpc` CLI** — `run`, `serve`, `build`, `deploy`, `lint`, `test`, `init`, `doctor`
- **Examples 000–009** — VM and AOT link/execute for the curated web subset
- **Self-host M0** — `compiler_minimal bundle OK` ✅
- **Self-host M2** — spine **5290/5290** ✅; native link + lint ✅
- **Self-host M2** — spine **5295/5295** ✅; native link + lint ✅
- **Self-host M3** — HelloWorld strict `emit_path=native` ✅ ([#1493](https://github.com/PurHur/php-compiler/issues/1493)); inventory argv `bin/compile.php` ✅ ([#3024](https://github.com/PurHur/php-compiler/issues/3024) closed); compile-smoke strict native ✅ ([#1937](https://github.com/PurHur/php-compiler/issues/1937))
- **Self-host M4** — `make bootstrap-loop-probe` full ladder ✅; gen-2→gen-3 full-spine recompile ✅
- **Self-host M5** — vendor prelink **3/3** ✅; **`make north-star5-verify-fast`** daily ✅; `--strict` pre-merge; gen-0 refreshed; VM probe ~**20ms**
Expand Down Expand Up @@ -92,7 +92,7 @@ See [`docs/bootstrap-selfhost.md`](https://github.com/PurHur/php-compiler/blob/m
|-----------|--------|
| **M0** — Small `lib/` bundle runs | ✅ |
| **M1** — Compiler-shaped bundle + compile-smoke | ✅ |
| **M2** — Spine toward full inventory | ✅ **5290** / **5290** |
| **M2** — Spine toward full inventory | ✅ **5295** / **5295** |
| **M3** — Native compiles PHP (no Zend emit) | ✅ Smoke + inventory argv driver strict native |
| **M4** — Bootstrap loop (next revision) | ✅ `bootstrap-loop-probe` full ladder |
| **M5** — Full self-host, no `vendor/` cold boot | ✅ Presenter strict + compiled-only empty `build/` cold boot ([#3053](https://github.com/PurHur/php-compiler/issues/3053)) |
Expand Down
Loading
Loading