Skip to content

feat: add stream.{splice,forward} canon builtins - #2614

Draft
rvolosatovs wants to merge 2 commits into
bytecodealliance:mainfrom
rvolosatovs:feat/stream-forward
Draft

feat: add stream.{splice,forward} canon builtins#2614
rvolosatovs wants to merge 2 commits into
bytecodealliance:mainfrom
rvolosatovs:feat/stream-forward

Conversation

@rvolosatovs

@rvolosatovs rvolosatovs commented Aug 20, 2026

Copy link
Copy Markdown
Member

Add support for stream.{splice,forward} builtins as defined in WebAssembly/component-model#658 (spec PR coming soon)

@rvolosatovs rvolosatovs changed the title feat: add stream.forward canon builtin feat: add stream.splice canon builtin Aug 21, 2026
Implement parsing, validation, encoding, and printing support for the
`stream.splice` built-in sketched in WebAssembly/component-model#658:

    (canon stream.splice $streamT async? (core func $f))

where `$f` has type `(func (param i32 i32 i32) (result i32))`, taking a
readable stream end, a writable stream end, and a maximum number of
elements to forward.  The binary encoding uses the currently-unassigned
opcode 0x2e, and validation gates the built-in behind the component
model async and "more async builtins" features since it is not yet part
of the Component Model specification.

Assisted-by: claude:claude-fable-5
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
@rvolosatovs rvolosatovs changed the title feat: add stream.splice canon builtin feat: add stream.{splice,forward} canon builtins Aug 21, 2026
Implement parsing, validation, encoding, and printing support for the
`stream.forward` built-in specified alongside `stream.splice` in
WebAssembly/component-model#658:

    (canon stream.forward $streamT (core func $f))

where `$f` has type `(func (param i32 i32))`, taking a readable stream
end and a writable stream end.  Unlike `stream.splice`, which borrows
both ends and reports the outcome back to the caller, `stream.forward`
transfers both ends out of the calling instance and returns immediately
with no result, so it takes neither a `n` parameter nor an `async`
immediate.  Like `stream.splice` it takes no `canonopt`s, since no
elements pass through the caller's linear memory.

The binary encoding uses the currently-unassigned opcode 0x2f, and
validation gates the built-in behind the component model async and
"more async builtins" features since it is not yet part of the
Component Model specification.

Assisted-by: claude:claude-fable-5
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant