Skip to content

Commit f99c826

Browse files
authored
[Stack Switching] Support cross-module coroutine calls in the interpreter (#7797)
Key changes: * In ContData, store a function Literal, not a name. The literal, same as used for function references since #7787, contains logic for cross-module calls. * Store continuation state in a shared location between module instances. We need a single stack of active continuations, and a single bit that says if we are resuming - that should not change when we call into a module. * When we resume, we use doCall, like CallRef does, to support cross-module calls. self()->currContinuation is now generalized to use getCurrContinuation(), which fetches it from the shared data. There is also a new clearExecutionState() which is needed to wipe the stack after a trap etc. With this, the large "scheduler" testcase can now run.
1 parent bf564b5 commit f99c826

3 files changed

Lines changed: 327 additions & 57 deletions

File tree

src/tools/wasm-shell.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ struct Shell {
232232
WASM_UNREACHABLE("unexpected error");
233233
}
234234
if (flow.suspendTag) {
235+
// This is an unhandled suspension. Handle it here - clear the
236+
// suspension state - so nothing else is affected.
237+
instance->clearContinuationStore();
235238
return SuspensionResult{};
236239
}
237240
return flow.values;

0 commit comments

Comments
 (0)