[Stack Switching] Improve cont.bind fuzzing#8500
[Stack Switching] Improve cont.bind fuzzing#8500kripken wants to merge 15 commits intoWebAssembly:mainfrom
Conversation
kripken
commented
Mar 19, 2026
- Pick a signature from the known interesting types.
- Pick a continuation type using that signature.
src/tools/fuzzing/fuzzing.cpp
Outdated
| auto newCont = Continuation(newSig); | ||
| auto newType = Type(newCont, NonNullable, Exact); | ||
| std::vector<Expression*> newArgs{make(newParam)}; | ||
| auto numOldParams = sig.params.size(); |
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
Sounds good, renamed to input/output.
src/tools/fuzzing/fuzzing.cpp
Outdated
| if (pickedSig.results != sig.results) { | ||
| // Results must match. | ||
| continue; | ||
| } |
There was a problem hiding this comment.
WDYT about filtering out impossible signatures before picking? We could memoize the results to avoid pathological repeated work.
There was a problem hiding this comment.
Good idea, and probably fast enough without memoizing. Done.
src/tools/fuzzing/fuzzing.cpp
Outdated
| auto numAddedParams = numNewParams - numOldParams; | ||
| bool bad = false; | ||
| for (Index i = 0; i < numOldParams; i++) { | ||
| if (pickedSig.params[numAddedParams + i] != sig.params[i]) { |
There was a problem hiding this comment.
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.