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 class
SimpleDemandPointerFlowGraph.StatementVisitor
A 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 void
addBlockInstructionConstraints(CGNode node, ControlFlowGraph<SSAInstruction,ISSABasicBlock> cfg, ISSABasicBlock b, SimpleDemandPointerFlowGraph.StatementVisitor v)
Add constraints for a particular basic block.protected void
addNodeInstructionConstraints(CGNode node, IR ir, DefUse du)
Add pointer flow constraints based on instructions in a given nodeprotected void
addNodePassthruExceptionConstraints(CGNode node, IR ir)
Add constraints to represent the flow of exceptions to the exceptional return value for this nodevoid
addSubgraphForNode(CGNode node)
protected HeapModel
getHeapModel()
int
getPredNodeCount(Object N)
Return the number ofimmediate predecessor
nodes of nIntSet
getPredNodeNumbers(Object node)
Iterator<Object>
getPredNodes(Object N)
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.int
getSuccNodeCount(Object N)
Return the number ofimmediate successor
nodes of this Node in the GraphIntSet
getSuccNodeNumbers(Object node)
Iterator<Object>
getSuccNodes(Object N)
Return an Iterator over the immediate successor nodes of nboolean
hasEdge(PointerKey src, PointerKey dst)
protected SimpleDemandPointerFlowGraph.StatementVisitor
makeVisitor(ExplicitCallGraph.ExplicitNode node, IR ir, DefUse du)
protected void
unconditionallyAddConstraintsFromNode(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:
getPredNodeNumbers
in interfaceNumberedEdgeManager<Object>
- Overrides:
getPredNodeNumbers
in classAbstractNumberedGraph<Object>
- Returns:
- the numbers identifying the immediate predecessors of node
- Throws:
UnimplementedError
-
getSuccNodeNumbers
public IntSet getSuccNodeNumbers(Object node) throws IllegalArgumentException
- Specified by:
getSuccNodeNumbers
in interfaceNumberedEdgeManager<Object>
- Overrides:
getSuccNodeNumbers
in 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:EdgeManager
Return the number ofimmediate predecessor
nodes of n- Specified by:
getPredNodeCount
in interfaceEdgeManager<Object>
- Overrides:
getPredNodeCount
in 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:EdgeManager
Return anIterator
over the immediate predecessor nodes of n This method never returnsnull
.- Specified by:
getPredNodes
in interfaceEdgeManager<Object>
- Overrides:
getPredNodes
in classAbstractGraph<Object>
- Returns:
- an
Iterator
over the immediate predecessor nodes of this Node. - Throws:
IllegalArgumentException
-
getSuccNodeCount
public int getSuccNodeCount(Object N) throws UnimplementedError
Description copied from interface:EdgeManager
Return the number ofimmediate successor
nodes of this Node in the Graph- Specified by:
getSuccNodeCount
in interfaceEdgeManager<Object>
- Overrides:
getSuccNodeCount
in 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:EdgeManager
Return an Iterator over the immediate successor nodes of nThis method never returns
null
.- Specified by:
getSuccNodes
in interfaceEdgeManager<Object>
- Overrides:
getSuccNodes
in 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)
-
-