contification paper

Stephen Weeks MLton@sourcelight.com
Fri, 16 Feb 2001 17:37:26 -0800 (PST)


To be clear on terminology, the contify pass is broken into two phases, an
analysis phase and a transformation phase.  Now that you have unified all the
transformations, there is only one transformation phase (that is of course
dependent on the output of the analysis phase).  There are lots of different
possible analyses.

So, when I wrote

> How about we just use Reach in the definition of safety.  I.E.
> 	* if not(Reach(f)) then A(f) = Uncalled
>
> After all, reachability is a trivial concept and any sane analysis would do this 
> (okok I know an old implementation of the contifier didn't :-).

I was talking about the analysis phase, not the transformation phase.  At some
point you found that the old cont analysis did not meet this safety criterion.

When you said this

> Actually, neither does the new version I wrote up.  Which does mean that
> it could be potentially cyclic:

I believe you were referring to the transformation phase not being able to
handle analyses that didn't meet the above safety criterion.

> In any event, it's easy fixes for the new versions of each transformation.
> Reach is computed once before any of the analyses, so it will be easy to
> incorporate them into these two.

OK, we're on the same page.  The new contifier looks like
	1. Compute Reach
	2. Analyze
	3. Transform
where only (2) is dependent on contifyStrategy.

> > Hmmm.  I just thought of another possibility.  What if we use the A* safety
> > definition, the parent analysis, and your latest transformation, but still
> > pretend we have mutual recursion.  Maybe that's not too complicated.
> 
> I still suggest sticking with the original definition of safety.  

OK.

> > Good.  So we can stick with the one transformation that works for any safe
> > analysis.  I think it's ok to present a slightly historically inaccurate call
> > analysis, possibly with an incomprehensibly vague note about nesting.
> 
> We may not have to be that vague.  Something to note is the fact that this
> whole analysis could be repeated on the body of each top level function to
> transform them (with the simplification that there are no non-tail calls,
> only tail calls between local functions).  When we do the nesting, we just
> exploit the fact that we can transform an analysis A such that 
> S = {g | A(g) = f} and exacty one element of g' in S is called by f, into
> another safe analysis A' on the body of the transformed f where 
> A(g') = Unknown, A(g) = g' for g \in S - {g'}, and A(j) = Unknown for all
> other local functions of f. 
> 
> Or maybe that's getting too complicated.  

Yes :-)