At 08:30 PM 6/8/2002 +0200, Jerome Vouillon wrote: >On Fri, Jun 07, 2002 at 07:40:14PM -0400, Melvin Smith wrote: > > The support isn't complete, for example, co-routines, etc. need to > > swap in their own context, which right now they don't do. > >Instead of using some space on the stack, co-routines can store all >their local variables into their closure. Then, there is no need to >swap in any context.
I'm all for optimizing routine calls too. Actually I like the idea of optimizing away needless scratchpad or stack allocation. That way if routines never need it, we don't take a performance hit for simple sub calls. Maybe it means setting a flag on stack segments, so each sub call can tell if it needs to alloc a local stack or not. If I'm not clarifiying: assume we call coroutine A, and all it does is simple calculations in registers, then there is no need to alloc a scratchpad or stack, unless A calls B, and then A can relegate to B. Comments? -Melvin