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
IFlowLabels.- Author:
- Manu Sridharan
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<PointerKey, SSAAbstractInvokeInstruction> Map: LocalPointerKey -> SSAInvokeInstruction.protected final Map<PointerKey, Set<SSAAbstractInvokeInstruction>> protected final CallGraphprotected final IClassHierarchyprotected final HeapModelprotected final MemoryAccessMapprotected final Map<PointerKey, CGNode> Map: LocalPointerKey -> CGNode.protected final Map<PointerKey, CGNode> Map:LocalPointerKey->CGNode. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFlowGraph(MemoryAccessMap mam, HeapModel heapModel, IClassHierarchy cha, CallGraph cg) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddExceptionDefConstraints(IR ir, CGNode node, List<ProgramCounter> peis, PointerKey exceptionVar, Set<IClass> catchClasses) Generate constraints which assign exception values into an exception pointerprotected voidaddNodeConstantConstraints(CGNode node, IR ir) add constraints for reference constants assigned to varsprotected voidaddNodePassthruExceptionConstraints(CGNode node, IR ir) Add constraints to represent the flow of exceptions to the exceptional return value for this nodeprotected voidaddNodesForInvocations(CGNode node, IR ir) For each invocation in the method, add nodes for actual parameters and return valuesstatic PointerKeyconvert a pointer key to one in the memory access map's heap modelprotected Iterator<PointerKey> getArrayReads(PointerKey arrayRef) get theSSAInvokeInstructionwhose return value is assigned to a pointer key.Iterator<?> Iterator<?> booleanvoidvisitPreds(Object node, IFlowLabel.IFlowLabelVisitor v) Apply a visitor to the predecessors of some node.voidvisitSuccs(Object node, IFlowLabel.IFlowLabelVisitor v) Apply a visitor to the successors of some node.Methods inherited from class SlowSparseNumberedLabeledGraph
copyInto, duplicate, getEdgeManager, getNodeManagerModifier and TypeMethodDescriptionstatic <T,U> void copyInto(LabeledGraph<T, U> g, LabeledGraph<T, U> into) static <T,U> SlowSparseNumberedLabeledGraph <T, U> duplicate(LabeledGraph<T, U> g) protected NumberedLabeledEdgeManager<Object, IFlowLabel> protected NumberedNodeManager<Object> Methods inherited from class AbstractNumberedLabeledGraph
addEdge, edgeString, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodeNumbers, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodeNumbers, getSuccNodes, hasEdge, removeEdgeModifier and TypeMethodDescriptionvoidaddEdge(Object src, Object dst, IFlowLabel label) adds an edge with some labelprotected StringedgeString(Object from, Object to) Sets the default object used as label for operations where no specific edge label is provided.Set<? extends IFlowLabel> getEdgeLabels(Object src, Object dst) Returns a set of all labeled edges between node src and node dstIterator<? extends IFlowLabel> intgetPredNodeCount(Object N, IFlowLabel label) Return the number ofimmediate predecessornodes of this Node in the Graph on edges with some label.getPredNodeNumbers(Object node, IFlowLabel label) getPredNodes(Object N, IFlowLabel label) Return an Iterator over the immediate predecessor nodes of this Node in the Graph on edges with some label.Iterator<? extends IFlowLabel> intgetSuccNodeCount(Object N, IFlowLabel label) Return the number ofimmediate successornodes of this Node in the GraphgetSuccNodeNumbers(Object node, IFlowLabel label) getSuccNodes(Object N, IFlowLabel label) Return an Iterator over the immediate successor nodes of this Node in the Graph on edges with some label.booleanhasEdge(Object src, Object dst, IFlowLabel label) voidremoveEdge(Object src, Object dst, IFlowLabel label) Methods inherited from class AbstractNumberedGraph
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodesModifier and TypeMethodDescriptionintgetNode(int number) intgetPredNodeNumbers(Object node) getSuccNodeNumbers(Object node) Methods inherited from class AbstractGraph
addEdge, addNode, containsNode, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, nodeString, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, stream, toStringModifier and TypeMethodDescriptionvoidvoidadd a node to this graphbooleanintintReturn 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 nbooleaniterator()protected StringnodeString(Object n, boolean forEdge) voidremoveAllIncidentEdges(Object node) voidremoveEdge(Object src, Object dst) voidremoveIncomingEdges(Object node) voidremoveNode(Object n) remove a node from this graphvoidremove a node and all its incident edgesvoidremoveOutgoingEdges(Object node) stream()toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IFlowGraph
addSubgraphForNode, getPossibleTargets, getPotentialCallers, hasSubgraphForNodeModifier and TypeMethodDescriptionvoidaddSubgraphForNode(CGNode node) add representation of flow for a node, if not already presentgetPossibleTargets(CGNode caller, CallSiteReference site, LocalPointerKey actualPk) get the callees that should be considered at a particular call sitegetPotentialCallers(PointerKey formalPk) booleanhasSubgraphForNode(CGNode node) Methods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface LabeledEdgeManager
getPredNodes
-
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:IFlowGraphApply a visitor to the successors of some node.- Specified by:
visitSuccsin interfaceIFlowGraph
-
visitPreds
Description copied from interface:IFlowGraphApply a visitor to the predecessors of some node.- Specified by:
visitPredsin interfaceIFlowGraph
-
addNodesForInvocations
-
isParam
- Specified by:
isParamin interfaceIFlowGraph- Returns:
trueiffpkis a formal parameter
-
getInstrsPassingParam
- Specified by:
getInstrsPassingParamin interfaceIFlowGraph- Returns:
- the
SSAInvokeInstructions passing some pointer as a parameter
-
getInstrReturningTo
Description copied from interface:IFlowGraphget theSSAInvokeInstructionwhose return value is assigned to a pointer key.- Specified by:
getInstrReturningToin interfaceIFlowGraph- Returns:
- the instruction, or
nullif no return value is assigned to pk
-
getWritesToStaticField
- Specified by:
getWritesToStaticFieldin interfaceIFlowGraph- Parameters:
sfk- the static field- Returns:
- all the variables whose values are written to sfk
- Throws:
IllegalArgumentException- if sfk == null
-
getReadsOfStaticField
- Specified by:
getReadsOfStaticFieldin interfaceIFlowGraph- Parameters:
sfk- the static field- Returns:
- all the variables that get the value of sfk
- Throws:
IllegalArgumentException- if sfk == null
-
getWritesToInstanceField
- Specified by:
getWritesToInstanceFieldin 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:
getReadsOfInstanceFieldin 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
-