Class CHACallGraph
java.lang.Object
com.ibm.wala.util.graph.AbstractGraph<CGNode>
com.ibm.wala.util.graph.AbstractNumberedGraph<CGNode>
com.ibm.wala.ipa.callgraph.impl.BasicCallGraph<CHAContextInterpreter>
com.ibm.wala.ipa.callgraph.cha.CHACallGraph
- All Implemented Interfaces:
CallGraph, EdgeManager<CGNode>, Graph<CGNode>, NodeManager<CGNode>, NumberedEdgeManager<CGNode>, NumberedGraph<CGNode>, NumberedNodeManager<CGNode>, Iterable<CGNode>
Call graph in which call targets are determined entirely based on an
IClassHierarchy.-
Nested Class Summary
Nested classes/interfaces inherited from class BasicCallGraph
BasicCallGraph.Key, BasicCallGraph.NodeImplModifier and TypeClassDescriptionprotected static final classstatic classA class that represents the a normal node in a call graph. -
Field Summary
Fields inherited from class BasicCallGraph
mr2NodesModifier and TypeFieldDescriptionprotected final Map<MethodReference, Set<CGNode>> A mapping from MethodReference to Set of nodes that represent this methodReference. -
Constructor Summary
ConstructorsConstructorDescriptionNOTE: after calling this constructor,init(Iterable)must be invoked to complete initializationCHACallGraph(IClassHierarchy cha, boolean applicationOnly) NOTE: after calling this constructor,init(Iterable)must be invoked to complete initialization -
Method Summary
Modifier and TypeMethodDescriptionfindOrCreateNode(IMethod method, Context C) Use with extreme care.protected NumberedEdgeManager<CGNode> intgetNumberOfTargets(CGNode node, CallSiteReference site) getPossibleSites(CGNode src, CGNode target) getPossibleTargets(CGNode node, CallSiteReference site) Return the set of CGNodes that represent possible targets of a particular call site from a particular nodevoidinit(Iterable<Entrypoint> entrypoints) Builds the call graph data structures.protected CGNodeprotected CGNodeMethods inherited from class BasicCallGraph
containsNode, getEntrypointNodes, getFakeRootNode, getFakeWorldClinitNode, getInterpreter, getNode, getNode, getNodeManager, getNodes, getNumberOfNodes, init, iterator, nodeToString, registerEntrypoint, registerNode, removeNodeAndEdges, setInterpreter, summarizeByPackage, toStringModifier and TypeMethodDescriptionbooleanThis implementation is necessary because the underlying SparseNumberedGraph may not support node membership tests.Note: not all successors of the root node are entrypointsReturn the (fake) interproceduralroot nodeof the call graph.protected CHAContextInterpretergetInterpreter(CGNode node) If you want to get all the nodes corresponding to a particular method, regardless of context, then usegetNodesprotected CGNodeprotected NumberedNodeManager<CGNode> intWe override this since this class supports remove() on nodes, but the superclass doesn't.voidinit()iterator()We override this since this class supports remove() on nodes, but the superclass doesn't.static StringnodeToString(CallGraph CG, CGNode n) voidregisterEntrypoint(CGNode node) record that a node is an entrypointprotected voidvoidremove a node and all its incident edgesvoidsetInterpreter(CHAContextInterpreter interpreter) voidtoString()Methods inherited from class AbstractNumberedGraph
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodesModifier and TypeMethodDescriptionintgetNode(int number) intgetPredNodeNumbers(CGNode node) getSuccNodeNumbers(CGNode node) Methods inherited from class AbstractGraph
addEdge, addNode, edgeString, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, nodeString, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeOutgoingEdges, streamModifier and TypeMethodDescriptionvoidvoidadd a node to this graphprotected StringedgeString(CGNode from, CGNode to) intReturn the number ofimmediate predecessornodes of nReturn anIteratorover the immediate predecessor nodes of nintReturn the number ofimmediate successornodes of this Node in the GraphReturn an Iterator over the immediate successor nodes of nbooleanprotected StringnodeString(CGNode n, boolean forEdge) voidremoveAllIncidentEdges(CGNode node) voidremoveEdge(CGNode src, CGNode dst) voidremoveIncomingEdges(CGNode node) voidremoveNode(CGNode n) remove a node from this graphvoidremoveOutgoingEdges(CGNode node) stream()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
CHACallGraph
NOTE: after calling this constructor,init(Iterable)must be invoked to complete initialization -
CHACallGraph
NOTE: after calling this constructor,init(Iterable)must be invoked to complete initialization
-
-
Method Details
-
init
Builds the call graph data structures. The call graph will only include methods reachable from the provided entrypoints.- Throws:
CancelException
-
getClassHierarchy
- Returns:
- the governing class hierarchy for this call graph
-
getPossibleTargets
Description copied from interface:CallGraphReturn the set of CGNodes that represent possible targets of a particular call site from a particular node -
getNumberOfTargets
- Returns:
- the number of nodes that the call site may dispatch to
-
getPossibleSites
- Returns:
- iterator of CallSiteReference, the call sites in a node that might dispatch to the target node.
-
makeFakeRootNode
- Specified by:
makeFakeRootNodein classBasicCallGraph<CHAContextInterpreter>- Throws:
CancelException
-
makeFakeWorldClinitNode
- Specified by:
makeFakeWorldClinitNodein classBasicCallGraph<CHAContextInterpreter>- Throws:
CancelException
-
findOrCreateNode
Description copied from class:BasicCallGraphUse with extreme care.- Specified by:
findOrCreateNodein classBasicCallGraph<CHAContextInterpreter>- Throws:
CancelException- TODO
-
getEdgeManager
- Specified by:
getEdgeManagerin classAbstractNumberedGraph<CGNode>- Returns:
- the object which manages edges in the graph
-