public abstract class AbstractFlowGraph extends SlowSparseNumberedLabeledGraph<Object,IFlowLabel> implements IFlowGraph
IFlowLabel
s.Modifier and Type | Field and Description |
---|---|
protected Map<PointerKey,SSAAbstractInvokeInstruction> |
callDefs
Map: LocalPointerKey -> SSAInvokeInstruction.
|
protected Map<PointerKey,Set<SSAAbstractInvokeInstruction>> |
callParams
Map:
LocalPointerKey -> Set<SSAInvokeInstruction >. |
protected CallGraph |
cg |
protected IClassHierarchy |
cha |
protected HeapModel |
heapModel |
protected MemoryAccessMap |
mam |
protected Map<PointerKey,CGNode> |
params
Map: LocalPointerKey -> CGNode.
|
protected Map<PointerKey,CGNode> |
returns
Map:
LocalPointerKey -> CGNode . |
Constructor and Description |
---|
AbstractFlowGraph(MemoryAccessMap mam,
HeapModel heapModel,
IClassHierarchy cha,
CallGraph cg) |
Modifier and Type | Method and Description |
---|---|
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
|
protected void |
addNodeConstantConstraints(CGNode node,
IR ir)
add constraints for reference constants assigned to vars
|
protected void |
addNodePassthruExceptionConstraints(CGNode node,
IR ir)
Add constraints to represent the flow of exceptions to the exceptional return value for this node
|
protected void |
addNodesForInvocations(CGNode node,
IR ir)
For each invocation in the method, add nodes for actual parameters and return values
|
static PointerKey |
convertPointerKeyToHeapModel(PointerKey pk,
HeapModel h)
convert a pointer key to one in the memory access map's heap model
TODO move this somewhere more appropriate
|
protected Iterator<PointerKey> |
getArrayReads(PointerKey arrayRef) |
SSAAbstractInvokeInstruction |
getInstrReturningTo(LocalPointerKey pk)
get the
SSAInvokeInstruction whose return value is assigned to a pointer key. |
Iterator<SSAAbstractInvokeInstruction> |
getInstrsPassingParam(LocalPointerKey pk) |
Iterator<PointerKey> |
getReadsOfInstanceField(PointerKey pk,
IField f) |
Iterator<? extends Object> |
getReadsOfStaticField(StaticFieldKey sfk) |
Iterator<PointerKey> |
getWritesToInstanceField(PointerKey pk,
IField f) |
Iterator<? extends Object> |
getWritesToStaticField(StaticFieldKey sfk) |
boolean |
isParam(LocalPointerKey pk) |
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.
|
copyInto, duplicate, getEdgeManager, getNodeManager
addEdge, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodeNumbers, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodeNumbers, getSuccNodes, hasEdge, removeEdge
getMaxNumber, getNode, getNumber, getPredNodeNumbers, getSuccNodeNumbers, iterateNodes
addEdge, addNode, containsNode, getNumberOfNodes, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, iterator, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeNode, removeNodeAndEdges, removeOutgoingEdges, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addSubgraphForNode, getPossibleTargets, getPotentialCallers, hasSubgraphForNode
removeNodeAndEdges
addNode, containsNode, getNumberOfNodes, iterator, removeNode
forEach, spliterator
addEdge, getDefaultLabel, getEdgeLabels, getPredLabels, getPredNodeCount, getPredNodes, getSuccLabels, getSuccNodeCount, getSuccNodes, hasEdge, removeEdge
addEdge, getPredNodeCount, getPredNodes, getSuccNodeCount, getSuccNodes, hasEdge, removeAllIncidentEdges, removeEdge, removeIncomingEdges, removeOutgoingEdges
protected final Map<PointerKey,SSAAbstractInvokeInstruction> callDefs
protected final Map<PointerKey,Set<SSAAbstractInvokeInstruction>> callParams
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.protected final Map<PointerKey,CGNode> params
LocalPointerKey
protected final Map<PointerKey,CGNode> returns
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.protected final MemoryAccessMap mam
protected final HeapModel heapModel
protected final IClassHierarchy cha
protected final CallGraph cg
public AbstractFlowGraph(MemoryAccessMap mam, HeapModel heapModel, IClassHierarchy cha, CallGraph cg)
public void visitSuccs(Object node, IFlowLabel.IFlowLabelVisitor v)
IFlowGraph
visitSuccs
in interface IFlowGraph
public void visitPreds(Object node, IFlowLabel.IFlowLabelVisitor v)
IFlowGraph
visitPreds
in interface IFlowGraph
protected void addNodesForInvocations(CGNode node, IR ir)
node
- public boolean isParam(LocalPointerKey pk)
isParam
in interface IFlowGraph
true
iff pk
is a formal parameterpublic Iterator<SSAAbstractInvokeInstruction> getInstrsPassingParam(LocalPointerKey pk)
getInstrsPassingParam
in interface IFlowGraph
SSAInvokeInstruction
s passing some pointer as a parameterpublic SSAAbstractInvokeInstruction getInstrReturningTo(LocalPointerKey pk)
IFlowGraph
SSAInvokeInstruction
whose return value is assigned to a pointer key.getInstrReturningTo
in interface IFlowGraph
null
if no return value is assigned to pkpublic Iterator<? extends Object> getWritesToStaticField(StaticFieldKey sfk) throws IllegalArgumentException
getWritesToStaticField
in interface IFlowGraph
sfk
- the static fieldIllegalArgumentException
- if sfk == nullpublic Iterator<? extends Object> getReadsOfStaticField(StaticFieldKey sfk) throws IllegalArgumentException
getReadsOfStaticField
in interface IFlowGraph
sfk
- the static fieldIllegalArgumentException
- if sfk == nullpublic Iterator<PointerKey> getWritesToInstanceField(PointerKey pk, IField f)
getWritesToInstanceField
in interface IFlowGraph
public static PointerKey convertPointerKeyToHeapModel(PointerKey pk, HeapModel h)
UnsupportedOperationException
- if it doesn't know how to handle a PointerKey
public Iterator<PointerKey> getReadsOfInstanceField(PointerKey pk, IField f)
getReadsOfInstanceField
in interface IFlowGraph
protected Iterator<PointerKey> getArrayReads(PointerKey arrayRef)
protected void addNodePassthruExceptionConstraints(CGNode node, IR ir)
protected void addExceptionDefConstraints(IR ir, CGNode node, List<ProgramCounter> peis, PointerKey exceptionVar, Set<IClass> catchClasses)
node
- governing nodepeis
- list of PEI instructionsexceptionVar
- PointerKey representing a pointer to an exception valuecatchClasses
- the types "caught" by the exceptionVar