cps & contification
Matthew Fluet
Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 24 Jan 2001 09:58:55 -0500 (EST)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
---559023410-851401618-980348335=:1072
Content-Type: TEXT/PLAIN; charset=US-ASCII
> So the upshot is that on all the examples, the new analysis is at least as
> precise as call based, continuation based, or both, right?
Correct.
> And we believe that
> will always hold, right?
Yes. The theorems below show that A will always match or improve upon a
safe analysis B whenever B(f) = Uncalled or B(f) = j in Jump. So A will
always match the continuation based analysis (modulo some of the
implementation details; e.g., the current continuation based analaysis
doesn't distinguish between nontail calls with uncalled callers and
nontail calls with called callers, so the new analysis can make more
functions Uncalled).
Likewise, it should be trivial to show that a function f matching the
criteria for the call based analysis will have A(f) <> Unknown.
> > On the other hand, there are some interesting properties that can be
> > shown. If B is a safe analysis and B(f) = Uncalled, then A'(f) =
> > Uncalled and A(f) = Uncalled. Likewise, if B is a safe analysis and B(f)
> > = j in Jump, then A'(f) <= j and A(f) <= j.
>
> I like these, and would like to add one more.
> If B is safe and B(f) = g then A(f) <> Unknown
Nice. I'll think about it a little more.
> > Here's an updated contify.fun with the new analysis. I checked into logic
> > a little more (tweaking checkDominators to run just before contify and
> > print out the call graph was useful, rather than tracing 47 functions by
> > hand), and it looks pretty clear that the mutual recursion can't be
> > moved into the local functions.
>
> Can you send the graph? You know about dot, right?
Sure. I'm also including call-graph.{sig, fun} which is a modified
version of checkDominators which creates the call graph with nontail call
edges labeled with the continuation. This makes it a little easier to
think about what the contification analysis is doing on particular
functions. Of course, it results in many more edges on the graph.
In all three passes, all of the functions which are contifiable by the new
analysis want to be contified in x_49. Probably the easiest example is to
look at x_0, x_1, and x_49. We have
(x_49, x_0), (x_49, x1), (x_0, x_1), (x_1, x_0), (x_1, x_49) in T
The problem is that x_0 and x_1 are mutually recursive, but there are
outside calls from x_49 to each of them.
---559023410-851401618-980348335=:1072
Content-Type: APPLICATION/octet-stream; name="call.tgz"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.SOL.3.95.1010124095855.1072A@yodel.cs.cornell.edu>
Content-Description:
H4sIAHDsbjoAA+1cbY8buZHer9av6Ew+ZAaYKE0WX7odeIFg4+Ry8NmL9V4+7GJgKBqNrY0sTWY0
t7tw5r9fN4uUqiiy9vaDvbdAE7BH7IeserpYfC1Ky8Vm8/u3d4vbd/Obh+1nHyWptnXGNJ81jQIP
9G9IrtVt03gNYJ3V2g2wBms/a9qPQ4enh/v94q5pPrvZPKz2Qrmfwn+laWj05X5313wx+MFfRzdo
zl8/bb7404sXb/761Z++/I83r7/+6r+/+Pr1BX3YPGtm9/u7h+V+NtvdrrbN61nMP9ytGhTzrPnz
+m613K+uQ3622S0Xm9nQ3KECPltvxwfHmi9316uh4viHA8+v347A+Ge22l7PZv+z2DTBa18+vH/a
rLf75m51M5QY/29ns+Gtms3ix93DPr7T28tmu3i/Gv4fZL8Mn1aDsPHTRfNsVLa+aW4Wm/ugeEj7
dwPL84sxtzo+/ct6s5p/v96/e/Wwj4/Ol7vtcrFvvj37w/797R++Obts/rbdz/e71/u79fZtc/6b
xPPisjmbnyUiZ/Pr3f7s6rKJcpqbbTPwbZ59nh5sVvvZE2qv+YvwSn/eJd3Di48l8PF8+Hc7CDjH
F28+vI3t8PZy9mRIzX6934xWDPrx0e52v95t74eH317FR6NZXh0eD6SGKp+PXJDI8wMcig8VEpNm
ubhfHazarCIeCuxumpevXj4fJX17RYHm383rV//1vPmOPRyLvVj8Y7VpvrviaobGjzzHhmQ8t4zn
ywNc5pn8oNl+LJ6PgejYphdjI/2xGXxmvl19v1lvV+PT2bHoBXrs8t1q+c/m/LZZ3Ddf3u2G9ns/
/7r5ELro+J6XzfvFenvZzOfzx+i1o4+gmLFHvBksMTrfers89A4CJ4dAZxqojA5O8A9vB+s9C6b5
2/Zm9zQYcb5vfv9582F0mqfNXwYq8/3j4LTji96H4sP/L2ONx4HUk5H67epu/+N8E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