All techniques for implementing continuations involve some funky stack manipulations, and I don't recall seeing anything suggesting cranelift abstract machine lets you do things like linked-list callstacks.
https://github.com/bytecodealliance/wasmtime/pull/9078
And you can always call a trampoline implemented in inline assembly which changes the stack pointer as necessary. For example Wasmtime has a fiber implementation implemented in inline asm.
Continuations dont need compiler support. The compiler just needs to support Tail Call Elimination ( which cranelift aready does ) , which allows Continuation Passing Style , which is how scheme compilers implement them
Function1( param1, param2, continuation , explicit_stack )
Functions would never return, instead functions would call the continuation parameter with the arguments they normally return. This calling convention allows the stack to be explicit
Last updated: Feb 27 2025 at 22:03 UTC