Update some async intrinsic signatures#2116
Merged
alexcrichton merged 3 commits intobytecodealliance:mainfrom Mar 31, 2025
Merged
Update some async intrinsic signatures#2116alexcrichton merged 3 commits intobytecodealliance:mainfrom
alexcrichton merged 3 commits intobytecodealliance:mainfrom
Conversation
* `future.new` - takes a pointer parameter instead of returning a
result.
* `future.close-{readable,writable}` - drop the `error-context` argument
second field.
Member
Author
|
This is intended to encompass upstream issues such as WebAssembly/component-model#474 and WebAssembly/component-model#475. Not complete as more changes may be necessary. I hope to add intrinsics for task cancellation soon to. Nevertheless I'm using this in my wit-bindgen refactor. cc @dicej |
alexcrichton
commented
Mar 29, 2025
Member
Author
alexcrichton
left a comment
There was a problem hiding this comment.
Ok I think this is good to go @dicej, just some minor changes here and I'll follow-up later with task cancellation intrinsics in a future PR.
Comment on lines
-195
to
+201
| (import {module:?} "[future-new-{i}]{name}" (func (result i32))) | ||
| (import {module:?} "[future-new-{i}]{name}" (func (result i64))) | ||
| (import {module:?} "[future-read-{i}]{name}" (func (param i32 i32) (result i32))) | ||
| (import {module:?} "[future-write-{i}]{name}" (func (param i32 i32) (result i32))) | ||
| (import {module:?} "[future-cancel-read-{i}]{name}" (func (param i32) (result i32))) | ||
| (import {module:?} "[future-cancel-write-{i}]{name}" (func (param i32) (result i32))) | ||
| (import {module:?} "[future-close-readable-{i}]{name}" (func (param i32 i32))) | ||
| (import {module:?} "[future-close-writable-{i}]{name}" (func (param i32 i32))) | ||
| (import {module:?} "[future-close-readable-{i}]{name}" (func (param i32))) | ||
| (import {module:?} "[future-close-writable-{i}]{name}" (func (param i32))) |
Member
Author
There was a problem hiding this comment.
This is a basic summary of the changes here, notably:
{future,stream}.newintrinsics return a two 32-bit handles as a result packed into a 64-bit integer. It kind of sucks we don't have multi-value and I also didn't want to go the route of adding canonopts to these intrinsics just to write values into memory. It's a bit wonky since bit packing doesn't happen anywhere else in the canonical ABI but it happens in other async intrinsics so maybe ok?- For
{future,stream}.close-{readable,writable}the only change is to drop the error-context parameter.
dicej
approved these changes
Mar 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
future.new- returns a 64-bit value instead of a 32-bit valuefuture.close-{readable,writable}- drop theerror-contextargument second field.