This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How often are continuations created?



[unbounded stack copying vs. bounded stack copying vs. mixed
heap/stack model]


Marius Vollmer <mvo@zagadka.ping.de> writes:

> Jost Boekemeier <jostobfe@linux.zrz.TU-Berlin.DE> writes:
> 
> > > But copying the control stack that has environment frames in it
> > 
> > Why do you have to copy the control stack?  In Hieb/Dybvig/Bruggeman's
> > model the control stack is simply a linked list of stack segments, no?
> 
> I think the control stack of a continuation is copied back into the
> currently active stack when the continuation is invoked.  Isn't that
> the case?  

Yes.  I think I got confused by the wording.  Why are there two
stacks, a data stack and a control stack?  I thought in Keisuke's
implementation the data stack is what their paper calls the "control
stack segment".  You could push everything on the stack except the
"boxed" variables which failed the "set!" test.  So copying the whole
stack or the whole stack segment isn't a problem.  What Hieb's paper
avoids is unbounded stack copying by splitting the control stack into
segments.  IMHO the "data stack" isn't necessary, is it?


[stack copying]
> Maybe this could be avoided.

I think there are only three possibilities:

1. Use a single stack with unbounded stack copying.  Similar solution 
   as the one guile uses now.  Easy to implement but expensive.
   
2. Stack segments.  Difficult to implement but not as expensive
   as 1.

3. Clinger's solution.  Use a single stack.  When a continuation is
   reinstated everything is copied from the stack to the heap and
   stays there.  Easy to implement but slows down the VM a little bit
   because the code must check if it actually returns from a
   heap frame or from a stack frame.  I think this solution (which
   I am currently implementing -- yes, still ...) is the best one.



Jost

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]