Skip to content

update future.{write,read} ABIs #1313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

dicej
Copy link
Collaborator

@dicej dicej commented Jun 6, 2025

This updates the Rust generator to use the new ABI defined in WebAssembly/component-model#524. The C generator will need a similar update as well.

  • future.write now accepts its payload value as up to 4 flat parameters before spilling to linear memory.

  • future.read takes no payload pointer when it has no payload type

  • {stream,future}.close-{readable,writable} have been renamed to {stream,future}.drop-{readable,writable}

I've tested this end-to-end with wasip3-prototyping and will soon post a corresponding PR there.

Finally, rustfmt was complaining about using gen as a field name, so I took this opportunity to address that.

This updates the Rust generator to use the new ABI defined in
WebAssembly/component-model#524.  The C generator will
need a similar update as well.

- `future.write` now accepts its payload value as up to 4 flat parameters before spilling to linear memory.

- `future.read` takes no payload pointer when it has no payload type

- `{stream,future}.close-{readable,writable}` have been renamed to `{stream,future}.drop-{readable,writable}`

I've tested this end-to-end with `wasip3-prototyping` and will soon post a
corresponding PR there.

Finally, `rustfmt` was complaining about using `gen` as a field name, so I took
this opportunity to address that.

Signed-off-by: Joel Dice <[email protected]>
@dicej
Copy link
Collaborator Author

dicej commented Jun 6, 2025

I should note that this doesn't cover all of WebAssembly/component-model#524. Specifically, these items will need work (presumably just runtime test updates in this repo once wasip3-prototyping has been updated):

  • There is no "number of elements written" packed in the high 28 bits of the future.{read,write} results.
  • On successful copy, future.{read,write} return COMPLETED instead of CLOSED (which, as noted above, was renamed to DROPPED, making it especially "wrong" as the result code).

@dicej dicej force-pushed the new-future-abi branch from b21a41c to 060520a Compare June 6, 2025 20:24
@dicej
Copy link
Collaborator Author

dicej commented Jun 6, 2025

Alex, Luke, and I just discussed this and decided we're going to scale back these changes given how big they turned out to be implementation-wise. I'm going to close this and open a new one next week.

@dicej dicej closed this Jun 6, 2025
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