Skip to content

[Stack Switching] Generate continuation types in the fuzzer, and cont.bind to test them#8486

Merged
kripken merged 26 commits intoWebAssembly:mainfrom
kripken:fuzz.cont
Mar 18, 2026
Merged

[Stack Switching] Generate continuation types in the fuzzer, and cont.bind to test them#8486
kripken merged 26 commits intoWebAssembly:mainfrom
kripken:fuzz.cont

Conversation

@kripken
Copy link
Member

@kripken kripken commented Mar 18, 2026

cont.bind is the simplest way by far to test them, and this just uses it
in the simplest way so far.

@kripken kripken requested a review from tlively March 18, 2026 18:14
Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

newParams.insert(newParams.begin(), newParam);
auto newSig = Signature(Type(newParams), sig.results);
auto newCont = Continuation(newSig);
auto newType = Type(newCont, NonNullable, Exact);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to create a new continuation heap type that probably won't be used anywhere else! That's fine, but I think the TODO to look at interestingHeapTypes is important. Ideally we would also add logic to the heap type fuzzer to bias toward creating extensions of existing continuation types for use with cont.bind.

We can also occasionally generate no-op* cont.binds that bind zero arguments, just for the fuzzer coverage.

*not actually a no-op when traps might happen, since it has the side effect of making the previous references unusable!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed to all, I just wanted to leave those for followups, and keep this PR focused on generating the types.

Comment on lines +1353 to +1367
template<typename T>
Resume* makeResume(const std::vector<Name>& handlerTags,
const std::vector<Name>& handlerBlocks,
const std::vector<Type>& sentTypes,
ExpressionList& operands,
Expression* cont) {
auto* ret = wasm.allocator.alloc<Resume>();
ret->handlerTags.set(handlerTags);
ret->handlerBlocks.set(handlerBlocks);
ret->sentTypes.set(sentTypes);
ret->operands.set(operands);
ret->cont = cont;
ret->finalize();
return ret;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care that this is not used anywhere yet? LGTM either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw that both of them were missing it, and added it here. It'll be tested later.

Co-authored-by: Thomas Lively <tlively123@gmail.com>
@kripken kripken merged commit fae74dc into WebAssembly:main Mar 18, 2026
16 checks passed
@kripken kripken deleted the fuzz.cont branch March 18, 2026 22:39
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.

2 participants