vasco.callgraph
Class PointsToAnalysis

java.lang.Object
  extended by vasco.InterProceduralAnalysis<M,N,A>
      extended by vasco.OldForwardInterProceduralAnalysis<SootMethod,Unit,PointsToGraph>
          extended by vasco.callgraph.PointsToAnalysis

public class PointsToAnalysis
extends OldForwardInterProceduralAnalysis<SootMethod,Unit,PointsToGraph>

An inter-procedural analysis for constructing a context-sensitive call graph on-the-fly.

This analysis uses the value-based context-sensitive inter-procedural framework and was developed as an example instantiation of the framework.

The analysis uses PointsToGraph objects as data flow values, which in turn abstracts heap locations using allocation sites.

Warning! The current implementation of this class uses the old API (see OldForwardInterProceduralAnalysis) without separate call/return flow functions. The developer is currently in the process of migrating this implementation to the new API (see ForwardInterProceduralAnalysis).

Author:
Rohan Padhye

Field Summary
 
Fields inherited from class vasco.OldForwardInterProceduralAnalysis
analysisStack
 
Fields inherited from class vasco.InterProceduralAnalysis
contexts, contextTransitions, freeResultsOnTheFly, reverse, verbose, worklist
 
Constructor Summary
PointsToAnalysis()
          Constructs a new points-to analysis as a forward-flow inter-procedural analysis.
 
Method Summary
 PointsToGraph boundaryValue(SootMethod entryPoint)
          Returns a points-to graph with the locals of main initialised to null, except the command-line arguments which are initialised to an array of strings.
 PointsToGraph copy(PointsToGraph graph)
          Returns a copy of the given points-to graph.
protected  PointsToGraph flowFunction(Context<SootMethod,Unit,PointsToGraph> context, Unit unit, PointsToGraph in)
          Performs operations on points-to graphs depending on the statement inside a CFG node.
protected  PointsToGraph handleInvoke(Context<SootMethod,Unit,PointsToGraph> callerContext, Stmt callStmt, InvokeExpr ie, PointsToGraph in)
          Handles a call site by resolving the targets of the method invocation.
 PointsToGraph meet(PointsToGraph op1, PointsToGraph op2)
          Returns the union of two points-to graphs.
 ProgramRepresentation<SootMethod,Unit> programRepresentation()
          Returns a program representation on top of which the inter-procedural analysis runs.
 PointsToGraph topValue()
          The default data flow value (lattice top) is the empty points-to graph.
 
Methods inherited from class vasco.OldForwardInterProceduralAnalysis
doAnalysis, initContext, processCall
 
Methods inherited from class vasco.InterProceduralAnalysis
getCallers, getContext, getContexts, getContextTransitionTable, getMeetOverValidPathsSolution, getMethods, getTargets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointsToAnalysis

public PointsToAnalysis()
Constructs a new points-to analysis as a forward-flow inter-procedural analysis.

Method Detail

boundaryValue

public PointsToGraph boundaryValue(SootMethod entryPoint)
Returns a points-to graph with the locals of main initialised to null, except the command-line arguments which are initialised to an array of strings.

Specified by:
boundaryValue in class InterProceduralAnalysis<SootMethod,Unit,PointsToGraph>
Parameters:
entryPoint - an entry point specified by the program representation
Returns:
the data flow value at the boundary
See Also:
ProgramRepresentation.getEntryPoints()

copy

public PointsToGraph copy(PointsToGraph graph)
Returns a copy of the given points-to graph.

Specified by:
copy in class InterProceduralAnalysis<SootMethod,Unit,PointsToGraph>
Parameters:
graph - the data flow value to copy
Returns:
a new data flow value which is a copy of the argument

flowFunction

protected PointsToGraph flowFunction(Context<SootMethod,Unit,PointsToGraph> context,
                                     Unit unit,
                                     PointsToGraph in)
Performs operations on points-to graphs depending on the statement inside a CFG node.

Specified by:
flowFunction in class OldForwardInterProceduralAnalysis<SootMethod,Unit,PointsToGraph>

handleInvoke

protected PointsToGraph handleInvoke(Context<SootMethod,Unit,PointsToGraph> callerContext,
                                     Stmt callStmt,
                                     InvokeExpr ie,
                                     PointsToGraph in)
Handles a call site by resolving the targets of the method invocation. The resultant flow is the union of the exit flows of all the analysed callees. If the method returns a reference-like value, this is also taken into account.


meet

public PointsToGraph meet(PointsToGraph op1,
                          PointsToGraph op2)
Returns the union of two points-to graphs.

Specified by:
meet in class InterProceduralAnalysis<SootMethod,Unit,PointsToGraph>
Parameters:
op1 - the first operand
op2 - the second operand
Returns:
a new data flow which is the result of the meet operation of the two operands

topValue

public PointsToGraph topValue()
The default data flow value (lattice top) is the empty points-to graph.

Specified by:
topValue in class InterProceduralAnalysis<SootMethod,Unit,PointsToGraph>
Returns:
the default data flow value (lattice top)

programRepresentation

public ProgramRepresentation<SootMethod,Unit> programRepresentation()
Description copied from class: InterProceduralAnalysis
Returns a program representation on top of which the inter-procedural analysis runs. The program representation is used to build control flow graphs of individual procedures and resolve targets of virtual call sites.

Specified by:
programRepresentation in class InterProceduralAnalysis<SootMethod,Unit,PointsToGraph>
Returns:
The program representation underlying this analysis