ReviewOS

zig-utils/zig-js

VM: preserve Reference semantics for parameter assignment and update expressions

#799
Closed chris opened this 10 days ago ·
10 days ago

Parent: #465. Related: #798, #771.

Verified remaining boundary

The #798 exact-parent comparison (8a1398f, pinned Test262 4249661) still rejects the eight ordinary arrow/function/object-method/class-method variants of dflt-params-arg-val-not-undefined.js at the parameter-prologue admission boundary. Their initializers use compound assignments such as falseCount += 1. All eight fail required bytecode both before and after #798; the corresponding default-tier diagnostics pass. This is not a regression from identifier admission.

The compiler has existing exact Reference lowering for assignment, compound/logical assignment, and prefix/postfix updates, but the parameter classifier only admits plain identifier assignment. Reuse the canonical checked local/upvalue/Environment/global and member Reference paths where their complete parameter semantics are proven; do not rewrite compound operations into separate name lookups.

Acceptance

  • Admit fully lowered assignment, compound/logical assignment, and update expressions in parameter initializers and computed binding keys, while retaining explicit rejection for genuinely unsupported nested syntax.
  • Preserve self/later-formal TDZ, const/strict errors, parameter/body separation, dynamic with/unscopables Reference selection, and nested/escaping lexical identity.
  • Member bases and computed keys evaluate exactly once; getter/RHS/coercion/setter ordering, logical short-circuiting, named evaluation, and abrupt completion match the tree-walker.
  • Provided arguments suppress every initializer effect. Add executed-default controls as well: the eight existing provided-argument files alone do not establish assignment execution semantics.
  • Paired ordinary/arrow/method/nested/destructuring witnesses, compiler OOM, no-GIL/TSan, full units, and exact before/after Test262 accounting pass.
  • Land an issue-linked conventional commit; report required-tier gains separately from default-tier flips and pushed CI.

No AST callback, repeated reference resolution, binding-value snapshot, skipped TDZ/const check, policy fallback, or changes to native stack/queue/job, Promise/Worker lifecycle, or Map/Set iterator implementations. Object/array/class literal admission and other initializer forms are outside this focused child.

Landed implementation and evidence

e4f76af6 — feat(vm): admit parameter assignment expressions (#799) is on origin/main, authored and committed by Chris without trailers. Numeric prerequisite d2ad8a8f (#800) fixes the independently discovered Symbol and wide-BigInt update defects.

The classifier uses canonical parameter-phase binding plans and existing activation-owned member/super temporaries. It does not introduce a callback, duplicated resolution, or new native ownership model. Unsupported nested object/array/class literals and optional forms remain explicit boundaries.

Measured against 2865b8b and Test262 4249661:

  • Same 9,643 eligible positive files: 8,809 pass / 834 fail -> 8,838 pass / 805 fail: 29 required-bytecode gains, zero regressions.
  • Gains: expressions/arrow-function 4, expressions/class 8, expressions/function 4, expressions/object/method-definition 1, statements/class 8, statements/function 4.
  • All 13 default-tier reports are byte-identical: 11,494 pass / 0 fail; 0 default-tier flips. The 805 remaining paired failures are not excluded or claimed implemented.
  • Original 39 assertion fixtures: 0 -> 39 paired passes; four additional numeric prerequisite controls bring the final matrix to 43 passing paired cases. Covers real executed defaults, provided arguments, every compound operator, logical effects/naming, TDZ/const/strict, with/unscopables, closures, computed keys, reentry and super.
  • Final Debug and ReleaseSafe+TSan assignment filters each pass 3/3, including shared no-GIL invocation isolation and compiler allocation replay. Stable admission guard also passes under TSan; zero reports/failures/leaks.
  • Final combined unit suite: 2,026 pass, 1 platform skip, 0 failures/leaks, 350.5 seconds across four timing-balanced shards. Seed-1 fuzz: 400 default + 300 verify programs, zero failures. Format/diff checks pass.

The final combined comparison has exactly the same gains and regressions as the #799-only candidate. No public performance claim. Broader borrowed-state GC failures found during review are tracked, with actual relocation reproductions, in #801; no native stack/queue/job or lifecycle implementation was changed.

  • Pushed required integration verified: CI 33130214332 at descendant e4f76af completed successfully: 53 jobs passed, one scheduled-only job skipped, zero failures. Superseded/cancelled earlier runs are not counted as successful gates.

Evidence: /Users/chris/.cache/zig-js-799.NeLWpV/README.md. All 59 temporary #799/#800 corpus fixtures were byte-compared and removed; unit assertions and retained fixtures remain. Generated isolated caches were cleaned (1.4 GB -> 144 MB) while preserving logs, hashes, source diffs, final binaries and shard timing plans. User-owned .codex was untouched.

10 days ago

The identifier-reference prerequisite landed as 2865b8b4 (#798). Its exact before/after comparison retains the eight compound-assignment provided-argument failures named here. Use this commit as the next implementation baseline; #798's 334 other admission gains are not this issue's results.

10 days ago

Implementation and final focused checks now pass. The parameter matrix is expanded to 43 paired cases, including Symbol and wide/overflow BigInt controls enabled by prerequisite #800. Shared no-GIL invocation isolation and compiler allocation replay pass; final ReleaseSafe+TSan filters report 3 parameter-assignment tests and the stable-admission guard passing without reports/leaks. The final combined 9,643-file inventory is byte-identical to the baseline inventory: 8,809 pass / 834 fail -> 8,838 pass / 805 fail, +29 / zero regressions. All 13 default-tier reports remain byte-identical (11,494 pass / 0 fail). The #799-only full suite passed 2023 + 1 skip; the final combined runtime suite and fuzz checks are now running before landing. No native stack/queue/job or lifecycle redesign.

10 days ago

Closing after the linked implementation and full pushed integration were verified: CI 33130214332 passed all 53 executed jobs (one scheduled-only skip). The issue body records exact conformance denominators, local validation and remaining independent follow-ups.

Sign in to comment on this issue.