At 10:03 AM -0500 4/25/02, Fisher Mark wrote: > > I've no strong opinions on how it's done, but I do believe that >> it's *very* important that subroutine calls be as fast as possible >> (and significantly faster than perl5). This must be a priority. >> >> To my mind that means that a subroutine should be responsible for >> setting up whatever _it_ needs (and ideally only what it >> knows it needs). > >I agree both on priority and on methodology. I'd expect while programming >that if I used a subroutine feature not used in most subroutine executions >(like continuations) that I'm going to have to pay for that feature when I >use it and only when I use it. Making all subroutine executions pay for a >feature that only a few will use seems like a design misfeature to me.
Okay, fair enough. Subs in general will have the following potential information: *) A pointer to a template lexical scratchpad *) A pointer to a *real* scratchpad (for co-routines and continuations) *) A pointer to a parent lexical scratchpad (for continuations) *) A pointer to the bytecode starting the sub *) A pointer to the bytecode we should actually start at (for co-routines) *) A pointer to a set of stacks (for co-routines and continuations) *) A pointer to machine-level code (if we've been JITted or are an XSub) *) A pointer to the current lexical state of the sub (opcode library, amongst other things) (for co-routines, and potentially all the subs) *) A pointer to the currently valid global symbol table tree Given how much is there, I think everyone's right that the subs themselves should deal with this, which is pretty much what I've been thinking we'd do. Calling into a sub will be done with either a call, callcc, or tailcall. (Noting a normal call, a call with current continuation, or a tail call so we don't save anything) The first two save the current state for returning. Cleaning up the cruft that's accumulated since the beginning of the current sub is the responsibility of other code. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk