ReviewOS

zig-utils/zig-js

VM: remove legacy fixed-shape allocation loop body kernel

#1081
Closed chris opened this 8 days ago ·
8 days ago

Parent: #498 Related: #1074, #1076, #1077, #1078, #1079, #491, #477

The live inventory classifies fixed-shape object allocation as legacy_pattern_kernel / legacy_narrow. The VM recognizes one exact indexed-selector/replacement-literal/checksum loop, then substitutes batched allocation, slot writes, and loop control with a kernel-specific checkpoint protocol. It is the last consumer of the array-loop plan table and candidate machinery. This conflicts with the no body/benchmark recognizer constraint.

Executed baseline on 7decd4fc: the VM witness passes 2/2, returning 1,456 with 5,944 logical steps in both synchronization modes, matching Node. Kernel-hit, literal-shape preparation, checkpoint-boundary, budget, override, and guarded-fallback assertions pass. The shared-worker witness also passes 2/2, asserting kernel hits and batch-reserve behavior across actual Thread workers.

Acceptance:

  • Remove the exact allocation-loop recognizer/executor, kernel-only plan/types/counters/test metrics, array-loop candidate flag/hint, and per-instruction array-plan table; retain general literal/index/property paths and shared helpers used by live families.
  • Ordinary execution preserves result 1,456 / 5,944 steps in both modes, checkpoints/budget/stop accounting, literal prototype/shape semantics, coercion, indexed/receiver effects, and partial exceptions.
  • Preserve nursery child roots, restrictions, actual no-GIL workers, explicit moving-GC roots, source hooks, and allocation-failure behavior through ordinary allocation.
  • Focused normal/ReleaseSafe/unsuppressed TSan and exact before/after affected test262 and tree/required-VM comparisons show no new failures.
  • Regenerate inventory/docs/manifest and update semantic witnesses without retaining kernel-hit substitutes; preserve historical evidence and explicit remaining legacy labels.

General unpublished-object reserves, prepared literal descriptors used by JSON, and observable-step helpers used by bounded leaf calls are separate mechanisms and remain where independently required.

This removes body-specific work substitution; it does not establish current throughput or complete #498.

8 days ago

Landed in 60ad2657.

Removed the exact fixed-shape allocation recognizer/executor, prepared-loop state, counters/testing exports, final array-loop plan table/type, candidate flag/hint, and kernel-only helpers. General literal/index/property paths, unpublished-object reserves, JSON literal descriptors, and bounded-leaf step helpers remain independently used.

Validation:

  • Ordinary execution retains 1,456 and 5,944 logical steps in both synchronization modes, including all recorded checkpoint placements, budget exhaustion, and termination accounting.
  • VM group 5/5, required-bytecode nursery/child-root/restriction group 3/3, and actual no-GIL worker group 2/2, each in normal, ReleaseSafe, and unsuppressed TSan. Semantic witnesses replace kernel-hit, reserve-refill, and prepared-loop assertions.
  • Explicit compaction requires both the selector Array and a replacement child to move, then warmed allocation returns 1,582. The source-hook check observes 96 literal allocations in the VM profiler and supported tree-walker debugger.
  • The effects oracle matches Node and both engine modes on both binaries, covering literal prototype semantics, inherited setters, accessor receiver/two-read order, coercion, indexed Proxy effects, and partial replacement before an exception.
  • Fractional/negative/large-counter results are pinned to Node and the parent: [4,3,3]. Expanded activation allocation-failure check 2/2 passes.
  • Exact parent/after Object 3,411, Array 3,081, object literals 1,170, assignment 485, for 385, while 38, addition 48, remainder 40, bitwise AND 30 comparisons: 8,688 total, 0 diagnostic failures before → after, 0 flips, and the same five pre-existing tail-call differences. Distinct binary hashes are verified.
  • Inventory self-test/validation pass: 10 guarded families, 2 remaining legacy families, 5 explicit unsupported families. Docs links pass for 378 files, and the 51-page build matches the refreshed manifest.

These are scoped local checks; full integration gates run in CI. Historical performance artifacts remain intact. This removal does not establish current throughput or complete #498.

Sign in to comment on this issue.