Dan Sugalski <[EMAIL PROTECTED]> writes: > At 12:59 AM +0000 3/23/04, Piers Cawley wrote: >>Leopold Toetsch <[EMAIL PROTECTED]> writes: >> >>> Dan Sugalski <[EMAIL PROTECTED]> wrote: >>> >>>> ... If we go with a one >>>> frame stack chunk then we don't have to bother with COW-ing >>>> *anything* with the stack. >>> >>> BTW: which stacks: Register frames of course. What about Pad, User, and >>> Control? >> >>I hope he means "All of 'em". >> >>And what control stack? The continuation chain is the control stack, surely? > > Nope. There's the exception handlers, at the very least.
Just add a field to the continuation structure "NextExceptionHandler" which points to the continuation of the next exception handler in the chain. To throw an exception you invoke that exception. If that exception handler needs to rethrow the exception, its P1 will contain the appropriate continuation. > Possibly some lexical pad stuff. (Though of that I'm less sure) I've always wondered why lexical pads have their own stack. I'd hang it off the Sub object and, when the sub's invoked, shove the current pad into a control register, which then gets closed over by any continuations that get made. Invoking a continuation restores the pad register and away you go.