Package com.ibm.wala.demandpa.flowgraph
Class SimpleDemandPointerFlowGraph
- java.lang.Object
-
- com.ibm.wala.util.graph.AbstractGraph<T>
-
- com.ibm.wala.util.graph.AbstractNumberedGraph<T>
-
- com.ibm.wala.util.graph.impl.SlowSparseNumberedGraph<Object>
-
- com.ibm.wala.demandpa.flowgraph.SimpleDemandPointerFlowGraph
-
- All Implemented Interfaces:
EdgeManager<Object>,Graph<Object>,NodeManager<Object>,NumberedEdgeManager<Object>,NumberedGraph<Object>,NumberedNodeManager<Object>,Serializable,Iterable<Object>
public class SimpleDemandPointerFlowGraph extends SlowSparseNumberedGraph<Object>
The nodes in this graph are PointerKeys corresponding to local variables and static fields, InstanceKeys, and FieldRefs (see below). This graph is constructed on-demand during a traversal. The edges represent- flow from local -> local representing assignment (i.e. phi,pi)
- flow from instancekey -> local for news
- flow from formal -> actual parameter
- flow from return value -> local
- match edges
- local -> local edges representing loads/stores (e.g. x = y.f will have a edge x->y, labelled with f) for a getstatic x = Y.f, we have an edge from x -> Y.f.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSimpleDemandPointerFlowGraph.StatementVisitorA visitor that generates graph nodes and edges for an IR.
-
Constructor Summary
Constructors Constructor Description SimpleDemandPointerFlowGraph(CallGraph cg, HeapModel heapModel, MemoryAccessMap fam, IClassHierarchy cha)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction,ISSABasicBlock> cfg, ISSABasicBlock b, SimpleDemandPointerFlowGraph.StatementVisitor v)Add constraints for a particular basic block.protected voidaddNodeInstructionConstraints(CGNode node, IR ir, DefUse du)Add pointer flow constraints based on instructions in a given nodeprotected voidaddNodePassthruExceptionConstraints(CGNode node, IR ir)Add constraints to represent the flow of exceptions to the exceptional return value for this nodevoidaddSubgraphForNode(CGNode node)protected HeapModelgetHeapModel()intgetPredNodeCount(Object N)Return the number ofimmediate predecessornodes of nIntSetgetPredNodeNumbers(Object node)Iterator<Object>getPredNodes(Object N)Return anIteratorover the immediate predecessor nodes of n This method never returnsnull.intgetSuccNodeCount(Object N)Return the number ofimmediate successornodes of this Node in the GraphIntSetgetSuccNodeNumbers(Object node)Iterator<Object>getSuccNodes(Object N)Return an Iterator over the immediate successor nodes of nbooleanhasEdge(PointerKey src, PointerKey dst)protected SimpleDemandPointerFlowGraph.StatementVisitormakeVisitor(ExplicitCallGraph.ExplicitNode node, IR ir, DefUse du)protected voidunconditionallyAddConstraintsFromNode(CGNode node)-
Methods inherited from class com.ibm.wala.util.graph.impl.SlowSparseNumberedGraph
copyInto, duplicate, getEdgeManager, getNodeManager, make
-
Methods inherited from class com.ibm.wala.util.graph.AbstractNumberedGraph
getMaxNumber, getNode, getNumber, iterateNodes
-
Methods inherited from class com.ibm.wala.util.graph.AbstractGraph
addEdge, addNode, containsNode, getNumberOfNodes, hasEdge, iterator, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.ibm.wala.util.graph.EdgeManager
addEdge, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
-
Methods inherited from interface com.ibm.wala.util.graph.Graph
removeNodeAndEdges
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.ibm.wala.util.graph.NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode
-
-
-
-
Constructor Detail
-
SimpleDemandPointerFlowGraph
public SimpleDemandPointerFlowGraph(CallGraph cg, HeapModel heapModel, MemoryAccessMap fam, IClassHierarchy cha)
-
-
Method Detail
-
addSubgraphForNode
public void addSubgraphForNode(CGNode node)
-
getHeapModel
protected HeapModel getHeapModel()
- Returns:
- Returns the heapModel.
-
getPredNodeNumbers
public IntSet getPredNodeNumbers(Object node) throws UnimplementedError
- Specified by:
getPredNodeNumbersin interfaceNumberedEdgeManager<Object>- Overrides:
getPredNodeNumbersin classAbstractNumberedGraph<Object>- Returns:
- the numbers identifying the immediate predecessors of node
- Throws:
UnimplementedError
-
getSuccNodeNumbers
public IntSet getSuccNodeNumbers(Object node) throws IllegalArgumentException
- Specified by:
getSuccNodeNumbersin interfaceNumberedEdgeManager<Object>- Overrides:
getSuccNodeNumbersin classAbstractNumberedGraph<Object>- Returns:
- the numbers identifying the immediate successors of node
- Throws:
IllegalArgumentException
-
getPredNodeCount
public int getPredNodeCount(Object N) throws UnimplementedError
Description copied from interface:EdgeManagerReturn the number ofimmediate predecessornodes of n- Specified by:
getPredNodeCountin interfaceEdgeManager<Object>- Overrides:
getPredNodeCountin classAbstractGraph<Object>- Returns:
- the number of immediate predecessors of n.
- Throws:
UnimplementedError
-
getPredNodes
public Iterator<Object> getPredNodes(Object N) throws IllegalArgumentException
Description copied from interface:EdgeManagerReturn anIteratorover the immediate predecessor nodes of n This method never returnsnull.- Specified by:
getPredNodesin interfaceEdgeManager<Object>- Overrides:
getPredNodesin classAbstractGraph<Object>- Returns:
- an
Iteratorover the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException
-
getSuccNodeCount
public int getSuccNodeCount(Object N) throws UnimplementedError
Description copied from interface:EdgeManagerReturn the number ofimmediate successornodes of this Node in the Graph- Specified by:
getSuccNodeCountin interfaceEdgeManager<Object>- Overrides:
getSuccNodeCountin classAbstractGraph<Object>- Returns:
- the number of immediate successor Nodes of this Node in the Graph.
- Throws:
UnimplementedError
-
getSuccNodes
public Iterator<Object> getSuccNodes(Object N)
Description copied from interface:EdgeManagerReturn an Iterator over the immediate successor nodes of nThis method never returns
null.- Specified by:
getSuccNodesin interfaceEdgeManager<Object>- Overrides:
getSuccNodesin classAbstractGraph<Object>- Returns:
- an Iterator over the immediate successor nodes of n
-
hasEdge
public boolean hasEdge(PointerKey src, PointerKey dst)
-
unconditionallyAddConstraintsFromNode
protected void unconditionallyAddConstraintsFromNode(CGNode node)
-
addNodePassthruExceptionConstraints
protected void addNodePassthruExceptionConstraints(CGNode node, IR ir)
Add constraints to represent the flow of exceptions to the exceptional return value for this node
-
addNodeInstructionConstraints
protected void addNodeInstructionConstraints(CGNode node, IR ir, DefUse du)
Add pointer flow constraints based on instructions in a given node
-
addBlockInstructionConstraints
protected void addBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction,ISSABasicBlock> cfg, ISSABasicBlock b, SimpleDemandPointerFlowGraph.StatementVisitor v)
Add constraints for a particular basic block.
-
makeVisitor
protected SimpleDemandPointerFlowGraph.StatementVisitor makeVisitor(ExplicitCallGraph.ExplicitNode node, IR ir, DefUse du)
-
-