https://www.more-magic.net/posts/internals-data-representati... has a very brief bit about the closure objects we create. What exactly from the continuation compilation process would you be interested in? I could probably write up a post about it.
https://www.more-magic.net/posts/internals-data-representati... has a very brief bit about the closure objects we create. What exactly from the continuation compilation process would you be interested in? I could probably write up a post about it.
CHICKEN closures have a compiled C function and slots for the objects it closes over. How do you capture a continuation? Do you compile a partially evaluated C function and create a closure object for it?
In my lisp, I represented delimited continuations as a simple array of stack frames. Capture just copies to the heap all the stack frames up to the delimiter. Calling it just spills those frames onto the stack and replays the frames.
https://www.matheusmoreira.com/articles/delimited-continuati...
At the toplevel, the compiled code has a C function for every toplevel expression, and these functions just wrap up the "next toplevel expression" as the continuation that gets passed to the compiled C function that "executes" this expression. The final expression in the toplevel gets handed a special continuation which is the "implicit exit handler".
Inside procedures, we do something similar, but we keep the continuation we got from the toplevel and keep passing that along, creating new continuations as needed for the expressions inside.