So, I was looking at the PICOBIT papers. I noted that the representation of continuations has a "parent" field. Presumably this is to allow something like "continuation-next" from the Better API for First Class Continuations paper.
However, I don't see any corresponding virtual machine instructions to manipulate continuations.
At that point, I presumed that some form of CPS conversion was going on that was wiping out continuations, so I looked at the 90 Minute Scheme to C compiler stuff. Unfortunately, I don't see how to get "continuation-next" in the context of purely CPS conversion.
Anybody have suggestions as to what I am missing and where to look?
Obviously, I can look through the full PICOBIT source, but doing so without some landmarks is suboptimal.
Thanks, -a
Afficher les réponses par date
On 2012-02-21, at 7:17 AM, Andrew Lentvorski wrote:
So, I was looking at the PICOBIT papers. I noted that the representation of continuations has a "parent" field. Presumably this is to allow something like "continuation-next" from the Better API for First Class Continuations paper.
However, I don't see any corresponding virtual machine instructions to manipulate continuations.
Continuations are handled implicitly by the picobit VM's CALL and CALL_TOPLEVEL and RETURN instructions. In picobit-vm.c look at the C function "save_cont" to see how continuations are created, and the very end of the C function "interpreter" to see how the RETURN instruction is implemented.
If "cont" is a reference to a continuation, then "ram_get_field2 (cont)" will extract the parent continuation. You could easily add a "continuation-next" primitive to the VM and compiler implemented as "ram_get_field2 (cont)". Also take a look at the "show" function in picobit-vm.c, which can dump a textual representation of various objects including continuations.
At that point, I presumed that some form of CPS conversion was going on that was wiping out continuations, so I looked at the 90 Minute Scheme to C compiler stuff. Unfortunately, I don't see how to get "continuation-next" in the context of purely CPS conversion.
Anybody have suggestions as to what I am missing and where to look?
Obviously, I can look through the full PICOBIT source, but doing so without some landmarks is suboptimal.
Picobit does not use CPS conversion.
Marc