Lambda the Ultimate

inactiveTopic Escape Analysis for Java
started 3/31/2003; 12:05:36 PM - last post 4/1/2003; 2:06:54 AM
Ehud Lamm - Escape Analysis for Java  blueArrow
3/31/2003; 12:05:36 PM (reads: 1536, responses: 1)
Escape Analysis for Java
Choi, J.-D., Gupta, M., Serrano, M., Sreedhar, V. C., and Midkiff, S. Escape Analysis for Java. In Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'99)

A friend mentioned he plans to write his masters thesis on techniques related to escape analysis, which reminded me that this topic wasn't really discussed on LtU.

This paper is a useful reference.

A few more pointers can be found here and here. The latter is a link to a seminar on Memory Management that discusses several related topics.


Posted to general by Ehud Lamm on 3/31/03; 12:06:56 PM

Wouter van Oortmerssen - Re: Escape Analysis for Java  blueArrow
4/1/2003; 2:06:54 AM (reads: 460, responses: 0)
I'm doing something like escape analysis in my current compiler (for a little typesafe imperative language, think Java for the purpose of discussion), for the purpose of reducing reference count updates and doing stack/inline allocation.

However, my algorithm is much simpler than most mentioned w.r.t. escape analysis, so I am wondering if anyone has ideas of anything I could be overseeing, and/or pointers to papers that correspond closely to what I am dealing with.

My analysis is a simple walk over my AST, where at the start every variable (local or instance) is marked as "flat" (my wording for can be stack allocated / inline in other object allocated / doesn't require reference counting for the lifetime of this variable), then I mark things to "ref" (must be reference counted) as contexts require it (being on the rhs of assignment being a good example). It is written such that the property of "I am going to alias you" is passed down in the traversal, which makes doing this correctly for e.g. if-expressions real easy.

This then wrapped in a fixpoint loop which keeps going as long as atleast 1 node was changed from "flat" to "ref", which usually terminates very quickly.

Oh and this is closed-world only, of course. For parameters crossing modules I default to ref and allow explicit programmer marking of "flat".

Am I missing something?