[MLton] compilation loop

Stephen Weeks MLton@mlton.org
Thu, 26 Feb 2004 18:41:14 -0800


> Well I was incorrect in saying there was a loop. On model-elimination the
> compiler hits a snag in redundant.fun. When processing the labels, doing
> the union (MakeFormalsRel), the compiler will start to take up LOTS of
> memory.

makeFormalsRel builds an equivalence relation on the (indices of) the
formals.  An equivalence relation is represented as a list of
equivalent pairs (see equivalence-relation.fun).  So, the size is
potentially quadratic in the number of formals.  This hasn't been a
problem so far, but I imagine with flattening there could be a lot
more formals than before.  If you could confirm that this is the
problem by printing the size of the vector that is passed to
makeFormalsRel, that would be helpful.  In the meanwhile, I'll think
about improving the implementation of equivalence relations to store a
list of equivalence classes instead of a list of equivalent pairs.

Also in the meanwhile, you can compile -drop-pass redundant and see
how the rest of the optimizer does.

And of course make sure you are compiling -type-check true.