[Stack Switching] Generate continuation types in the fuzzer, and cont.bind to test them#8486
[Stack Switching] Generate continuation types in the fuzzer, and cont.bind to test them#8486kripken merged 26 commits intoWebAssembly:mainfrom
Conversation
| newParams.insert(newParams.begin(), newParam); | ||
| auto newSig = Signature(Type(newParams), sig.results); | ||
| auto newCont = Continuation(newSig); | ||
| auto newType = Type(newCont, NonNullable, Exact); |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Agreed to all, I just wanted to leave those for followups, and keep this PR focused on generating the types.
| 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; | ||
| } |
There was a problem hiding this comment.
Do we care that this is not used anywhere yet? LGTM either way.
There was a problem hiding this comment.
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>
cont.bindis the simplest way by far to test them, and this just uses itin the simplest way so far.