dicej edited PR #10106.
dicej edited PR #10106:
This is another piece of #9582 which I'm splitting out to make review easier.
The fused.wast test exercises fused adapter generation for various flavors of
intercomponent async->async, async->sync, and sync->async calls.The futures.wast and streams.wast tests exercise the various intrinsics
(e.g.stream.read
,future.close_writable
, etc.) involvingfuture
s and
stream
s.The remaining changes fill in some TODOs to make the tests pass, plus plumbing
for a few intrinsics which aren't needed for these tests but which set the
foundation for future tests.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
dicej submitted PR review.
dicej created PR review comment:
I've reworked this code and added clarifying comments.
dicej submitted PR review.
dicej created PR review comment:
I've refactored the code to no longer use global variables to stash params and results, so this code no longer exists.
dicej submitted PR review.
dicej created PR review comment:
This code no longer exists, so marking this resolved.
dicej submitted PR review.
dicej created PR review comment:
TIL about declarative element segments. I've added a TODO comment.
dicej submitted PR review.
dicej created PR review comment:
I've refactored this to avoid using globals, and have added explanatory comments to the new code.
dicej submitted PR review.
dicej created PR review comment:
I've added doc comments to
fact.rs
to describe the purpose of these intrinsics. Let me know if they need more work.
dicej submitted PR review.
dicej created PR review comment:
The globals are gone :tada:
dicej submitted PR review.
dicej created PR review comment:
The globals are gone, and I've added a bunch of comments; let me know if further clarification is needed.
@alexcrichton I've rebooted this PR based on the latest code in the
wasip3-prototyping
repo. There are lot more comments in the fused adapter code now; let me know if more are needed or the existing ones are unclear.This PR now includes two more tests (
streams.wast
andfutures.wast
) and thewasmtime-cranelift
andwasmtime-environ
intrinsic plumbing needed to make them pass. All the intrinsics follow the same pattern, and the Cranelift codegen for them share a lot of code, so I figure putting them all in a single PR might be easiest. Let me know if it's too much.
github-actions[bot] commented on PR #10106:
Subscribe to Label Action
cc @fitzgen
<details>
This issue or pull request has been labeled: "fuzzing", "wasmtime:api"Thus the following users have been cc'd because of the following labels:
- fitzgen: fuzzing
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
alexcrichton submitted PR review:
Thanks for adding these comments!
alexcrichton created PR review comment:
Mind tagging this with #10143?
alexcrichton created PR review comment:
I think this could return
&CanonicalAbiInfo::ZERO
here
alexcrichton created PR review comment:
Would it be possible to avoid the
.clone()
and return the&CanonicalAbiInfo
here with the change above?
alexcrichton created PR review comment:
To avoid a possible mismatch where this doesn't actually match teh value of
call
below, could the results of the call be introspected with Cranelift APIs to learn the type?
alexcrichton created PR review comment:
Mind documenting this parameter above? (perhaps documenting that it's currently-unused but soon-to-be-used as well)
alexcrichton created PR review comment:
Mind adding a comment here clarifying that this is just an optimization and it's always valid to return
None
here?
alexcrichton created PR review comment:
How come Send popped up here and Send/Sync above?
alexcrichton created PR review comment:
Or, somewhat alternatively, I'm a bit uneasy having the return type imply the meaning of the value of the return in terms of whether it traps or not. Another option would be to thread around
TrapSentinel
perhaps? (or something akin to that)
alexcrichton created PR review comment:
While you're here mind extracting this
fn(...) -> ...
signature to something liketype GetLibcallFn = fn(...) -> ...
and replacing the signatures throughout this file withget_libcall: GetLibcallFn
?
alexcrichton created PR review comment:
If you can comment pointing to a location in the fact trampoline bits to where these constants come from (and vice versa ideally) that'd be good to keep the two in sync. (and/or extracting this to constants or similar)
alexcrichton created PR review comment:
Similar to down below handling these canonical ABI arguments I think would be good to have as helper functions
alexcrichton created PR review comment:
Processing/loading these two values is done here and a few times below, mind extracting them to a helper?
dicej submitted PR review.
dicej created PR review comment:
Would you mind sketching out how to introspect the result type from the Cranelift APIs? The surface area is pretty huge, and I'm not sure what to search for.
Thanks for the review, @alexcrichton! I'll address your feedback first thing tomorrow.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
You'll want
value_type
the method, like this -- https://github.com/bytecodealliance/wasmtime/blob/132a490d72e6381c593a409aeca50a765b54ca28/crates/cranelift/src/translate/table.rs#L66 (there's a number of hits you can explore throughoutcrates/cranelift
too, this is just a random one)
dicej submitted PR review.
dicej created PR review comment:
Yes, I was able to do this, but I ended up needing to clone it at the call site anyway to avoid conflicting borrows of
self
(which perhaps could be resolved via some kind of split borrow approach with heavy refactoring, but doesn't seem worth it in this case).
dicej submitted PR review.
dicej created PR review comment:
I'll revert the changes to this file; they're not needed (yet).
dicej updated PR #10106.
dicej has enabled auto merge for PR #10106.
dicej merged PR #10106.
FrankReh submitted PR review.
FrankReh created PR review comment:
"will block"
FrankReh submitted PR review.
FrankReh created PR review comment:
to be exported to the host which host to lift the parameters ... maybe correct but I didn't know how to parse that part of the sentence.
FrankReh submitted PR review.
FrankReh created PR review comment:
the the
FrankReh submitted PR review.
FrankReh created PR review comment:
exported to the host which host to lift ... apologies if this makes sense to folks more in the know, maybe just hard for me to decipher
Last updated: Apr 17 2025 at 07:03 UTC