ReviewOS

zig-utils/zig-js

Symbol: own description bytes across collection and relocation

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

Parent: #465. Found while validating #815; prerequisite for its moving-Symbol-key witness.

makeSymbolObj stores its caller's borrowed []const u8 directly in the primitive sidecar. Symbol(description) passes bytes returned by ToString, which may point inside a GC-managed String cell. The sidecar's description is unmanaged bytes, not a traced String edge. Once that string is collected or relocated, the live Symbol retains a dangling description even though its identity remains correct. Symbol.for and internal makeSymbol share this constructor.

Confirmed on the #815 candidate with both ReleaseSafe and Debug moving checkpoints: one actual nursery evacuation, a changed subject pointer, one key coercion, correct Symbol key identity and correct getter result, but the name becomes get [U] instead of get [x] in the forced tree-walker. This is independent of #815's VM naming flags. Debug diagnostics record [1,true,true,"get [U]",true] (call count, getter identity, held identity, accessor name, key identity).

The ownership boundary must retain the description in the Symbol owner's stable arena before publishing the sidecar, preserving absent versus empty descriptions and canonical WTF-8. Do not pin source strings, suppress moving GC, or patch the name consumer.

Acceptance:

  • Own description storage at the shared Symbol construction boundary, including registered and internal Symbols.
  • Regression coverage for borrowed/mutable source bytes, absent/empty/non-ASCII descriptions, real moving checkpoints, and allocation-failure cleanup.
  • Verify metadata consumers and Symbol conformance, no-GIL/TSan, and issue-linked commit/CI evidence.

Exact retained diagnostics: /Users/chris/.cache/zig-js-vm-naming.7Wj8Ri/diagnostic-debug.log and the compressed ReleaseSafe binaries/hashes. No performance or blanket GC-safety claim.

10 days ago

Landed as fix(symbol): own description bytes across moving GC (#816), authored and committed as Chris with no trailers. The shared Symbol constructor now owns stable description bytes; the C API uses that one copying boundary. No ABI layout, exported signature, GC scheduling or stack/queue/job lifecycle change.

Validation on the saved 209201a + #815/#816 candidate:

  • Debug: all three new ownership tests and all eleven metadata tests pass, including two dedicated Symbol moving fixtures in both forced tiers, the previously failing Symbol accessor-name fixture, borrowed mutable bytes and allocation replay.
  • Unsuppressed ReleaseSafe+TSan: 24 Symbol-related tests and 11 metadata tests pass, zero failures/leaks/race reports. The existing C API test releases the input JSString before observing the Symbol description.
  • Symbol Test262: 98/98 before and after, zero flips or measured regressions. Default Object and Function reports also remain byte-identical; #815's separate positive paired census stays at 1,006/1,007.
  • Seeded Debug threadfuzz: 400 default + 300 exact-value verifier cases, zero failures (seed 1).
  • c-api-audit: all 117 public declarations/exports match; no pending entries.

The commit was rebased without conflict over three independently pushed error-message commits before publication. The local measurements above do not claim to include those intervening changes. Full current-main sharded units and pushed CI remain open, so this issue stays open for that terminal evidence. A distinct possible Function diagnostic-name ownership defect is being checked under #815; it is not being folded into this Symbol fix.

Logs, exact sources/patches, hashes and retained executables live in /Users/chris/.cache/zig-js-vm-naming.7Wj8Ri. Inactive compiler caches were removed; diagnostic binaries are losslessly compressed.

10 days ago

Closing with terminal combined-main integration evidence: CI 33211154123 at e24c4fa completed successfully: 53 successful checks, one skipped nightly-only check, zero failed/cancelled checks. The implementation fix(symbol): own description bytes across moving GC (#816) is in that revision. This completes the pending integration condition alongside the scoped local/conformance evidence recorded above. Separately discovered Error-intrinsic, Array-realm, prototype-type and restriction-path defects remain open in #823, #824, #825 and #826; this closure does not claim those are fixed.

Sign in to comment on this issue.