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.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, getNodeManagerMethods inherited from class AbstractNumberedLabeledGraph
addEdge, edgeString, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodeNumbers, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodeNumbers, getSuccNodes, hasEdge, removeEdgeMethods inherited from class AbstractNumberedGraph
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodesMethods inherited from class AbstractGraph
addEdge, addNode, containsNode, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, nodeString, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, stream, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface EdgeManager
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdgesMethods inherited from interface Graph
removeNodeAndEdgesMethods inherited from interface IFlowGraph
addSubgraphForNode, getPossibleTargets, getPotentialCallers, hasSubgraphForNodeMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface LabeledEdgeManager
addEdge, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodes, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodes, hasEdge, removeEdgeMethods inherited from interface NodeManager
addNode, containsNode, getNumberOfNodes, iterator, removeNode, streamMethods inherited from interface NumberedEdgeManager
getPredNodeNumbers, getSuccNodeNumbersMethods inherited from interface 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: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
public Iterator<? extends Object> getWritesToStaticField(StaticFieldKey sfk) throws IllegalArgumentException - 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
public Iterator<? extends Object> getReadsOfStaticField(StaticFieldKey sfk) throws IllegalArgumentException - 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
-