ReviewOS

zig-utils/zig-js

ABI: implement rooted native value containers

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

Parent: #140 Profile parents: #163 and #164

Implement the five shared native rooted-value container operations:

  • MarkedArgumentBuffer__run
  • MarkedArgumentBuffer__append
  • JSCommonJSExtensions__appendFunction
  • JSCommonJSExtensions__setFunction
  • JSCommonJSExtensions__swapRemove

Acceptance:

  • Construct the opaque marked argument buffer only for the synchronous callback extent.
  • Root every appended cell across precise collection during the callback; accept immediates and reject cross-VM cells safely.
  • Remove all temporary roots on normal return and preserve cleanup under callback re-entry.
  • Keep the CommonJS function registry per selected realm with exact append index, set replacement, and swap-remove return semantics.
  • Trace registered functions until removal and release removed values without disturbing sibling realms.
  • Make invalid indices, null callbacks, allocation failure, and pending exceptions deterministic and failure-atomic.
  • Add focused GC tests and the real 5-symbol consumer fixture, regenerate both inventories, and update README/profile docs.
9 days ago

Complete on main through 3d87a83b (implementation 37df3f70).

Evidence:

  • focused precise-GC unit gate: 3/3 passed, zero leaks;
  • Home audit: 179/431 implemented, 252 pending;
  • Bun core audit: 173/421 implemented, 248 pending;
  • real combined consumer fixture: 178/178 linked and runtime-exercised;
  • public classification audit: 117/117 public, 19 extensions, 183 private/support exports.

The tests force full collection inside a marked-buffer callback, verify callback-extent root cleanup and cross-VM rejection, and cover per-realm CommonJS append/set/swap-remove indices, replacement, removal, VM isolation, invalid inputs, and first-pending-exception preservation. README.md and all ABI/API/Home docs publish the new counts and semantics.

Sign in to comment on this issue.