Stack Switching in WebAssembly with Effect Handlers
summary
Proposes a Wasm extension, WasmFX, that models stacks as continuations and adds three core instructions to create, suspend and resume them. Provides a formal spec plus a reference implementation on the Wasm reference interpreter and partial work in Wasmtime (resume_throw and barrier not yet landed). Uses typed continuations and restricts to one-shot continuations for linearity. Demonstrations include yield-style generators that compute 55, a BFS lightweight-thread scheduler that interleaves 0 1 2 3, and a cancellation pattern via resume_throw; examples run successfully on the reference impl.
AI-written summary · about
chapters (10)
- 0:00Stack switching intro
- 1:08Motivation for effect handlers
- 6:23Effect handlers vs alternatives
- 8:50Effects instruction set
- 15:26Proposal status and implementations
- 16:08Example: Yield generators
- 24:37Example: Lightweight threads
- 33:27Design power and expressiveness
- 41:34Resources and closing
- 41:55Q&A
related talks
18mContinuing WebAssembly with Effect Handlers
22mContinuing Stack Switching in Wasmtime
23mExperience Report: Stack Switching in Wasm SpecTec
19mIris-WasmFX: Modular Reasoning for Wasm Stack Switching
43mMeet Your Future - WebAssembly
17mWasm/k: Delimited Continuations for WebAssembly
37mBridging the Architecture Divide: How Hardware Limits Wasm, and How We Can Do Better
24mA Big-Step Compositional Continuation-Passing Semantics for WebAssembly
