[PRL] compiling `return'

David Herman dherman at ccs.neu.edu
Thu Jun 23 12:06:29 EDT 2005


> I remember talking with Joe Marshall about this at one point.  It  
> seems to me that the "nice" thing to do would be to compile the  
> code in such a way that no escape continuation was necessary.  That  
> is, the return should be the end of the control flow for the  
> procedure.

I agree, though I'm not sure of the details.

> I claim that you can always perform such a translation; it gets  
> most painful in the presence of macros that expand into lambda's,  
> where the (return) should end not just one procedure but many of  
> them, in which case you wind up doing a partial CPS.

Right.. but the issue is, is it possible to do a "partial" CPS, when  
some inner procedures may escape? Or do you only have to CPS nested  
procedures that are the output of for-loops and the like, which  
cannot escape?

> On the other hand, perhaps escape continuations are just as fast.   
> I think Joe would know more about this.

It's not the speed of the escape continuations that I'm worried  
about. It's the overhead of returning a thunk and applying it at  
every application that should be the killer.

Dave




More information about the PRL mailing list