Dan Sugalski <[EMAIL PROTECTED]> wrote: > On Mon, 18 Aug 2003, Leopold Toetsch wrote:
>> Or coroutines shouldn't swap the control stack - I don't know. > They should, sort of. > Coroutines are a pain, but what they have to do is keep track of both the > top *and* bottom of their saved stacks. When a coroutine with active state > is invoked, it needs to take the parent pointers in the bottom stack > frames and make them point to the tops of the stacks that are in place > when the coroutine is invoked. (And when the coroutine exits saving state > those parent pointers need to be NULLed out so we don't hold on to stack > frames unneccesarily) I have checked in that pain ;-) It probably can be optimized to move whole chunks around, but I don't expect too many items on the control_stack. The question still is: what about the pad_stack. Same procedure, or swap. > Dan leo