envgen.analysis.stat
Class EnvCallGraph

java.lang.Object
  |
  +--envgen.analysis.stat.InvokeGraph
        |
        +--envgen.analysis.stat.EnvCallGraph

public class EnvCallGraph
extends InvokeGraph

Mappings from callsites to their possible targets, from targets to their callsites.


Field Summary
(package private)  edu.ksu.cis.indus.interfaces.ICallGraphInfo callGraphInfo
           
(package private)  int debug
           
(package private)  soot.Hierarchy hierarchy
          Class Hierarchy needed for virtual method call resolution.
(package private)  int numMethods
           
(package private)  int numTargets
           
(package private)  boolean ofaAnalysis
           
(package private)  boolean packageAnalysis
           
(package private)  java.lang.String packageName
           
(package private)  soot.SootMethod root
          Root of the call graph, an artificial dummy node needed for a common start.
(package private)  java.util.HashMap unitTable
           
 
Fields inherited from class envgen.analysis.stat.InvokeGraph
methodToContainedSites, siteToDeclaringMethod, siteToTargetMethods, targetToCallingSites
 
Constructor Summary
EnvCallGraph(java.util.HashMap unitTable)
           
 
Method Summary
private  void addTargetToSite(soot.jimple.Stmt s, soot.SootMethod target, soot.SootMethod sm)
          Checks if the target needs to be processed, adds it site, and calls recursiveBuildCallGraph for target.
 void buildCallGraph()
           
 void buildCHACallGraph()
          Builds a call graph starting with a dummy root at the top, unit methods at the second level down, methods that get called inside the unit methods at the 3d level down.
 edu.ksu.cis.indus.interfaces.ICallGraphInfo getCallGraph(java.util.Collection rootMethods)
          Builds an OFA analysis-based call graph.
 java.util.List getEntryMethods(java.util.List methods)
           
 java.util.List getEnvInterfaceMethods()
           
 void getStatistics()
           
 java.util.List getTargetsOf(soot.SootMethod sm)
          Returns the list of targets of SootMethod
 java.util.Collection getTargetsOf(soot.jimple.Stmt site, soot.jimple.InvokeExpr expr, soot.Type receiverType, soot.SootMethod sm)
          This method is called from EnvInterface to discover the environment methods
 java.util.Collection getTargetsOf(soot.jimple.Stmt site, soot.SootMethod sm)
           
 java.util.List getTargetsOfRoot()
           
 java.util.List getUnitMethods()
           
 boolean isLibraryMethod(soot.SootMethod target)
          Checks whether target belongs to a library class.
 boolean isSubType(soot.SootClass unitClass, soot.SootClass paramTypeClass)
          Finds whether unitClass class is a subtype of paramTypeClass class.
 boolean isUnitSuperType(soot.SootClass paramTypeClass)
          Checks whether paramTypeClass is a supertype of any of the unit classes.
 void printGraph()
          Prints the graph in terms of methods and call sites they contain.
 boolean processTarget(soot.SootMethod target)
          Quick package test: if the environment includes only lib classes, the unit doesn't include any lib classes, and none of the unit classes inherit from the env classes (except for Object), then the env method can't see any of the fields of the unit classes.
 boolean processTargetPackage(soot.SootMethod target)
           
private  void recursiveBuildCallGraph(soot.SootMethod sm)
          Recursive function that gets called from buildCallGraph to update the callGraph
private  void recursivePrintGraph(soot.SootMethod sm, java.util.HashSet visited)
          Recursive method that is used to walk the graph tree.
 boolean unitIncludesLibClasses()
          Checks whether there is a library class in the unit.
 
Methods inherited from class envgen.analysis.stat.InvokeGraph
addSite, addTarget, containsSite, copyTargets, getCallingSitesOf, getDeclaringMethod, getSitesOf, getTargetsOf, getTransitiveTargetsOf, removeAllTargets, removeSite, removeTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitTable

java.util.HashMap unitTable

root

soot.SootMethod root
Root of the call graph, an artificial dummy node needed for a common start.


hierarchy

soot.Hierarchy hierarchy
Class Hierarchy needed for virtual method call resolution.


packageAnalysis

boolean packageAnalysis

packageName

java.lang.String packageName

numTargets

int numTargets

numMethods

int numMethods

ofaAnalysis

boolean ofaAnalysis

callGraphInfo

edu.ksu.cis.indus.interfaces.ICallGraphInfo callGraphInfo

debug

int debug
Constructor Detail

EnvCallGraph

public EnvCallGraph(java.util.HashMap unitTable)
Method Detail

buildCallGraph

public void buildCallGraph()

getCallGraph

public edu.ksu.cis.indus.interfaces.ICallGraphInfo getCallGraph(java.util.Collection rootMethods)
Builds an OFA analysis-based call graph.

Parameters:
rootMethods -
Returns:

buildCHACallGraph

public void buildCHACallGraph()
Builds a call graph starting with a dummy root at the top, unit methods at the second level down, methods that get called inside the unit methods at the 3d level down. 3d level contains methods that get called inside the unit including the ones that are part of the unit. To identify top level environment methods, go through 3d level methods of the call graph and identify those whose declaring class is not part of the unit.


recursiveBuildCallGraph

private void recursiveBuildCallGraph(soot.SootMethod sm)
Recursive function that gets called from buildCallGraph to update the callGraph


getTargetsOf

public java.util.List getTargetsOf(soot.SootMethod sm)
Description copied from class: InvokeGraph
Returns the list of targets of SootMethod

Overrides:
getTargetsOf in class InvokeGraph

getTargetsOf

public java.util.Collection getTargetsOf(soot.jimple.Stmt site,
                                         soot.SootMethod sm)
Parameters:
site -
Returns:
a collection of possible targets

getTargetsOf

public java.util.Collection getTargetsOf(soot.jimple.Stmt site,
                                         soot.jimple.InvokeExpr expr,
                                         soot.Type receiverType,
                                         soot.SootMethod sm)
This method is called from EnvInterface to discover the environment methods

Parameters:
site -
expr -
receiverType -
sm -
Returns:

addTargetToSite

private void addTargetToSite(soot.jimple.Stmt s,
                             soot.SootMethod target,
                             soot.SootMethod sm)
Checks if the target needs to be processed, adds it site, and calls recursiveBuildCallGraph for target.


processTarget

public boolean processTarget(soot.SootMethod target)
Quick package test: if the environment includes only lib classes, the unit doesn't include any lib classes, and none of the unit classes inherit from the env classes (except for Object), then the env method can't see any of the fields of the unit classes. No need to process such target.


isLibraryMethod

public boolean isLibraryMethod(soot.SootMethod target)
Checks whether target belongs to a library class.


unitIncludesLibClasses

public boolean unitIncludesLibClasses()
Checks whether there is a library class in the unit.


processTargetPackage

public boolean processTargetPackage(soot.SootMethod target)

isUnitSuperType

public boolean isUnitSuperType(soot.SootClass paramTypeClass)
Checks whether paramTypeClass is a supertype of any of the unit classes.


isSubType

public boolean isSubType(soot.SootClass unitClass,
                         soot.SootClass paramTypeClass)
Finds whether unitClass class is a subtype of paramTypeClass class. Used to check whether a unitClass type can flow into a method through paramTypeClass, or whether a unitClass inherits from a class in the env, in which case we need to keep track of side-effects to the fields of paramTypeClass.


printGraph

public void printGraph()
Prints the graph in terms of methods and call sites they contain.


recursivePrintGraph

private void recursivePrintGraph(soot.SootMethod sm,
                                 java.util.HashSet visited)
Recursive method that is used to walk the graph tree.


getTargetsOfRoot

public java.util.List getTargetsOfRoot()

getEntryMethods

public java.util.List getEntryMethods(java.util.List methods)

getEnvInterfaceMethods

public java.util.List getEnvInterfaceMethods()

getUnitMethods

public java.util.List getUnitMethods()

getStatistics

public void getStatistics()