This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: continuation and multi-threading
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> > Could I use setjump?
>
> Sure. This is what is being used now. This is the implementation of
> call/cc in Guile (from eval.c:2232 with irrelevant details edited out):
>
> case (SCM_ISYMNUM (SCM_IM_CONT)):
> scm_make_cont (&t.arg1);
> if (setjmp (SCM_JMPBUF (t.arg1)))
> {
> SCM val;
> val = SCM_THROW_VALUE (t.arg1);
> return val;
> }
> proc = SCM_CDR (x);
> proc = evalcar (proc, env);
> goto evap1; /* apply proc on t.arg1 */
So simple. Okay, I'll use it, too.
> BTW, what did you mean with 'arranges the return value'?
I have to move the argument of a continuation (which is on the VM
stack) to the return value of call/cc (which must be on a VM register).
I meant this operation. Sorry about that.