Skip to content
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

Synchronize some component model intrinsics with the spec #2065

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alexcrichton
Copy link
Member

This commit goes through a few component model intrinsics and
synchronizes them with the current specification, mainly centered around
async intrinsics. This doesn't synchronize all of them but is at least a
start. Changes here include:

  • Support for resource.drop async intrinsics.
  • Renaming task.backpressure to backpressure.set.
  • Adding canonical ABI options to task.return.
  • A number of refactorings to simplify some constructs, reduce
    duplication, etc.

The validation of task.return has been updated to take
WebAssembly/component-model#453 into account with the new set of options
that are allowed on it. Additionally wit-component was updated to set
options for task.return in the same manner as the canon lift'd
function on the other end.

Simplify some callers/accessors by plumbing around this whole structure
instead of having some intrinsics just have portions where others have more.
Refactor some internals of async stream/future read/write and
`task.return` to avoid passing `Function` and instead just pass then
name around.
Don't so heavily nest the variables here indentation-wise.
This commit refactors the integration of async intrinsics into
wit-component to support future changes to the `task.return` intrinsic.
The refactoring here moves detection of intrinsics to all be in the same
path rather than having one path which handles async intrinsics, another
patch which handles resource intrinsics, and another path which handles
`task.return` intrinsics. By handling everything in one location it's
easier to ensure that everything is handled uniformly and various bits
and pieces of contextual information are also easily available.

This refactoring additionally updates the names recognized for async
intrinsics. Previously for example async imports might use
`[import-payload]` which is now no longer required. Additionally async
imports might use `[export-payload]` too and that's changed to be
`[export]` to match how other exports are handled as well.
This commit goes through a few component model intrinsics and
synchronizes them with the current specification, mainly centered around
async intrinsics. This doesn't synchronize all of them but is at least a
start. Changes here include:

* Support for `resource.drop async` intrinsics.
* Renaming `task.backpressure` to `backpressure.set`.
* Adding canonical ABI options to `task.return`.
* A number of refactorings to simplify some constructs, reduce
  duplication, etc.

The validation of `task.return` has been updated to take
WebAssembly/component-model#453 into account with the new set of options
that are allowed on it. Additionally `wit-component` was updated to set
options for `task.return` in the same manner as the `canon lift`'d
function on the other end.
@alexcrichton alexcrichton requested a review from dicej February 22, 2025 00:38
@alexcrichton
Copy link
Member Author

I'll note that this is based on #2064, so only the last commit is exclusive to the PR (at this time)

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