Stream: cranelift

Topic: Is it plausible to implement continuations with cranelift...


view this post on Zulip Ivan Chinenov (Jan 15 2025 at 19:10):

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.

view this post on Zulip bjorn3 (Jan 15 2025 at 19:12):

https://github.com/bytecodealliance/wasmtime/pull/9078

This PR adds a new CLIF instruction for switching stacks. While the primary motivation is to support the Wasm stack switching proposal currently under development, the CLIF instruction here is lowe...

view this post on Zulip bjorn3 (Jan 15 2025 at 19:13):

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.

view this post on Zulip Diego Antonio Rosario Palomino (Feb 06 2025 at 02:20):

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