Class AbstractFlowGraph
java.lang.Object
com.ibm.wala.util.graph.AbstractGraph<Object>
com.ibm.wala.util.graph.AbstractNumberedGraph<Object>
com.ibm.wala.util.graph.labeled.AbstractNumberedLabeledGraph<Object,IFlowLabel>
com.ibm.wala.util.graph.labeled.SlowSparseNumberedLabeledGraph<Object,IFlowLabel>
com.ibm.wala.demandpa.flowgraph.AbstractFlowGraph
- All Implemented Interfaces:
IFlowGraph
,EdgeManager<Object>
,Graph<Object>
,LabeledEdgeManager<Object,
,IFlowLabel> LabeledGraph<Object,
,IFlowLabel> NumberedLabeledEdgeManager<Object,
,IFlowLabel> NumberedLabeledGraph<Object,
,IFlowLabel> NodeManager<Object>
,NumberedEdgeManager<Object>
,NumberedGraph<Object>
,NumberedNodeManager<Object>
,Serializable
,Iterable<Object>
- Direct Known Subclasses:
AbstractDemandFlowGraph
public abstract class AbstractFlowGraph
extends SlowSparseNumberedLabeledGraph<Object,IFlowLabel>
implements IFlowGraph
A graph whose edges are labeled with
IFlowLabel
s.- Author:
- Manu Sridharan
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map
<PointerKey, SSAAbstractInvokeInstruction> Map: LocalPointerKey -> SSAInvokeInstruction.protected final Map
<PointerKey, Set<SSAAbstractInvokeInstruction>> protected final CallGraph
protected final IClassHierarchy
protected final HeapModel
protected final MemoryAccessMap
protected final Map
<PointerKey, CGNode> Map: LocalPointerKey -> CGNode.protected final Map
<PointerKey, CGNode> Map:LocalPointerKey
->CGNode
. -
Constructor Summary
ConstructorDescriptionAbstractFlowGraph
(MemoryAccessMap mam, HeapModel heapModel, IClassHierarchy cha, CallGraph cg) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addExceptionDefConstraints
(IR ir, CGNode node, List<ProgramCounter> peis, PointerKey exceptionVar, Set<IClass> catchClasses) Generate constraints which assign exception values into an exception pointerprotected void
addNodeConstantConstraints
(CGNode node, IR ir) add constraints for reference constants assigned to varsprotected void
addNodePassthruExceptionConstraints
(CGNode node, IR ir) Add constraints to represent the flow of exceptions to the exceptional return value for this nodeprotected void
addNodesForInvocations
(CGNode node, IR ir) For each invocation in the method, add nodes for actual parameters and return valuesstatic PointerKey
convert a pointer key to one in the memory access map's heap modelprotected Iterator
<PointerKey> getArrayReads
(PointerKey arrayRef) get theSSAInvokeInstruction
whose return value is assigned to a pointer key.boolean
void
visitPreds
(Object node, IFlowLabel.IFlowLabelVisitor v) Apply a visitor to the predecessors of some node.void
visitSuccs
(Object node, IFlowLabel.IFlowLabelVisitor v) Apply a visitor to the successors of some node.Methods inherited from class com.ibm.wala.util.graph.labeled.SlowSparseNumberedLabeledGraph
copyInto, duplicate, getEdgeManager, getNodeManager
Methods inherited from class com.ibm.wala.util.graph.labeled.AbstractNumberedLabeledGraph
addEdge, edgeString, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodeNumbers, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodeNumbers, getSuccNodes, hasEdge, removeEdge
Methods inherited from class com.ibm.wala.util.graph.AbstractNumberedGraph
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodes
Methods inherited from class com.ibm.wala.util.graph.AbstractGraph
addEdge, addNode, containsNode, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, nodeString, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, stream, 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, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
Methods inherited from interface com.ibm.wala.util.graph.Graph
removeNodeAndEdges
Methods inherited from interface com.ibm.wala.demandpa.flowgraph.IFlowGraph
addSubgraphForNode, getPossibleTargets, getPotentialCallers, hasSubgraphForNode
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.ibm.wala.util.graph.labeled.LabeledEdgeManager
addEdge, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodes, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodes, hasEdge, removeEdge
Methods inherited from interface com.ibm.wala.util.graph.NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode, stream
Methods inherited from interface com.ibm.wala.util.graph.NumberedEdgeManager
getPredNodeNumbers, getSuccNodeNumbers
Methods inherited from interface com.ibm.wala.util.graph.NumberedNodeManager
getMaxNumber, getNode, getNumber, iterateNodes
-
Field Details
-
callDefs
Map: LocalPointerKey -> SSAInvokeInstruction. If we have (x, foo()), that means that x was def'fed by the return value from the call to foo() -
callParams
Map:LocalPointerKey
->Set
<SSAInvokeInstruction
>. If we have (x, foo()), that means x was passed as a parameter to the call to foo(). The parameter position is not represented and must be recovered. -
params
Map: LocalPointerKey -> CGNode. If we have (x, foo), then x is a parameter of method foo. For now, we have to re-discover the parameter position. TODO this should just be a set; we can get the CGNode from theLocalPointerKey
-
returns
Map:LocalPointerKey
->CGNode
. If we have (x, foo), then x is a return value of method foo. Must re-discover if x is normal or exceptional return value. -
mam
-
heapModel
-
cha
-
cg
-
-
Constructor Details
-
AbstractFlowGraph
public AbstractFlowGraph(MemoryAccessMap mam, HeapModel heapModel, IClassHierarchy cha, CallGraph cg)
-
-
Method Details
-
visitSuccs
Description copied from interface:IFlowGraph
Apply a visitor to the successors of some node.- Specified by:
visitSuccs
in interfaceIFlowGraph
-
visitPreds
Description copied from interface:IFlowGraph
Apply a visitor to the predecessors of some node.- Specified by:
visitPreds
in interfaceIFlowGraph
-
addNodesForInvocations
-
isParam
- Specified by:
isParam
in interfaceIFlowGraph
- Returns:
true
iffpk
is a formal parameter
-
getInstrsPassingParam
- Specified by:
getInstrsPassingParam
in interfaceIFlowGraph
- Returns:
- the
SSAInvokeInstruction
s passing some pointer as a parameter
-
getInstrReturningTo
Description copied from interface:IFlowGraph
get theSSAInvokeInstruction
whose return value is assigned to a pointer key.- Specified by:
getInstrReturningTo
in interfaceIFlowGraph
- Returns:
- the instruction, or
null
if no return value is assigned to pk
-
getWritesToStaticField
public Iterator<? extends Object> getWritesToStaticField(StaticFieldKey sfk) throws IllegalArgumentException - Specified by:
getWritesToStaticField
in interfaceIFlowGraph
- Parameters:
sfk
- the static field- Returns:
- all the variables whose values are written to sfk
- Throws:
IllegalArgumentException
- if sfk == null
-
getReadsOfStaticField
public Iterator<? extends Object> getReadsOfStaticField(StaticFieldKey sfk) throws IllegalArgumentException - Specified by:
getReadsOfStaticField
in interfaceIFlowGraph
- Parameters:
sfk
- the static field- Returns:
- all the variables that get the value of sfk
- Throws:
IllegalArgumentException
- if sfk == null
-
getWritesToInstanceField
- Specified by:
getWritesToInstanceField
in interfaceIFlowGraph
-
convertPointerKeyToHeapModel
convert a pointer key to one in the memory access map's heap modelTODO move this somewhere more appropriate
- Throws:
UnsupportedOperationException
- if it doesn't know how to handle aPointerKey
-
getReadsOfInstanceField
- Specified by:
getReadsOfInstanceField
in interfaceIFlowGraph
-
getArrayReads
-
addNodePassthruExceptionConstraints
-
addExceptionDefConstraints
protected void addExceptionDefConstraints(IR ir, CGNode node, List<ProgramCounter> peis, PointerKey exceptionVar, Set<IClass> catchClasses) Generate constraints which assign exception values into an exception pointer- Parameters:
node
- governing nodepeis
- list of PEI instructionsexceptionVar
- PointerKey representing a pointer to an exception valuecatchClasses
- the types "caught" by the exceptionVar
-
addNodeConstantConstraints
-