org.dellroad.jc.cgen.escape
Class EscapeAnalysis

java.lang.Object
  extended byorg.dellroad.jc.cgen.escape.EscapeAnalysis

public class EscapeAnalysis
extends Object

Class that performs escape analysis to determine objects that may be allocated on the stack (instead of the heap).


Method Summary
static void analyze(CompleteUnitGraph graph, int maxAlloc)
          Find allocations of non-escaping objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

analyze

public static void analyze(CompleteUnitGraph graph,
                           int maxAlloc)
Find allocations of non-escaping objects. Our requirements:
  1. Object must not be thrown, returned, assigned to any field, assigned to any array element, or passed to any method. MONITORENTER is allowed, hence these must be balanced.
  2. Allocation size must be known a priori.
  3. Object must not override finalize().
  4. Object must not subclass java.lang.ref.Reference.
  5. The allocation must not be within a loop

We impose a maximum total size for all stack allocations in the method. We prioritize allocations by size (smallest first).

All allocations that may be stack allocated are tagged with a StackAllocTag.

Parameters:
graph - graph computed from method
maxAlloc - max number of bytes of stack allocated objects