vasco.soot
Class ContextSensitiveJimpleRepresentation

java.lang.Object
  extended by vasco.soot.ContextSensitiveJimpleRepresentation
All Implemented Interfaces:
ProgramRepresentation<MethodOrMethodContext,Unit>

public class ContextSensitiveJimpleRepresentation
extends Object
implements ProgramRepresentation<MethodOrMethodContext,Unit>

A program representation for Soot using the Jimple IR with a context-sensitive call graph. This representation uses control-flow graphs of individual units including exceptional control flow, and resolves virtual calls using the call graph returned by Scene#getContextSensitiveCallGraph.

Note: This class follows the Singleton pattern. The singleton object is available through v().

Author:
Rohan Padhye

Method Summary
 DirectedGraph<Unit> getControlFlowGraph(MethodOrMethodContext momc)
          Returns an ExceptionalUnitGraph for a given method.
 List<MethodOrMethodContext> getEntryPoints()
          Returns a singleton list containing the main method.
 boolean isCall(Unit node)
          Returns true iff the Jimple statement contains an invoke expression.
 List<MethodOrMethodContext> resolveTargets(MethodOrMethodContext momc, Unit node)
          Resolves virtual calls using the Soot's context-sensitive call graph and returns a list of method-contexts which are the targets of explicit edges.
static ContextSensitiveJimpleRepresentation v()
          Returns a reference to the singleton object of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEntryPoints

public List<MethodOrMethodContext> getEntryPoints()
Returns a singleton list containing the main method.

Specified by:
getEntryPoints in interface ProgramRepresentation<MethodOrMethodContext,Unit>
Returns:
a list of program entry points (methods)
See Also:
Scene.getMainMethod()

getControlFlowGraph

public DirectedGraph<Unit> getControlFlowGraph(MethodOrMethodContext momc)
Returns an ExceptionalUnitGraph for a given method.

Specified by:
getControlFlowGraph in interface ProgramRepresentation<MethodOrMethodContext,Unit>
Parameters:
momc - the method whose CFG to return
Returns:
an intra-procedural control-flow-graph for a given procedure (method)

isCall

public boolean isCall(Unit node)
Returns true iff the Jimple statement contains an invoke expression.

Specified by:
isCall in interface ProgramRepresentation<MethodOrMethodContext,Unit>
Parameters:
node - a node in the control-flow graph
Returns:
whether a given node contains a method call.

resolveTargets

public List<MethodOrMethodContext> resolveTargets(MethodOrMethodContext momc,
                                                  Unit node)
Resolves virtual calls using the Soot's context-sensitive call graph and returns a list of method-contexts which are the targets of explicit edges.

Specified by:
resolveTargets in interface ProgramRepresentation<MethodOrMethodContext,Unit>
Parameters:
momc - the method in which the call statement originates
node - the node containing the call statement
Returns:
a list of methods which are the target of this call, if their bodies are available, or else null in the case of native targets

v

public static ContextSensitiveJimpleRepresentation v()
Returns a reference to the singleton object of this class.