CWS paper
Stephen Weeks
MLton@sourcelight.com
Mon, 4 Dec 2000 09:13:52 -0800 (PST)
> Thanks for the detailed description of contification. I think that what you
> are doing is very similar to our "frame phase", which is the last step
> before code generation. The frame phase runs after closure conversion
> and combines functions into the same cluster (tail-calls in the same cluster
> are treated as gotos). Since MLton has already CPS converted the program,
> contification is sufficient to get the frame sharing that we need, but for
> our direct-style IR, we need the LCPS conversion first to enable the frame
> sharing later.
>
> Also, the "call-based" analysis that you describe is essentially the same
> one that we use to cluster functions in the frame phase.
Makes sense. I'd be interested to hear why you don't just CPS the whole
program. We've found no disadvantages to having a (first-order, stack based)
CPS IL. But that can certainly wait for another day.
Another interesting difference is the fact the MLton does a lot of optimization
after contification. Maybe Moby doesn't do so because you haven't gotten around
to it yet. But having more intraprocedural information helps optimization a
lot.
> One of my reviews pointed me at Kelsey's IR'95 paper (on CPS and SSA).
> He describes something that looks a lot like what you are
> calling "contification." Is that the source of the idea?
Yes. That paper and Appel's related paper (SSA is functional programming)
influenced the design of MLton's CPS IL.