Michal Wallace writes:
> On Thu, 8 Jan 2004, Luke Palmer wrote:
> > .sub __main__
> >     newsub $P0, .Closure, _func
> >     savetop
> >     newsub $P0, .Continuation, done
> >
> > So the restoretop after the invoke has something to pop (and so your
> > register state isn't screwed up when you get back).
> 
> 
> Thanks Luke.
> 
> I changed my compiler to call savetop before every function
> call, and that passes my tests but I'm having trouble
> visualizing why. Would I ever NOT want to call savetop
> before creating a continuation?

Very rarely would you not savetop before creating a *real* continuation.
But again, very rarely would you actually create a *real* continuation
(depending on your language).  RetContinuations are almost always a
better choice for traditional languages, and languages like Python with
no support for continuations.

You won't get in trouble mixing RetContinuations with real ones, as long
as you don't try to use RetContinuations like Continuations, and only
use them to return downward.

Luke

Reply via email to