Remove cancellable immediate from built-ins, relax subtask.cancel switching rules - #716
Open
lukewagner wants to merge 1 commit into
Open
Remove cancellable immediate from built-ins, relax subtask.cancel switching rules#716lukewagner wants to merge 1 commit into
cancellable immediate from built-ins, relax subtask.cancel switching rules#716lukewagner wants to merge 1 commit into
Conversation
alexcrichton
approved these changes
Aug 31, 2026
This was referenced Aug 31, 2026
Merged
Collaborator
|
Also, to confirm, with this change when using the stackful ABI there's no way to receive cancellation, right? EDIT: which I understand is a temporary state of affairs and stackful is gated, just want to confirm the expected fallout |
Member
Author
|
@alexcrichton Yep, right! |
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Aug 31, 2026
This commit is an implementation of WebAssembly/component-model#716 for wasmtime where the main fallout is in tests. This isn't expected to affect anything in practice as there's no known usage of this immediate at this time.
lukewagner
force-pushed
the
rm-cancellable
branch
from
August 31, 2026 23:27
1fbe350 to
a3d46c1
Compare
sauliusbc
pushed a commit
to SavantEnvs/wasm-tools
that referenced
this pull request
Sep 1, 2026
…odealliance#2630) This follows the spec update in WebAssembly/component-model#716 where the behavior here isn't quite working and it's not known to be used anywhere. This leaves the binary format encoding to avoid breaking that to avoid actually breaking anything in practice.
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.
Currently, the
cancellableimmediates of thethread.*andwaitable-set.*built-ins aren't emitted by producer toolchains. Also, although not released yet, the currently-specified/implemented behavior of the newthread.{suspend,yield}-then-{resume,promote}built-ins is a bit broken (the single1return code conflates 3 different cases guest code probably needs to distinguish: cancelled-before-switch, resumed-because-cancelled, cancelled-after-readied). Rather than fix/test these un-exercised paths, I think it'd be better to just removecancellablefor now and add it back once we need it to enable the "stackful" async ABI (🚟). (I'm also starting to think, when we do need to re-add it, there may be a better design than acancellableimmediate.)To avoid breaking any existing code (none of which uses
cancellable), the PR removescancellablefrom the text format, but keeps thecancellableimmediate in the binary format and just requires it to always be0.Lastly, this PR relaxes the rules for how
subtask.cancelresumes the cancelled callee: instead of forcing at-most-1 switch from caller-to-callee-to-caller, the PR replaces this with a plainthread.yieldwhich allows the host to nondeterministically switch to whoever before determining thatsubtask.cancelblocked. This allows the host to do smarter scheduling (in a way that matches what we allow elsewhere) but also, combined withcancellable-removal, significantly simplifies the rules for cancellation, making them rather easier to understand IMO. See CanonicalABI.md#-canon-subtaskcancel for more details.The PR updates the tests to not use the
cancellablecancellable immediate or expect the relaxed behavior ofsubtask.cancel, all of which passes on Wasmtime today. The only new test that fails in this PR is the simple binary validation tests intest/binary/binary.wast.