new mlprof on benchmarks

Stephen Weeks sweeks@wasabi.epr.com
Mon, 12 Jul 1999 16:58:42 -0700 (PDT)


> Does  the  -s flag turn it off?

yes.

> Ah, excellent.  I remember that the stack  frame  size  was  a  real  problem
> before,  but  the  new register allocator seems to have done great things for
> both that and the GC pointer copying.  What did you do to implement the stack
> slot  sharing?   

> Do  the  ML  types have to be the same? 

No.

> I assume that the C types do have to be the same.

No.

The basic idea is that the lexical scoping provided by the Cps
provides a course over-approximation to an interference graph (in the
usual graph coloring sense).  So, if you have:

fun f() =
  let
     fun g() = ... let val z = ...
     fun h() = ... let val w = ...
  in ...

In the above, it is clear that z and w do not interefere.

The register allocator does a top down walk of a cps function, keeping 
the "current stack offset" (where the next stack value will be stored) 
as it goes.  Whenever it enters a local function declaration, it
remembers the current value and resets it after processing the
function.  This allows locals in 'g' and 'h' above to use the same
stack slots (regardless of the type of value stored in the slot).

The register allocator does a similar thing to share registers, except 
that for these the C type must be the same.