Package edu.umd.cs.findbugs.ba.jsr305
Class TypeQualifierDataflowAnalysis
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<Fact>
-
- edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<TypeQualifierValueSet>
-
- edu.umd.cs.findbugs.ba.jsr305.TypeQualifierDataflowAnalysis
-
- All Implemented Interfaces:
DataflowAnalysis<TypeQualifierValueSet>
- Direct Known Subclasses:
BackwardTypeQualifierDataflowAnalysis
,ForwardTypeQualifierDataflowAnalysis
public abstract class TypeQualifierDataflowAnalysis extends AbstractDataflowAnalysis<TypeQualifierValueSet>
Abstract base class for type qualifier dataflow analyses.- Author:
- David Hovemeyer
-
-
Field Summary
Fields Modifier and Type Field Description protected CFG
cfg
protected org.apache.bcel.generic.ConstantPoolGen
cpg
protected TypeQualifierValue<?>
typeQualifierValue
protected ValueNumberDataflow
vnaDataflow
protected XMethod
xmethod
-
Constructor Summary
Constructors Constructor Description TypeQualifierDataflowAnalysis(XMethod xmethod, CFG cfg, ValueNumberDataflow vnaDataflow, org.apache.bcel.generic.ConstantPoolGen cpg, TypeQualifierValue<?> typeQualifierValue)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
copy(TypeQualifierValueSet source, TypeQualifierValueSet dest)
Copy dataflow facts.TypeQualifierValueSet
createFact()
Create empty (uninitialized) dataflow facts for one program point.void
edgeTransfer(Edge edge, TypeQualifierValueSet fact)
Edge transfer function.java.util.Set<SourceSinkInfo>
getSourceSinkInfoSet(Location location)
Get the set of SourceSinkInfo objects representing sources/sinks at a given Location.void
initEntryFact(TypeQualifierValueSet result)
Initialize the "entry" fact for the graph.boolean
isFactValid(TypeQualifierValueSet fact)
Determine whether the given fact is valid (neither top nor bottom).boolean
isTop(TypeQualifierValueSet fact)
Is the given fact the top value.void
makeFactTop(TypeQualifierValueSet fact)
Make given fact the top value.void
meetInto(TypeQualifierValueSet fact, Edge edge, TypeQualifierValueSet result)
Meet a dataflow fact associated with an incoming edge into another fact.protected abstract void
propagateAcrossPhiNode(TypeQualifierValueSet fact, ValueNumber sourceVN, ValueNumber targetVN)
protected void
registerSourceSink(SourceSinkInfo sourceSinkInfo)
abstract void
registerSourceSinkLocations()
This method must be called before the dataflow analysis is executed.boolean
same(TypeQualifierValueSet fact1, TypeQualifierValueSet fact2)
Are given dataflow facts the same?void
transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, TypeQualifierValueSet fact)
Transfer function for a single instruction.-
Methods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis
getFactAfterLocation, getFactAtLocation, transfer
-
Methods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis
factToString, finishIteration, getFactOnEdge, getLastUpdateTimestamp, getResultFact, getStartFact, resultFactIterator, setLastUpdateTimestamp, startIteration
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.umd.cs.findbugs.ba.DataflowAnalysis
getBlockOrder, isForwards
-
-
-
-
Field Detail
-
xmethod
protected final XMethod xmethod
-
cfg
protected final CFG cfg
-
vnaDataflow
protected final ValueNumberDataflow vnaDataflow
-
typeQualifierValue
protected final TypeQualifierValue<?> typeQualifierValue
-
cpg
protected final org.apache.bcel.generic.ConstantPoolGen cpg
-
-
Constructor Detail
-
TypeQualifierDataflowAnalysis
public TypeQualifierDataflowAnalysis(XMethod xmethod, CFG cfg, ValueNumberDataflow vnaDataflow, org.apache.bcel.generic.ConstantPoolGen cpg, TypeQualifierValue<?> typeQualifierValue)
Constructor.- Parameters:
xmethod
- XMethod object containing information about the method being analyzedcfg
- the control-flow graph (CFG) of the method being analyzedvnaDataflow
- ValueNumberDataflow for the methodcpg
- the constant pool being built uptypeQualifierValue
- the TypeQualifierValue we want the dataflow analysis to check
-
-
Method Detail
-
initEntryFact
public void initEntryFact(TypeQualifierValueSet result) throws DataflowAnalysisException
Description copied from interface:DataflowAnalysis
Initialize the "entry" fact for the graph.- Throws:
DataflowAnalysisException
-
isFactValid
public boolean isFactValid(TypeQualifierValueSet fact)
Description copied from class:AbstractDataflowAnalysis
Determine whether the given fact is valid (neither top nor bottom).- Specified by:
isFactValid
in classAbstractDataflowAnalysis<TypeQualifierValueSet>
-
copy
public void copy(TypeQualifierValueSet source, TypeQualifierValueSet dest)
Description copied from interface:DataflowAnalysis
Copy dataflow facts.
-
createFact
public TypeQualifierValueSet createFact()
Description copied from interface:DataflowAnalysis
Create empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used.
-
isTop
public boolean isTop(TypeQualifierValueSet fact)
Description copied from interface:DataflowAnalysis
Is the given fact the top value.
-
makeFactTop
public void makeFactTop(TypeQualifierValueSet fact)
Description copied from interface:DataflowAnalysis
Make given fact the top value.
-
meetInto
public void meetInto(TypeQualifierValueSet fact, Edge edge, TypeQualifierValueSet result) throws DataflowAnalysisException
Description copied from interface:DataflowAnalysis
Meet a dataflow fact associated with an incoming edge into another fact. This is used to determine the start fact for a basic block.- Parameters:
fact
- the predecessor fact (incoming edge)edge
- the edge from the predecessorresult
- the result fact- Throws:
DataflowAnalysisException
-
same
public boolean same(TypeQualifierValueSet fact1, TypeQualifierValueSet fact2)
Description copied from interface:DataflowAnalysis
Are given dataflow facts the same?
-
edgeTransfer
public void edgeTransfer(Edge edge, TypeQualifierValueSet fact) throws DataflowAnalysisException
Description copied from interface:DataflowAnalysis
Edge transfer function. Modify the given fact that is true on the (logical) edge source to modify it so that it is true at the (logical) edge target.A do-nothing implementation is legal, and appropriate for analyses where branches are not significant.
- Specified by:
edgeTransfer
in interfaceDataflowAnalysis<TypeQualifierValueSet>
- Overrides:
edgeTransfer
in classBasicAbstractDataflowAnalysis<TypeQualifierValueSet>
- Parameters:
edge
- the Edgefact
- a dataflow fact- Throws:
DataflowAnalysisException
-
propagateAcrossPhiNode
protected abstract void propagateAcrossPhiNode(TypeQualifierValueSet fact, ValueNumber sourceVN, ValueNumber targetVN)
-
registerSourceSinkLocations
public abstract void registerSourceSinkLocations() throws DataflowAnalysisException
This method must be called before the dataflow analysis is executed.- Throws:
DataflowAnalysisException
-
registerSourceSink
protected void registerSourceSink(SourceSinkInfo sourceSinkInfo)
-
getSourceSinkInfoSet
public java.util.Set<SourceSinkInfo> getSourceSinkInfoSet(Location location)
Get the set of SourceSinkInfo objects representing sources/sinks at a given Location.- Parameters:
location
- a Location- Returns:
- Set of SourceSinkInfo objects representing sources/sinks at the Location
-
transferInstruction
public void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, TypeQualifierValueSet fact) throws DataflowAnalysisException
Description copied from class:AbstractDataflowAnalysis
Transfer function for a single instruction.- Specified by:
transferInstruction
in classAbstractDataflowAnalysis<TypeQualifierValueSet>
- Parameters:
handle
- the instructionbasicBlock
- the BasicBlock containing the instruction; needed to disambiguate instructions in inlined JSR subroutinesfact
- which should be modified based on the instruction- Throws:
DataflowAnalysisException
-
-