Skip to content

VM: preserve Reference semantics for parameter assignment and update expressions #799

Description

@chrisbbreuer

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

Verified remaining boundary

The #798 exact-parent comparison (8a1398f, pinned Test262 4249661388e5d3f92a85186213da140a6481490f) 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 4249661388e5d3f92a85186213da140a6481490f:

  • 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions