I suspect I am stupid again

Matthew Fluet fluet@CS.Cornell.EDU
Fri, 21 Sep 2001 14:18:38 -0400 (EDT)


> > Various "hacks" let me compile lrtl.sml.  (For example, switching from
> > Adom/ancestor to Adom/parent.)  But, I want to figure out the right way of
> > doing this.  One way is to just punt on everything, but that seems bad.
> > In particular, the whole maximality of Adom is sort of an illusion -- if
> > we punt, then x_100806 which is Acall contifiable is not actually
> > contified by Adom.
> 
> Given the imminent :-) move to SSA, I'm not sure it's worth spending too much
> time on this other than scaling back enough to turn off the bug.

Well, it's not completely clear the right way to "punt."  Consider the
following:

m --L--> f
f --> g
f --> h
g --> f
g --> h
h --> f
h --> g

(Non-tail call from m to f; f, g, and h are fully-mutually recursive.)

Now,
    A1   A2
m  Unk  Unk
f    L    L
g    f    L
h    f    L

are both safe analyses.  With A2, we can just not-contify f, g, and h when
we detect the mutual recursion.  But with A1, it's not so easy.  We detect
the scc {g, h} with two outside callers, so we don't contify them.  But,
that, in turn, means that we can't contify f.  There is a bottom-up way of
dealing with this; i.e., form the "contified-at" tree, and process nodes
as a depth-first-finish.

Anyways, I'll think about the right way of dealing with all this.

By the way, lrtl.sml is an interesting program in it's own right.  Over
17000 cps functions in the first contification pass!  (That's not quite
twice the number in mlton; at least as we recorded in the paper.)  I ran
dot on the call-graph for over 6 hours before cancelling it.  There are a
number of mutually recursive contifications that are attempted.