Skip to content

Self-host: Unknown Stmt Type lowering batch tracker (post-#2254 triage) #2276

Description

@PurHur

Category

bootstrap

Problem

docs/bootstrap-inventory.md historically reported 1579 CFG warnings with Unknown Stmt Type: as the dominant bucket. #2254 ✅ added bootstrap-inventory-triage.php; on master (May 2026) phpc lint --bootstrap-inventory is clean (0 CFG gaps).

There is still no actionable worker spec when inventory regresses — this issue is the living checklist to slice Stmt lowering into reviewable PR batches (like M2 spine file batches #2126). Parent coordinator: #2362.

php-src reference

  • Zend/zend_compile.c — zend_compile_stmt() / statement handlers
  • Zend/zend_ast.c — statement zend_ast kinds mapped to php-cfg Stmt_*

Repro (detect regression)

./script/docker-exec.sh -- bash -lc 'php script/bootstrap-inventory-triage.php --top 30 | grep "Unknown Stmt" || echo "clean"'
./script/docker-exec.sh -- bash -lc './phpc lint --bootstrap-inventory --check'

Example when a class appears:

./script/docker-exec.sh -- bash -lc './phpc lint --bootstrap-inventory lib/Compiler.php 2>&1 | grep "Unknown Stmt"'

Scope

Module Path
Stmt lowering lib/Compiler.php — compileStmt() / statement visitors
Triage script/bootstrap-inventory-triage.php
Inventory docs/bootstrap-inventory.md, script/bootstrap-inventory.php

Batch table (May 2026 — inventory clean)

Stmt class Files (est.) Child issue / PR Status
(baseline) 0 CFG gaps — ✅ clean on master
Stmt\Unset_ — #2273 ✅ landed
Stmt\Static_ — #2286 ✅ function-local static
Other Stmt\… — open per-class when ≥5 files 📋 on regression only

When inventory regresses: replace the baseline row with top 5 classes from:

php script/bootstrap-inventory-triage.php --top 30 | grep 'Unknown Stmt'

Done when

  • phpc lint --bootstrap-inventory --check green on master (regression guard)
  • Any new Unknown Stmt Type: class with ≥5 files gets a child issue (repro snippet + php-src zend_compile.c handler name)
  • Each landed batch: inventory regen, --check, row marked ✅ in table above
  • Do not implement all stmt kinds in this umbrella issue

Verification

./script/docker-exec.sh -- bash -lc 'php script/bootstrap-inventory.php --check'
./script/docker-exec.sh -- bash -lc 'php script/bootstrap-inventory-triage.php --top 30'

Implementation hints

Links

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

    area:compilerCompiler / CFG / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions