Globals...

Daniel Wang danwang@cs.princeton.edu
14 Feb 2000 14:59:27 -0500


"Stephen Weeks" <sweeks@intertrust.com> writes:

> > I'm in the process of hacking up the clousre converter, it's much easier
> > than I thought.
> 
> Excellent.  I was hoping the functor based approach would work out.
> 

It's a bit kludgey but it works. I have to have both the "fake" DirectExp
structure as well as the original one define in the CPS signature. I need to
use the original one to generate real CPS code from my IL, which is just
first order ML. 

> > In anycase, one thing I'm not clear about is what role
> > globals play in the big scheme of things. Are they very important? 
> 
> They are essential for good performance.  Without them, too many
> things get put in closure records, causing a lot of unnecessary work.

This might not be a problem for me. I'm not useing the Standard Basis
Library, I just basically have arithmetic and "print" implemented via C
primitives. The biggest thing I'd like to compile is MLyacc. :) I'm working
on getting life running.

> PrimExps.  The reason for this restriction is so that a sensible
> semantics can be given to globals -- in particular, all the globals
> are evaluated before any of the functions are defined, so there is no
> mutual recursion between globals and functions.

This is a little problematic for me, as I have to decide what region these
globals are allocated in. It might work, I'll have to think about this...

> BTW, it'd be nice if this (and your other changes) would be controlled
> by a flag added to the Control structure.

The changes are pretty isolated, one can simply instantiate the
closure-convert.fun with a different argument and get the same code as
before.