Continuing Stack Switching in Wasmtime
summary
Implements the WebAssembly stack switching proposal in Wasmtime by prototyping with the existing Wasmtime-fiber hand‑written assembly library and runtime FFI calls, then adding a new cranelift instruction that encodes platform‑independent control contexts so generated code performs the switch directly. Development followed prototype → parallel design and incremental replacement → optimized implementation, with an upstream PR pending. Microbenchmarks show a surprising 6x improvement on a hot suspend/resume loop after removing the FFI call overhead.
AI-written summary · about
chapters (10)
- 0:00Stack switching in Wasmtime
- 1:28Stack switching proposal overview
- 3:15Asymmetric vs symmetric stacks
- 6:06Implementation challenges
- 9:38Prototype with fibers and libcalls
- 12:06Optimized stack switch instruction
- 15:19Benchmarking performance
- 16:48Incremental optimization
- 18:14Upstreaming and final steps
- 18:34Q&A on CPU prediction
related talks
47mStack Switching in WebAssembly with Effect Handlers
18mContinuing WebAssembly with Effect Handlers
37mBridging the Architecture Divide: How Hardware Limits Wasm, and How We Can Do Better
40mSmarter Operating Systems Will Use Wasm - The Coming OS Revolution
43mMeet Your Future - WebAssembly
17mWaltzz: WebAssembly Runtime Fuzzing with Stack-Invariant Transformation
45mWasmer Things: An Upside-Down Guide to WebAssembly
30mA WASM Runtime for FaaS Protected by TEE
