3 ms·
Are jumps unrestricted or block only? ISTR in the first draft of WASM it was impossible to write continuation-passing code, coroutines, or even tail call.
by gumby 3y ago
Are jumps unrestricted or block only? ISTR in the first draft of WASM it was impossible to write continuation-passing code, coroutines, or even tail call.
- cornstalks 3y agoBlock only. There’s a tail call proposal[1] that’s in phase 4 (nearly standardized). [1]: https://github.com/WebAssembly/proposals https://github.com/WebAssembly/proposals
- azakai 3y agoNote that phase 4 is the final stage of the standard process. Tail calls are at phase 4, which means that is a finalized and complete standard. All that is left after that is for VMs to implement the standard, which is tracked here: https://webassembly.org/features/ https://webassembly.org/features/ Most major VMs do support tail calls today, but not all.
- sestep 3y agoAlso note that that webpage can be somewhat out of date; for instance, see here for some recent edits to it (e.g. features Node had implemented that were marked as unavailable): https://github.com/WebAssembly/website/commits/main/ https://github.com/WebAssembly/website/commits/main/
- marianoguerra 3y agoThere's a proposal for effect handlers that allows for continuatios, coroutines and others. > effect handlers as a unifying mechanism to enable efficient compilation of control idioms, such as async/await, generators/iterators, first-class continuations, etc. https://wasmfx.dev/ https://wasmfx.dev/
- gumby 3y agoSo a coroutine would be a “stack” one frame deep?
- marianoguerra 3y agoHere's a good explanation: https://github.com/WebAssembly/stack-switching/blob/main/proposals/continuations/Explainer.md https://github.com/WebAssembly/stack-switching/blob/main/pro...
- kevingadd 3y agoJumps can either target the top of a 'loop' block or the bottom of a regular block, and the jump has to be inside of the block it's targeting.