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) This way the exception handlers and whatnot will be
properly in place when a coroutine is invoked.

It's a bit of a pain, and makes coroutine entry and exit a bit convoluted, 
but since entry and exit is alreasy convoluted, I don't think it's a big 
problem.

                                        Dan

Reply via email to