[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exception systems



From: Marc Feeley <feeley@IRO.UMontreal.CA>
Subject: Re: exception systems
Date: Fri, 19 Apr 1996 13:00:21 -0400

> > > |   This is a myth.  SML/NJ's implementation strategy happens to allow a
> > > |   very cheap implementation of call/cc.  It was, however, not chosen
> > > |   just because of that.  Also, I don't know what you mean by `making
> > > |   everything else somewhat more expensive'.  Admittedly, it is a
> > > |   controversial topic, but if you look at Appel and Shao's papers on
> > > |   this issue then you will see that the jury is still out.
> > > 
> > > We can discuss this ad infinitum, but it is not a myth.
> > 
> > Then, please, be specific.  What is slowed down by SML/NJ's call/cc
> > mechanism?
> 
> Three things (at least):
> 
> 1) Non-tail function calls, because you need to initialize a dynamic
> link in the frames that you create.
> 
> 2) Function return, because you need to follow the dynamic link to
> reset the caller's frame.

Both true, and the Appel/Shao paper (``An Empirical Study of Stack
vs. Heap Cost for Lamguages with Closures'') clearly shows these
effects.  Nevertheless, the advantages of the heap-based allocation
seem to make up for that on average.

> 3) References to parameters when the reference follows a non-tail call
> (because frames can't be extended in place, you actually have to chain
> the various parts of a function's frame, each part corresponding
> to a non-tail call in the function's body).

I didn't quite follow.  Parameters are always passed in
registers... so why does parameter access slow down?

-Matthias