ReviewOS

zig-utils/zig-js

GC: retain class construction state across computed names and static effects

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

Parents: #473, #803. Related: #801, #804.

The forced-tree moving-nursery control for a class computed method name fails after the computed expression triggers collection: the returned class lacks its expected read method. The new #803 environment projection is not used in this mode. buildClass retains raw constructor/prototype/superclass and class-environment locals through computed names and static effects, and static elements restore raw saved caller this/home/environment values. prepareClassHeritage likewise retains a raw superclass across the observable prototype lookup.

Acceptance:

  • Root and reload class constructor/prototype, superclass, class lexical environment and suspended ambient state at every continued observable boundary.
  • Retain encoded static-field names beyond temporary key cells without repeating ToPropertyKey.
  • Preserve early class-name TDZ, once-only heritage/computed-key order, source-order static effects, private names and exact class result identity.
  • Actual-moving computed-name/static/heritage controls, OOM restoration, both execution tiers, TSan/no-GIL and measured class conformance.

No disabled collection, conservative pinning, stale forwarding-pointer reads, source rewrite, or native activation/job redesign.

Evidence: /Users/chris/.cache/zig-js-803.Ll0xKj/focused-debug-combined.log, computed_key (tree_walker), TypeError after actual moving collection. The preceding constructor receiver fix allowed this later witness to execute. Keep this prerequisite separate from required-bytecode admission gains.

Landed implementation and measured local evidence

f83c4191 — feat(vm): retain live deferred class captures (#803) is on origin/main, authored and committed by Chris without trailers. The cohesive class-capture change includes independently tracked construction ownership prerequisites #804/#805; native stack/queue/job and activation lifecycle remain unchanged.

Against parent ab23a1b and pinned Test262 4249661:

  • Same 9,643 eligible positive paired files: 8,838 pass / 805 fail -> 8,842 pass / 801 fail. Four required-bytecode gains, all statements/class/elements private-field/name cases; zero regressions.
  • Thirteen default class/function reports are byte-identical: 11,494 pass / zero fail. Expressions/new 59 and Reflect/construct 10 are unchanged too (11,563 total; zero default-tier flips).
  • Local paired controls: 9/41 -> 41/41. Class captures 3/32 -> 32/32, constructor primitive/object returns 6/8 -> 8/8 (Symbol/BigInt gains), original super-pattern IIFE 0/1 -> 1/1. Required mode reports no fallback.
  • Full Debug: 2,037 pass, one platform skip, zero failures/leaks, 542.0 s across four shards.
  • Debug+TSan and ReleaseSafe pass 20 actual-moving cases, semantic controls, compiler allocation replay and runtime/constructor OOM restoration. Every moving case asserts one moving minor and a changed subject pointer; static/returned identities are checked, not only field contents.
  • The no-GIL test was strengthened after the full-suite build to create classes concurrently in workers as well as exercising escaped captures. Final Debug, unsuppressed TSan and ReleaseSafe reruns pass; production source is unchanged.
  • Seed-one fuzz: 400 default + 300 verify programs, zero failures. Twelve compiler diagnostics pass structural and allocation-observation checks. These one-sample dirty-tree checks are not public performance evidence or a #619 scaling claim.

Evidence: /Users/chris/.cache/zig-js-803.Ll0xKj/README.md, retained fixtures, final source/binary hashes, full shard logs, exact paired gains/regressions and per-invocation compiler diagnostic rows. Temporary Test262 fixtures and completed build caches were removed; final evidence remains.

  • Complete pushed integration: CI 33144524467 at descendant 81978f7b completed successfully: 53 jobs passed, one scheduled-only job skipped, zero failures. This supersedes earlier pending, cancelled, or failed integration reports; those earlier runs are not counted as successful gates.

Completed integration (2026-08-28 UTC)

Implementation: f83c4191. The measured local evidence above and in the linked implementation comments remains unchanged.

  • Complete pushed integration: CI 33144524467 at descendant 81978f7b completed successfully: 53 jobs passed, one scheduled-only job skipped, zero failures. This supersedes earlier pending, cancelled, or failed integration reports; those earlier runs are not counted as successful gates.

Closing this implemented issue as completed. Parent-roadmap work and independently tracked follow-ups remain open; this closure does not claim those broader scopes are finished.

Sign in to comment on this issue.