-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
add component-model-async/lift.wast test #10083
Conversation
f15cf87
to
0b43dd5
Compare
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "fuzzing", "wasmtime:api", "wasmtime:config"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
To modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely pretty far out of my comfort zone reviewing this in the sense that there's enough pieces that I don't see how they're connected just in this PR that I'm not confident I have the ability to review without going over to the spec. At a high level the test added here seems like it probably doesn't require the lift/lower impls, but then again I suspect that removing those impls would remove all the meat of the PR. Would it be possible to add some tests exercising the impls added here in this PR?
@@ -672,3 +672,158 @@ pub mod bindgen_examples; | |||
#[cfg(not(any(docsrs, test, doctest)))] | |||
#[doc(hidden)] | |||
pub mod bindgen_examples {} | |||
|
|||
#[cfg(not(feature = "component-model-async"))] | |||
pub(crate) mod concurrent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To confirm, this'll eventually be a concurrent.rs
in a future PR? So just a placeholder for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
concurrent.rs
is already in main and was added in #10044 (and will be expanded in subsequent PRs). This is the stub module to be used when the component-model-async
feature is disabled, so it will only go away when that feature is removed.
Alternatively, I could remove this stub module and make concurrent.rs
the only implementation, but that would mean adding more #[cfg(...)]
annotations elsewhere, so it's kind of a tradeoff. Happy to do whichever you think is best, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, sorry I missed the not(...)
!
I'll take a closer look in a future PR to see how it fits together 👍
crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
Outdated
Show resolved
Hide resolved
crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
Outdated
Show resolved
Hide resolved
|
||
/// Represents the readable end of a Component Model `future`. | ||
pub struct FutureReader<T> { | ||
rep: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding some comments as to what this rep
is? My naive understanding of component model async is probably showing here but I'm familiar with "rep" of a resource where it's user-supplied but I didn't think that there was anything user-supplied here but rather this is an index to something (but I'm not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have the terminology mixed up myself, but I've been using "rep" to mean "the instance-agnostic index for the waitable" which used to look up the state of the stream/future/task in a table (which will be added in a later PR), akin to the ResourceTable
index for resources. When lifting and lowering we convert between that index and a per-instance local index visible to the guest.
If there's a more conventional way to refer to these "global" and "local" indexes, I'm happy to adopt it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something like rep: WaitableIndex
? Basically using a type here to indicate more clearly what it's pointing to. My history with resources makes me think that "rep" comes from guests themselves and needs to be preserved and handed back to the guest but I don't think that's what's going on here, so this isn't so much a "representation" internally but moreso an index somewhere else, which is where I think a custom newtype might help to distinguish
crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
Outdated
Show resolved
Hide resolved
/// Represents the state associated with an error context | ||
#[derive(Debug, PartialEq, Eq, PartialOrd)] | ||
pub struct ErrorContextState { | ||
/// Debug message associated with the error context | ||
pub(crate) debug_msg: String, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be one part about error-context I don't understand b/c I think I'm missing where this is used...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is being used yet; again, I may have copied over more than necessary from the Big PR.
0b43dd5
to
f6fc8d0
Compare
@alexcrichton I've "rebooted" this PR from scratch, this time only pulling in the minimum code needed for the As a consequence, most of your review comments no longer apply, but I'll address them in future PRs. Sorry for the churn; I'll try to keep future PRs more focused. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
f6fc8d0
to
0eae83f
Compare
This is another piece of bytecodealliance#9582 which I'm splitting out to make review easier. This test includes two components: one which exports a function using the async-with-callback ABI, and another which uses the async-without-callback ABI. It doesn't actually instantiate or run either component yet. The rest of the changes fill in some TODOs to make the test pass. Signed-off-by: Joel Dice <[email protected]>
0eae83f
to
167e590
Compare
This is another piece of #9582 which I'm splitting out to make review easier.
This test includes two components: one which exports a function using the async-with-callback ABI, and another which uses the async-without-callback ABI. It doesn't actually instantiate or run either component yet.
The rest of the changes fill in some TODOs to make the test pass.