CWS paper

Stephen Weeks MLton@sourcelight.com
Tue, 14 Nov 2000 14:41:10 -0800 (PST)


Hi John, I was talking with Kathleen yesterday while she was visiting
InterTrust.  She mentioned an upcoming paper you have in CWS about an
optimization in Moby to create nested loops from nested tail-recursive
functions.  It sounds similar to an optimization we have in MLton, called
contification, whose job is to turn toplevel functions into nested functions,
which are used to express loops in our IL.  The name "contification" comes from
the fact that the pass turns toplevel functions into continuations.  Anyways,
our version of contification does a pass over the program to determine if a
function f is called in only one place by another function g, and if so nests f
within g.  

Kathleen described your analysis as determining if a function is called with a
single continuation, and if so, nests it.  Offhand, it seems to me that these
optimizations catch many of the same cases (e.g. matrix multiply), but that
there are cases that both of them catch that the other doesn't.  I'd be
interested to read your paper to see if I could build an optimization into MLton 
that catches every case caught by both optimizations.  It'll probably only take
a few hours, and we might get some interesting performance numbers.