[MLton] liveness space problem

Stephen Weeks MLton@mlton.org
Thu, 3 Jun 2004 08:13:21 -0700


My current thinking is that it is the wrong approach to try to keep
the size of functions down in earlier compiler passes just so this
late liveness pass can run.  Better would be to introduce a pass as
close as possible before liveness runs that rewrites large functions
to avoid the problem.

One idea is to introduce tuples of variables to collect them together
and carry them over large live ranges, replacing their later uses by
selects.  Done correctly, this would replace lots of live variables by
a single one (the tuple).  And, since we're in the main function, the
extra tupling and selects shouldn't hurt (yes, the transformation may
apply to other functions, but for now I'm just worried about main,
which in practice is the only function large enough to cause
problems).  There are space safety issues, but they can be avoided by
only putting small values in the tuples -- hopefully enough of the
variables are small.

I'm currently thinking about methods for introducing the tuples and
hope to send mail later today with some ideas.  If you have any
thoughts (about this approach or others), please send them.