From z Tue Dec 05 00:05:53 2000
Received: from maguro.epr.com ([198.3.162.27]) by exchange.epr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21)
	id WNKA3DYG; Mon, 4 Dec 2000 15:04:02 -0800
Received: from magrathea.epr.com (firewall-user@magrathea.epr.com [198.3.160.1])
	by maguro.epr.com (8.9.3/8.9.3) with ESMTP id PAA09952
	for <sweeks@intertrust.com>; Mon, 4 Dec 2000 15:07:56 -0800 (PST)
Received: (from uucp@localhost) by magrathea.epr.com (8.9.3/8.7.3) id PAA10442 for <sweeks@intertrust.com>; Mon, 4 Dec 2000 15:07:55 -0800 (PST)
Received: from nodnsquery(199.222.69.4) by magrathea.epr.com via smap (V5.5)
	id xma009955; Mon, 4 Dec 00 15:07:03 -0800
Received: from clairv.com (IDENT:root@pc246.edi.nunet.net [199.249.165.246])
	by mail.acm.org (8.9.3/8.9.3) with ESMTP id SAA30690
	for <sweeks@acm.org>; Mon, 4 Dec 2000 18:06:57 -0500
Received: from magrathea.epr.com (firewall-user@magrathea.epr.com [198.3.163.3])
	by clairv.com (8.9.3/8.9.3) with ESMTP id RAA01563
	for <MLton@sourcelight.com>; Mon, 4 Dec 2000 17:06:57 -0600
Received: (from uucp@localhost) by magrathea.epr.com (8.9.3/8.7.3) id PAA09837 for <MLton@sourcelight.com>; Mon, 4 Dec 2000 15:06:55 -0800 (PST)
Received: from unknown(198.3.162.27) by magrathea.epr.com via smap (V5.5)
	id xma009282; Mon, 4 Dec 00 15:06:07 -0800
Received: from eponym.epr.com (eponym.epr.com [10.1.1.123])
	by maguro.epr.com (8.9.3/8.9.3) with ESMTP id PAA09879
	for <MLton@sourcelight.com>; Mon, 4 Dec 2000 15:06:06 -0800 (PST)
Received: (from sweeks@localhost)
	by eponym.epr.com (8.9.3/8.9.3) id PAA24373;
	Mon, 4 Dec 2000 15:05:53 -0800
From: "Stephen Weeks" <sweeks@intertrust.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <14892.9041.816128.676359@eponym.epr.com>
Date: Mon, 4 Dec 2000 15:05:53 -0800 (PST)
To: MLton@sourcelight.com
Reply-to: MLton@sourcelight.com
Subject: Re: CWS paper
In-Reply-To: <200012042132.PAA30467@syzygy.clairv.com>
References: <200012042132.PAA30467@syzygy.clairv.com>
X-Mailer: VM 6.71 under 20.4 "Emerald" XEmacs  Lucid
X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on 
	eponym.sweeks.com
X-Spam-Level: 
X-Spam-Status: No, hits=0.0 required=3.0 tests=AWL autolearn=no version=2.60


> Is the contification strategy you are working on different than the one I
> suggested (where the continuation of a function f ends with return-from-f)?
> That seems pretty much optimal to me.  I guess it could also end with
> tail-call-to-g.

The one you suggested (as I understood it) failed on the example that I sent out 
on Nov 22.

> fun f () = ... h () ... g () ...
> fun g () = ... h () ... f () ...
> fun h () = ...
>  ... K (f ()) ...
> 
> All calls are tail calls.  It seems to me that the extended analysis will not
> be able to contify h because it will be called with two different
> continuations: "return to f" and "return to g".  On the other hand, with the
> old analysis, the set of continuations for f, g, and h would be {K}, and all
> would be contified. 

Matthew sent a proposed fix to the continuation based analysis to handle this
problem.  Intuitively, it made sense, but I haven't quite figured out how to
make an analysis of it.

> A completely different possibility is to observe that the main thing being
> saved (in turning a procedure into a continuation) is construction of a
> fram.  Thus you could turn procedures which are only called with a few
> continuations into continuations which take a flag argument to indicate where
> they should go when they are done.  I.e., it really is a form of closure
> representation in the world of full CPS.

This could work.

I think the problem is that the CPS IL ties together the notions of environment
and stack.  For example, there is no way to keep around one environment while
doing a nontail recursion that refers to that environment.


