Package edu.umd.cs.findbugs.ba
Class FrameDataflowAnalysis<ValueType,FrameType extends Frame<ValueType>>
java.lang.Object
edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<FrameType>
edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<FrameType>
edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis<FrameType>
edu.umd.cs.findbugs.ba.FrameDataflowAnalysis<ValueType,FrameType>
- All Implemented Interfaces:
DataflowAnalysis<FrameType>
- Direct Known Subclasses:
ConstantAnalysis,IsNullValueAnalysis,ResourceValueAnalysis,TypeAnalysis,ValueNumberAnalysis
public abstract class FrameDataflowAnalysis<ValueType,FrameType extends Frame<ValueType>>
extends ForwardDataflowAnalysis<FrameType>
A convenient base class for dataflow analysis classes which use Frames as
values.
- Author:
- David Hovemeyer
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCopy dataflow facts.getFactAtPC(CFG cfg, int pc) Get the dataflow fact representing the point just before given Location.getFactBeforeExceptionCheck(CFG cfg, int pc) Get the dataflow fact representing the point just before given Location.intbooleanisFactValid(FrameType fact) Determine whether the given fact is valid (neither top nor bottom).booleanIs the given fact the top value.voidmakeFactTop(FrameType fact) Make given fact the top value.protected voidMerge one frame into another.protected abstract voidmergeValues(FrameType otherFrame, FrameType resultFrame, int slot) Merge the values contained in a given slot of two Frames.protected final FrameTypemodifyFrame(FrameType orig, FrameType copy) Create a modifiable copy of a frame.booleanAre given dataflow facts the same?voidsetLastUpdateTimestamp(FrameType fact, int lastTimestamp) Methods inherited from class edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis
getBlockOrder, getDepthFirstSearch, isForwardsMethods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis
getFactAfterLocation, getFactAtLocation, transfer, transferInstructionMethods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis
edgeTransfer, factToString, finishIteration, getFactOnEdge, getResultFact, getStartFact, resultFactIterator, startIterationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.umd.cs.findbugs.ba.DataflowAnalysis
createFact, initEntryFact, meetInto
-
Constructor Details
-
FrameDataflowAnalysis
-
-
Method Details
-
copy
Description copied from interface:DataflowAnalysisCopy dataflow facts. -
makeFactTop
Description copied from interface:DataflowAnalysisMake given fact the top value. -
isTop
Description copied from interface:DataflowAnalysisIs the given fact the top value. -
same
Description copied from interface:DataflowAnalysisAre given dataflow facts the same? -
getFactAtPC
Get the dataflow fact representing the point just before given Location. Note "before" is meant in the logical sense, so for backward analyses, before means after the location in the control flow sense.- Returns:
- the fact at the point just before the location
- Throws:
DataflowAnalysisException
-
getFactBeforeExceptionCheck
Get the dataflow fact representing the point just before given Location. Note "before" is meant in the logical sense, so for backward analyses, before means after the location in the control flow sense.- Returns:
- the fact at the point just before the location
- Throws:
DataflowAnalysisException
-
isFactValid
Description copied from class:AbstractDataflowAnalysisDetermine whether the given fact is valid (neither top nor bottom).- Specified by:
isFactValidin classAbstractDataflowAnalysis<FrameType extends Frame<ValueType>>
-
getLastUpdateTimestamp
- Specified by:
getLastUpdateTimestampin interfaceDataflowAnalysis<ValueType>- Overrides:
getLastUpdateTimestampin classBasicAbstractDataflowAnalysis<FrameType extends Frame<ValueType>>
-
setLastUpdateTimestamp
- Specified by:
setLastUpdateTimestampin interfaceDataflowAnalysis<ValueType>- Overrides:
setLastUpdateTimestampin classBasicAbstractDataflowAnalysis<FrameType extends Frame<ValueType>>
-
modifyFrame
Create a modifiable copy of a frame. This is useful for meetInto(), if the frame needs to be modified in a path-sensitive fashion. A typical usage pattern is:FrameType copy = null; if (someCondition()) { copy = modifyFrame(fact, copy); // modify copy } if (someOtherCondition()) { copy = modifyFrame(fact, copy); // modify copy } if (copy != null) fact = copy; mergeInto(fact, result);The advantage of using modifyFrame() is that new code can be added before or after other places where the frame is modified, and the code will remain correct.- Parameters:
orig- the original framecopy- the modifiable copy (returned by a previous call to modifyFrame()), or null if this is the first time modifyFrame() is being called- Returns:
- a modifiable copy of fact
-
mergeInto
Merge one frame into another.- Parameters:
other- the frame to merge with the resultresult- the result frame, which is modified to be the merge of the two frames- Throws:
DataflowAnalysisException
-
mergeValues
protected abstract void mergeValues(FrameType otherFrame, FrameType resultFrame, int slot) throws DataflowAnalysisException Merge the values contained in a given slot of two Frames.- Parameters:
otherFrame- a FrameresultFrame- a Frame which will contain the resulting merged valueslot- a slot in both frames- Throws:
DataflowAnalysisException
-