Class TrivialMethodEscape

java.lang.Object
com.ibm.wala.escape.TrivialMethodEscape
All Implemented Interfaces:
IMethodEscapeAnalysis, INodeEscapeAnalysis

public class TrivialMethodEscape extends Object implements IMethodEscapeAnalysis, INodeEscapeAnalysis
Trivial method-level escape analysis.

An instance does not escape from method m if the following hold:

  1. the instance is only ever pointed to by locals (it is never stored in the heap)
  2. the method m does NOT return (either normally or exceptionally) a pointer to the instance
  • Constructor Details

    • TrivialMethodEscape

      public TrivialMethodEscape(CallGraph cg, HeapGraph<InstanceKey> hg)
      Parameters:
      cg - governing call graph
      hg - Heap graph representation of pointer analysis
  • Method Details

    • mayEscape

      public boolean mayEscape(MethodReference allocMethod, int allocPC, MethodReference m) throws WalaException
      Specified by:
      mayEscape in interface IMethodEscapeAnalysis
      Parameters:
      allocMethod - a method which holds an allocation site
      allocPC - bytecode index of allocation site
      m - method in question
      Returns:
      true if an object allocated at the allocation site <allocMethod,allocPC> may escape from an activation of method m, false otherwise
      Throws:
      WalaException
    • mayEscape

      public boolean mayEscape(CGNode allocNode, int allocPC, CGNode node) throws WalaException
      Specified by:
      mayEscape in interface INodeEscapeAnalysis
      Parameters:
      allocNode - a CGNode which holds an allocation site
      allocPC - bytecode index of allocation site
      node - method in question
      Returns:
      true if an object allocated at the allocation site <allocMethod,allocPC> may escape from an activation of node m, false otherwise
      Throws:
      WalaException