On Sat, Jun 08, 2002 at 01:15:48AM -0400, Dan Sugalski wrote:
> First, we need to beef up ret, but that's a problem of definition. It
> should walk the control stack until it hits something it can return,
> so we can undo exception handler pushes, scope change, and suchlike
> things. (My problem, I'll update the docs)
Why does ret need to be so smart? We can have an opcode that pop
exception handlers (we need it anyway) and a ret that just return. If
this turn out later to be a performance bottleneck, it will always be
possible to optimize this by adding an opcode that performs both.
> Second, in the final go, the callco op won't be needed--call should
> be sufficient, but that'll need support in the PMCs.
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);
}
-- Jerome