Skip to content

[Stack Switching] Improve cont.bind fuzzing#8500

Open
kripken wants to merge 15 commits intoWebAssembly:mainfrom
kripken:cont.bind.fuzz
Open

[Stack Switching] Improve cont.bind fuzzing#8500
kripken wants to merge 15 commits intoWebAssembly:mainfrom
kripken:cont.bind.fuzz

Conversation

@kripken
Copy link
Member

@kripken kripken commented Mar 19, 2026

  • Pick a signature from the known interesting types.
  • Pick a continuation type using that signature.

@kripken kripken requested a review from tlively March 19, 2026 23:52
@kripken kripken requested a review from a team as a code owner March 19, 2026 23:52
auto newCont = Continuation(newSig);
auto newType = Type(newCont, NonNullable, Exact);
std::vector<Expression*> newArgs{make(newParam)};
auto numOldParams = sig.params.size();
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be numNewParams, since it's the number of parameters of the new continuation cont.bind creates? Maybe "input" and "output" would be clearer than "new" and "old."

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good, renamed to input/output.

Comment on lines +5474 to +5477
if (pickedSig.results != sig.results) {
// Results must match.
continue;
}
Copy link
Member

Choose a reason for hiding this comment

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

WDYT about filtering out impossible signatures before picking? We could memoize the results to avoid pathological repeated work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, and probably fast enough without memoizing. Done.

auto numAddedParams = numNewParams - numOldParams;
bool bad = false;
for (Index i = 0; i < numOldParams; i++) {
if (pickedSig.params[numAddedParams + i] != sig.params[i]) {
Copy link
Member

Choose a reason for hiding this comment

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

This should allow for subtyping in one direction or the other. The params of the output signature should be subtypes of the corresponding params of the input signature.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

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