ReviewOS

zig-utils/zig-js

Wasm GC: make the canonical recursive identity witness spec-correct

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

CI root: https://github.com/zig-utils/zig-js/actions/runs/29693769324/job/88210905183 Parent: #267 Related: #298 Roadmap: #142, #268, #134

Root cause and implementation

The canonical recursive type identity test expected ref.cast between unrelated concrete struct types to be invalid. Under the pinned GC validation rule, ref.cast rt may consume any valid supertype of rt; the prior program was therefore valid and could trap dynamically. It did not isolate canonical identity.

Commit 62ead6c8 uses struct.get type 1, field 0 instead. The operation accepts the produced type-0 reference only when the separately declared recursive groups are canonically equivalent. The structurally distinct group fails at that exact instruction with type mismatch.

Acceptance

  • Replace the cast with a type-sensitive operation whose operand must match the indexed concrete struct type.
  • Keep equivalent separately declared recursive groups valid.
  • Keep structurally distinct groups invalid with the exact instruction offset and type mismatch diagnostic.
  • Pass the focused validation test: 3/3, zero leaks.
  • Leave runtime cast semantics unchanged.
  • Pass Linux normal/TSan replacement CI.
9 days ago

Replacement run 29697559754 has all four Linux normal unit shards green on 7650986f. The matching TSan unit shards are still running; this issue remains open until that half of the gate completes.

9 days ago

Replacement run 29697559754 passed all four normal and all four TSan unit shards on 7650986f, including shard 3 carrying the corrected canonical recursive identity witness.

Sign in to comment on this issue.