ReviewOS

zig-utils/zig-js

VM: lower super delete references across tiers

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

Parents: #465, #713 Related: #491, #715

Problem

Property and value deletion now compile across bytecode tiers, but delete super.name and delete super[expression] remain a causal unsupported_lowering barrier. This is a correctness gap for generator, async, and async-generator methods because resumable bodies cannot fall back after suspension and currently surface the generic unsupported-body error instead of the required ReferenceError.

Deleting a SuperReference always throws ReferenceError, but constructing the reference has observable order: GetThisBinding rejects an uninitialized derived-constructor this before a computed key runs; the computed key expression then evaluates once; neither ToPropertyKey nor a super-base null check may replace the final delete ReferenceError.

Scope

  • Add an owned bytecode operation for the terminal delete SuperReference ReferenceError.
  • Lower named and computed forms in plain, generator, async, and async-generator methods.
  • Preserve GetThisBinding-before-key order, one-shot key evaluation, no ToPropertyKey coercion, null-super-base behavior, and exact ReferenceError identity.
  • Preserve the reference construction across yield / await, GC relocation, abrupt computed keys, and hot native-tier rejection/fallback.
  • Keep bare identifier deletion as the separate Environment Record barrier left by #713.

No-workaround rules

  • No source rewriting, tree-walker callback disguised as bytecode, eager key coercion, swallowed key errors, generic TypeError substitution, broad method fallback, or heap wrapper per reference.
  • No activation-scratch, stacks, queues, jobs, Promise/microtask, Worker lifecycle, or Map/Set iterator implementation changes.

Acceptance

  • Plain, generator, async, and async-generator admission/runtime differentials cover named and computed forms.
  • Abrupt-order witnesses cover uninitialized this, side-effecting and throwing keys, no key coercion, null super base, yield, await, and moving GC.
  • Focused compiler/VM/frontend, full units, exact relevant Test262, and applicable TSan gates pass with exact accounting.
  • Landing commit and parent issues are cross-linked with quantified evidence.
9 days ago

Implementation is in progress on main worktree. The dedicated terminal delete_super bytecode now admits named/computed SuperReferences while keeping bare identifier deletion as the Environment Record barrier. Computed lowering performs GetThisBinding validation before evaluating the key, evaluates it once without ToPropertyKey, and then throws the mandated ReferenceError.\n\nFocused evidence so far: 3/3 #716 runtime tests pass (0 failed, 0 leaked): forced tree-walker vs required bytecode including uninitialized this, abrupt and side-effecting keys, no coercion, and null super base; generator/async/async-generator suspension through moving GC; and cached native-tier rejection with exact VM fallback. Broader deletion, TSan, frontend, full-unit, and exact Test262 gates remain in progress.

9 days ago

Landed in e051fc45 (feat(compiler): lower super delete references (#716)).

Evidence:

  • focused #716 runtime: 3/3 pass normally and 3/3 under TSan; 0 failures, leaks, or race diagnostics
  • broad deletion: 33/33 pass
  • production frontend: 12/12 pass
  • full units: 1,833 pass, 1 skip, 0 fail, 0 leak across six shards
  • exact detached parent a5280fad vs candidate: test/language/expressions/delete 69/69 -> 69/69; 0 flips, no regressions

The implementation owns the terminal SuperReference delete error in bytecode, preserves GetThisBinding/key ordering and no-ToPropertyKey behavior across suspension/GC, and leaves bare identifier deletion as the separate Environment Record barrier.

9 days ago

The complementary bare identifier deletion path has landed in #717 as c8e1b0c0. DeleteExpression no longer has a reference-kind-specific VM barrier (apart from the independent general plain-frame arguments policy). Broad deletion is 37/37 and exact delete Test262 remains 69/69.

Sign in to comment on this issue.