ReviewOS

zig-utils/zig-js

VM: quicken indexed data reads through ordinary prototype chains

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

Parent: #498 Related: #1054, #1056, #1059, #1069

The current VM inventory explicitly limits indexed prototype data reads to one hop. An executed module-root witness with an Array receiver, two intervening ordinary objects, and a named-data holder returns the correct sum 42 for four numeric/String reads, but the prototype indexed fast-path counter records 0/4 hits. The witness is pinned in vm: prototype indexed data path covers ordinary ancestor depth.

Scope: extend representation-guarded indexed data reads through ordinary prototype ancestors, using the existing synchronized descriptor snapshots and canonical primitive key rules. No source/body recognizer, computed-result cache, or persistent chain metadata.

Acceptance:

  • Numeric and canonical String indexed data reads at arbitrary ordinary depth use the guarded path, with live descriptor/prototype revalidation.
  • Own data wins; undefined remains present; getters, Proxies, String exotics, mapped arguments, TypedArrays, module namespaces, host hooks, and restricted ownership retain canonical behavior.
  • Pin nearer data, accessor/descriptor changes, deletion, prototype edits, key effects, GC/throw recovery, and actual no-GIL workers.
  • Normal, ReleaseSafe, and unsuppressed TSan focused tests pass; exact before/after affected corpus and tree/VM output introduce no new failing paths.
  • Update and regenerate the machine-readable quickening inventory and its docs, with no throughput claim.

The executed counter is dispatch attribution, not timing or throughput evidence. Broad #498 performance acceptance remains separate.

9 days ago

Landed in d36f9a5. The indexed opcode data path now walks ordinary ancestors using coherent indexed/descriptor snapshots, keeping live prototype and nearest-property checks on every read. It adds no persistent chain cache or source/body recognizer. Observable/exotic holders retain canonical Get with the original receiver.

Dispatch evidence: the four-read ordinary-depth witness returns 42 both before and after; prototype fast-path attribution moves from 0/4 to 4/4, pinned in both synchronization modes. This is dispatch coverage, not throughput evidence.

Validation completed:

  • focused prototype indexed tests: 9/9 in normal, unsuppressed TSan, and ReleaseSafe;
  • actual four-worker no-GIL witness records at least 256 guarded ancestor reads;
  • Node-confirmed live mutation and exotic-boundary witnesses pass, including undefined presence, nearer data/accessors, deletion, prototype changes, String/TypedArray/arguments/Proxy boundaries, original receiver, GC/throw recovery, and deep restriction ownership;
  • before/after Array 3,081, Reflect.get 11, and arguments 263 corpus cases are identical, all passing;
  • inventory writer, validator, and fail-closed self-test pass;
  • documentation links pass over 378 files; the regenerated manifest passes the 51-page docs build.

The final VM sweep is also byte-identical: Array 3,081, Reflect.get 11, and arguments 263 cases agree in both tiers, with zero divergences. Flips 0 test262 cases and zero measured regressions in the 3,355-case scope. Full CI on the commit is pending. The inventory continues to leave accessor, Proxy, exotic ancestor, and inherited-write work open. No timing, throughput, or global conformance-score claim is made.

Sign in to comment on this issue.