ReviewOS

zig-utils/zig-js

Wasm: add compileStreaming and instantiateStreaming

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

Parent: #406 Related: #141, #142, #143, #407, #409 Roadmap: #134

Implement the standard JavaScript streaming compilation APIs over genuine Fetch Body streams and the existing WebAssembly parser, validator, compiler, and feature profiles.

Scope

  • Implement realm-local WebAssembly.compileStreaming and WebAssembly.instantiateStreaming with standard lengths and property attributes.
  • Assimilate Response Promises and thenables exactly, including abrupt getters/calls and rejection identity.
  • Validate Response brand, success status, exact application/wasm MIME type, bodyUsed, and locked body before compilation.
  • Preserve compile/link/runtime error classes, imports, result shapes, sibling realms, and cancellation.
  • Consume ordered chunks through Fetch Body, take a stable owned snapshot, and enter the existing compiler once; the unobservable incremental private feed is tracked by #409.
  • Prove ordinary-vs-streaming equivalence by dispatching the exact ordinary compile/instantiate jobs and pinning all ten declared feature profiles in the audited contract.
  • Close only after exact fixing-main CI is green.
9 days ago

Implemented and pushed directly to main in ea64275b and e457d0b9.

Evidence now covers split asynchronous chunks, Response/thenable assimilation, imports and result shapes, exact CompileError/LinkError/TypeError behavior, MIME parameters, status, locked/disturbed bodies, abrupt pull and rejection identity, same-VM sibling realms, and intrinsic Promise ordering. The implementation takes the specification-required stable body snapshot and queues the exact ordinary compiler/instantiator jobs; true incremental private feeding remains #409.

Focused local gates are green in Debug, ReleaseSafe, and TSan: 3/3 passed, 0 skipped, 0 failed, 0 leaked in every mode. Home and Bun private-ABI audits plus their validator unit tests are green. Awaiting the exact e457d0b9 main private-abi-boundary job 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.