vasco
Interface ProgramRepresentation<M,N>

Type Parameters:
M - the type of a method
N - the type of a node in the CFG
All Known Implementing Classes:
ContextSensitiveJimpleRepresentation, DefaultJimpleRepresentation

public interface ProgramRepresentation<M,N>

A wrapper for the API used by the underlying intermediate representation over which inter-procedural analysis is to be performed.

In particular, the program representation should specify program entry points, build control flow graphs for a given method and resolve virtual method calls.

Author:
Rohan Padhye

Method Summary
 DirectedGraph<N> getControlFlowGraph(M method)
          Returns an intra-procedural control-flow-graph for a given procedure (method).
 List<M> getEntryPoints()
          Returns a list of program entry points (methods).
 boolean isCall(N node)
          Returns whether a given node contains a method call.
 List<M> resolveTargets(M callerMethod, N callNode)
          Returns a list of target methods for call in the given node.
 

Method Detail

getEntryPoints

List<M> getEntryPoints()
Returns a list of program entry points (methods). The entry points may be static or non-static.

Client analyses implementing an InterProceduralAnalysis must implement the boundaryValue method for each entry point specified by the program representation.

Returns:
a list of program entry points (methods)

getControlFlowGraph

DirectedGraph<N> getControlFlowGraph(M method)
Returns an intra-procedural control-flow-graph for a given procedure (method).

The returned CFG may include exceptional control transfer in addition to conditional and unconditional jumps, but does not include inter-procedural call/return edges. Nodes containing method calls are treated like nodes containing ordinary imperative instructions.

Parameters:
method - the method whose CFG to return
Returns:
an intra-procedural control-flow-graph for a given procedure (method)

isCall

boolean isCall(N node)
Returns whether a given node contains a method call.

Parameters:
node - a node in the control-flow graph
Returns:
whether a given node contains a method call.

resolveTargets

List<M> resolveTargets(M callerMethod,
                       N callNode)
Returns a list of target methods for call in the given node.

For static methods and special invocations (such as constructors), there will be only one target, and hence a singleton list will be returned.

For virtual calls, there may be multiple targets which are resolved using an available call graph.

If even a single target does not have an analysable method body (e.g. native methods in Java), then null is returned, to indicate that the targets cannot be properly resolved. TODO: Native method flow functions?

Parameters:
callerMethod - the method in which the call statement originates
callNode - 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