cps & contification

Matthew Fluet fluet@CS.Cornell.EDU
Mon, 15 Jan 2001 11:29:54 -0500 (EST)


> > So, the bad news... I can't quite get the actual contification to occur:
> > I get a "_var_ has no info property" error, on a variable that isn't even
> > mentioned in the cps.  Stranger, no property in contify.fun is declared
> > initRaise("info",...).  
> 
> This is probably from shrink.fun, which is used because the contifier calls
> shrinkExp.  Trace Cps.shrinkExp to see.

shrinkExp was the problem.  I think the basic issue was that there is the
binding

val shrinkExp = shrinkExp globals

and this shrinkExp is being called on the result of walkExp (which did the
actual replacement).  The current continuation based analysis only
determined that a function could be prefixed onto another continuation;
the new analysis is also determining that a function could be contified
within another function (i.e., it's added as a local function definition).
This caused problems because this type of replacement adds a new Jump.t,
which wasn't in the set of local functions defined in globals.  Thus, the
"var has no ..." problem.  

I solved(?) the problem by removing the call to shrinkExp on the result of
walkExp and added a call to shrink on the resulting program; I think this
has the same effect, at the expense of building up the whole program once
and then sending it to the shrinker which will rebuild the program.

In any event, that works in the sense that applying contification based on
the new analysis passes all the regression, benchmarks, and a
self-compile.  I was a little suspicious about logic and raytrace, each
with >40 functions determined contifiable by the new analysis, but all of
those functions were successfully contified and the resulting program
works as expected.