ReviewOS

zig-utils/zig-js

ABI: implement lifetime-safe Wasm StreamingCompiler feed

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

Parent: #406 Profiles: #163, #164 Related: #140, #143, #408 Roadmap: #134

Implement the pinned Home/Bun JSC__Wasm__StreamingCompiler__addBytes boundary against the same compiler lifecycle used by the JavaScript streaming APIs.

Scope

  • Pin exact Home/Bun/JSC sources and signatures in a checked-in contract.
  • Register never-dereferenced opaque compiler tokens per VM and reject null, stale, foreign, and finalized lifecycle operations without touching arbitrary memory.
  • Append non-null byte spans in order with overflow and allocation-failure atomicity; define zero-length behavior exactly.
  • Make finalization and teardown idempotent, race-safe, and free of cross-VM contamination or use-after-free.
  • Add external Home/Bun compiled consumers in Debug, ReleaseSafe, and TSan.
  • Refresh both private inventories, ABI docs, concise README counts, and roadmap evidence.
  • Close only after exact fixing-main CI is green.
9 days ago

Implemented and pushed directly to main in 1174cbe7 and 0cc83217.

The exact void Home/Bun symbol now accepts only registry tokens that are never dereferenced or reused. The zig-js create/finalize/release extensions expose VM ownership and deterministic status without changing the pinned symbol. Ordered and concurrent spans, zero length, null bytes, sticky overflow/OOM state, finalization, same-VM siblings, foreign VMs, stale/forged handles, explicit release, and teardown racing a feed are covered. The JavaScript streaming API now creates, feeds, finalizes, and releases the same lifecycle before queueing its ordinary compiler job.

Both external Home and Bun fixtures pass Debug, ReleaseSafe, and TSan. The JavaScript streaming filter passes ReleaseSafe and TSan 3/3 with zero leaks; private auditors, validator unit tests, and the 117/117 public C/C++ header gate are green. Inventories are Home 440/471 and Bun 431/461. Awaiting exact 0cc83217 main private-abi-boundary CI before closure.

9 days ago

Exact fixing-main CI is green, including the complete private-ABI boundary: https://github.com/zig-utils/zig-js/actions/runs/29785272707/job/88495394827

Sign in to comment on this issue.