ReviewOS

zig-utils/zig-js

Compiler: lower parameter-local property reads in VM frames

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

Parents: #465, #498 Depends on: #742 Related: #739, #740, #741

Problem

#742 composes primitive, invocation-context, and strictly-earlier-parameter leaves through the VM's canonical value operations, but a non-optional public property read rooted entirely in those proven values still rejects the enclosing plain function. The VM already owns exact named/computed [[Get]], Proxy/getter/prototype fallback, RequireObjectCoercible, ToPropertyKey, inline-cache guards, abrupt completion, and GC rooting for the same bytecode instruction.

Scope

  • Admit non-optional public named and computed member reads when the base, and the computed key when present, recursively satisfy the parameter-safe grammar.
  • Permit nested read chains and composition through the existing unary, binary, logical, conditional, and sequence nodes.
  • Preserve base/key evaluation order, nullish errors, one ToPropertyKey, receiver identity for getters/Proxies, prototype traversal, abrupt completion, provided-value bypass, reentrancy, moving GC, and OOM propagation.
  • Preserve immutable Chunk metadata, guarded inline caches, debugger/step/watchdog accounting, shared-chunk no-GIL execution, and exact activation restoration.

Optional chains, private or super access, calls/tagged templates/construction, writes/assignment/update/delete, unresolved outer/body bindings, direct eval/import, suspension, literal allocation, nested-pattern expressions, and rest mixtures remain explicit barriers.

No-workaround rules

  • No cached property result, source rewriting, eager getter/Proxy invocation, skipped key coercion, duplicated effect, permissive member arm, guessed identifier resolution, tree-walker callback, disabled inline-cache guard, or benchmark-only path.
  • No stacks, queues, jobs, Promise, microtask, Worker lifecycle, or Map/Set iterator changes.

Acceptance

  • Exhaustive admission tests accept only recursively safe public reads and reject optional/private/super/call/write/outer compositions.
  • Forced tree-walker and required bytecode agree on named/computed/nested reads, primitives, nullish throws, getters, Proxies, prototypes, Symbols, one-shot key coercion, provided bypass, methods/arrows/base constructors, and recursion/reentrancy.
  • Moving-GC, allocation-failure restoration, shared no-GIL, and TSan witnesses preserve exact effects and activation state.
  • Full units, focused compiler/frontend/VM, threadfuzz, and exact nonzero relevant Test262 accounting pass with zero regressions.
  • A conventional commit lands directly on main and cross-links #465, #498, #742, #739, #740, and #741.

Landed

1b7e8e58 — feat(compiler): lower parameter property defaults (#743)

9 days ago

Landed on main in 1b7e8e58.

The compiler now admits non-optional public named/computed reads only when every base/key subtree satisfies the proven parameter-safe grammar. Execution remains on the canonical get_prop/get_index path, preserving source order, RequireObjectCoercible, one ToPropertyKey, guarded inline caches, Proxy/getter receiver identity, abrupt completion, GC, and OOM without replay. Optional/private/super/call/write/outer forms remain fail-closed.

Validation on the landed tree:

  • Test262: 10296 -> 10296, byte-identical diagnostics across seven function/class boundaries; 0 gains, 0 regressions.
  • Full units: 1,886 passed, 1 skipped, 0 failed, 0 leaked across 1,887 tests.
  • Focused compiler, three-mode semantic, shared no-GIL, and getter-allocation-failure tests passed normally and under TSan; frontend 22/22.
  • Seeded threadfuzz: 400/0 in default and TSan builds.

The acceptance checklist is complete. Crosslinks: #465, #498, #742, #739, #740, #741.

9 days ago

The follow-on parameter-local call slice #744 has landed on main in 402e805a, composing this issue's proven defaults through canonical value and receiver-preserving call opcodes. Test262 remained byte-identical at 10296 -> 10296; full units, TSan, shared no-GIL, nested-call OOM restoration, and default/TSan threadfuzz all passed.

9 days ago

Follow-up #745 landed on main as feat(compiler): lower parameter construction defaults (#745). It composes the parameter-safe value/property/call grammar into canonical non-spread new_call lowering, remains fail-closed for unsupported forms, and records 10,296 -> 10,296 exact relevant Test262 cases with 0 flips. Derived and field-initializing constructor activations are separated into #746.

Sign in to comment on this issue.