ReviewOS

zig-utils/zig-js

VM: inventory quickening coverage and legacy kernels

#659
Closed chris opened this 9 days ago ·
9 days ago

Parent: #498 Related: #465, #481, #493

Problem

The VM already contains polymorphic property inline caches, quick global bindings, numeric leaf/call/recurrence plans, and several structural loop kernels, but there is no machine-readable inventory that distinguishes general adaptive specialization from narrow legacy bytecode-pattern kernels. Remaining dispatch families, guard/miss behavior, metadata lifetime, step/debugger coverage, and parallel synchronization are therefore implicit. That makes it possible to count a benchmark-shaped kernel as broad no-JIT coverage, which #498 explicitly forbids.

Scope

  • Publish a versioned machine-readable inventory of every current inline cache, quick plan, specialization, and structural candidate.
  • Classify each entry as general adaptive specialization, bounded structural kernel, or legacy narrow kernel without promoting a performance claim.
  • Record bytecode/AST surface, production source anchor, guards, miss/dequickening behavior, metadata allocation/lifetime, no-GIL synchronization, observable-step/debugger boundary, tests, and remaining unsupported families.
  • Validate exact entry identity and source anchors so new quickeners or removed guards cannot silently drift outside the inventory.
  • Generate a concise architecture document from the same data and cross-link the #498 acceptance boundary.

No-workaround rules

No benchmark/function/source recognizer described as general quickening, no kernel deletion presented as an inventory fix, no unsupported family marked covered through tree-walker fallback, no invented performance number, and no weakening of debugger/step/GC/no-GIL requirements.

Acceptance

  • The inventory names every current quickening family and explicitly identifies narrow legacy kernels.
  • Every entry records guards, miss behavior, lifetime, synchronization, observability, and source/test anchors.
  • Remaining property/index/call/arithmetic/control/allocation dispatch families are explicit and not counted as covered.
  • Validation fails on missing/duplicate identities, missing anchors, unsupported status values, or a legacy kernel labeled general.
  • Generator, release/docs accuracy, and offline links pass; inventory/docs only, 0 Test262 flips.
9 days ago

Audit and local implementation are complete; I am intentionally holding the push until the preceding no-GIL and private-ABI validation jobs finish so this documentation-only commit does not cancel their closure evidence.

The source-derived contract currently finds:

  • 16 guarded families: 5 general_adaptive, 2 bounded_structural, and 9 exact legacy_narrow kernels;
  • 6 broad families still explicitly unsupported: property, index, call, arithmetic, control, and allocation dispatch;
  • 6 Quick*Plan types, 14 tagged quickening unions, 8 Chunk metadata fields, 2 finalized structural-candidate flags, and 30 test-only observability counters.

The validator compares those sets directly with src/bytecode.zig and src/vm.zig, validates every production/test anchor and required contract field, and mutation-tests missing/duplicate identities, anchor drift, invalid covered/unsupported status, and legacy-to-general relabeling. The generated page publishes no throughput claim.

Local gates already green: generator verification/self-test, dedicated Zig build step (3/3), release compatibility (12/12), docs build (50 pages), and offline links (268 files). Runtime/Test262 behavior is untouched (0 flips). Pending only commit/push and fresh CI.

9 days ago

Implemented and pushed in tools(vm): inventory quickening coverage (#659).

The versioned inventory and generated architecture page classify all 16 guarded families, preserve 9 exact pattern recognizers as legacy_narrow, and leave six broad dispatch families explicitly unsupported. The gate derives the exact plan/tag/Chunk/candidate/counter sets from production sources, validates every lifecycle/synchronization/observability field and source/test anchor, and mutation-tests every acceptance failure mode.

Local evidence: dedicated gate 3/3, benchmark-comparison gate 31/31, release compatibility 12/12, docs 50 pages, offline links 268 files, 0 Test262 flips. Fresh pushed CI: https://github.com/zig-utils/zig-js/actions/runs/32410670302

9 days ago

Completed in eabd80b2 with the fail-closed dependency classification follow-up faa25a83.

The versioned inventory now classifies 16 guarded families (5 general adaptive, 2 bounded structural, 9 legacy narrow) and six explicitly unsupported broad property/index/call/arithmetic/control/allocation families. Every entry records surfaces, guards, miss/dequickening, metadata lifetime, no-GIL synchronization, debugger/step behavior, and production/test anchors. Validation derives and checks all 6 Quick plan types, 14 Quick tags, 8 Chunk metadata fields, 2 candidate flags, and 30 counters; it fails on missing/duplicate IDs, source/test drift, invalid states, or a legacy kernel relabeled general.

Validation:

  • inventory validation/self-test: 3/3 pass
  • release compatibility: 12/12 pass
  • complete local benchmark-comparison-test: 31/31 pass
  • fresh Linux benchmark-comparison harness: pass
  • fresh docs gate: pass
  • dependency audit after classifying both subprocesses and the new tool: 16 edges and 61 tools pass
  • docs build: 50 pages; offline links: 268
  • inventory/docs/tooling only; flips 0 Test262 cases.

Sign in to comment on this issue.