Skip to content

Wasm: feed Response chunks directly into StreamingCompiler #410

Description

@chrisbbreuer

Parent: #406
Depends on: #407, #409
Related: #408
Profiles: #141, #142, #163, #164
Roadmap: #134

Wire the engine-native Fetch Body reader directly to the owned Wasm StreamingCompiler lifecycle. The standard Web API remains observationally equivalent either way, but #406 explicitly requires real per-chunk feeding rather than a post-EOF aggregate handoff.

Scope

  • Add an internal ReadableStream byte-consumer sink that receives each normalized chunk in pull order without invoking user code under engine, GC, or compiler locks.
  • Create and root one VM-owned StreamingCompiler lifecycle before the first body pull; feed every string/BufferSource chunk exactly once and finalize exactly once at EOF.
  • Preserve bodyUsed, locking, cancellation, abrupt pull, detached/out-of-bounds views, invalid chunks, zero-length chunks, overflow, allocation failure, and early compiler failure.
  • Release the compiler deterministically on source rejection, cancellation, context teardown, outer-Promise abandonment, and every setup/finalization failure.
  • Queue the existing ordinary compile/instantiate jobs from the finalized bytes with identical feature selection, diagnostics, imports, result shapes, and realm ownership.
  • Prove multi-chunk equivalence for representative MVP, SIMD, threads, exceptions, memory64, GC, and Core 3 modules without rerunning complete corpora.
  • Add focused Debug, ReleaseSafe, TSan, GC-relocation, sibling-realm, and external Home/Bun lifecycle evidence.
  • Refresh the pinned contracts, concise README/docs, Wasm: implement streaming compilation and private compiler feed #406, Conformance: promote PR-249 WebAssembly, JIT, and shell hooks #143, and Roadmap: implement every README-declared missing runtime surface #134; close only after exact fixing-main CI is green.

This issue is complete only when the compiler feed observes the actual Response chunk sequence before EOF; a byte-dropping sink or a single post-consumption aggregate add is not sufficient.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions