On Sat, Jun 08, 2002 at 12:20:55PM -0400, Melvin Smith wrote:
> At 09:50 AM 6/8/2002 +0200, Jerome Vouillon wrote:
> >Alternatively, I think you can just replace the definition of yield
> >by:
> >
> > inline op yield (in INT) {
> > struct Parrot_Sub * sub =
> > (struct Parrot_Sub*)interpreter->pmc_reg.registers[0]->data;
> > sub->init = OFFSET($1);
> > stack_pop(interpreter, interpreter->control_stack,
> > &dest, STACK_ENTRY_DESTINATION);
> > goto ADDRESS(dest);
> > }
>
> What would that accomplish?
>
> If yield is to suspend the current coroutine and return back to the
> controlling context, you don't need an argument to yield, unless you
> wish to yield and jump to a different address than you were called
> from, but is that the semantics of a co-routine yielding?
You mentioned in a previous mail:
"On a return, we can set the entry address back to the "start" of the
co-routine for another call."
The argument to the "yield" opcode was intended to allow this.
But you're right: one could just as well put a "branch" just after
the "yield".
-- Jerome