Class BasicAbstractDataflowAnalysis<Fact>
java.lang.Object
edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<Fact>
- All Implemented Interfaces:
DataflowAnalysis<Fact>
- Direct Known Subclasses:
AbstractDataflowAnalysis, AbstractDominatorsAnalysis, BlockTypeAnalysis, ReturnPathTypeAnalysis
public abstract class BasicAbstractDataflowAnalysis<Fact>
extends Object
implements DataflowAnalysis<Fact>
A useful starting point for defining a dataflow analysis. Handles access and
caching of start and result facts for basic blocks.
Subclasses that model instructions within basic blocks should extend AbstractDataflowAnalysis.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IdentityHashMap<BasicBlock, Fact> private final IdentityHashMap<BasicBlock, Fact> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidedgeTransfer(Edge edge, Fact fact) Edge transfer function.factToString(Fact fact) Return a String representation of given Fact.voidCalled after finishing an iteration of analysis.getFactAfterLocation(Location location) Get the dataflow fact representing the point just after given Location.getFactAtLocation(Location location) Get dataflow fact at (just before) given Location.getFactOnEdge(Edge edge) Get the fact that is true on the given control edge, after applying the edge transfer function (if any).intgetLastUpdateTimestamp(Fact fact) getResultFact(BasicBlock block) Get the result fact for given basic block.getStartFact(BasicBlock block) Get the start fact for given basic block.private FactlookupOrCreateFact(Map<BasicBlock, Fact> map, BasicBlock block) Get an iterator over the result facts.voidsetLastUpdateTimestamp(Fact fact, int lastUpdateTimestamp) voidCalled before beginning an iteration of analysis.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataflowAnalysis
copy, createFact, getBlockOrder, initEntryFact, isForwards, isTop, makeFactTop, meetInto, same, transfer
-
Field Details
-
startFactMap
-
resultFactMap
-
-
Constructor Details
-
BasicAbstractDataflowAnalysis
protected BasicAbstractDataflowAnalysis()Constructor.
-
-
Method Details
-
resultFactIterator
-
factToString
Description copied from interface:DataflowAnalysisReturn a String representation of given Fact. For debugging purposes.- Specified by:
factToStringin interfaceDataflowAnalysis<Fact>- Parameters:
fact- a dataflow fact- Returns:
- String representation of the fact
-
getStartFact
Description copied from interface:DataflowAnalysisGet the start fact for given basic block.- Specified by:
getStartFactin interfaceDataflowAnalysis<Fact>- Parameters:
block- the basic block
-
getResultFact
Description copied from interface:DataflowAnalysisGet the result fact for given basic block.- Specified by:
getResultFactin interfaceDataflowAnalysis<Fact>- Parameters:
block- the basic block
-
getFactAtLocation
Get dataflow fact at (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.The default implementation ignores instructions within basic blocks. Subclasses that model individual instructions must override this method.
- Specified by:
getFactAtLocationin interfaceDataflowAnalysis<Fact>- Parameters:
location- the Location- Returns:
- the dataflow value at given Location
- Throws:
DataflowAnalysisException
-
getFactAfterLocation
Get the dataflow fact representing the point just after given Location. Note "after" is meant in the logical sense, so for backward analyses, after means before the location in the control flow sense.The default implementation ignores instructions within basic blocks. Subclasses that model individual instructions must override this method.
- Specified by:
getFactAfterLocationin interfaceDataflowAnalysis<Fact>- Parameters:
location- the Location- Returns:
- the dataflow value after given Location
- Throws:
DataflowAnalysisException
-
getFactOnEdge
Get the fact that is true on the given control edge, after applying the edge transfer function (if any).- Specified by:
getFactOnEdgein interfaceDataflowAnalysis<Fact>- Parameters:
edge- the edge- Returns:
- the fact that is true after applying the edge transfer function
- Throws:
DataflowAnalysisException
-
startIteration
public void startIteration()Description copied from interface:DataflowAnalysisCalled before beginning an iteration of analysis. Each iteration visits every basic block in the CFG.- Specified by:
startIterationin interfaceDataflowAnalysis<Fact>
-
finishIteration
public void finishIteration()Description copied from interface:DataflowAnalysisCalled after finishing an iteration of analysis.- Specified by:
finishIterationin interfaceDataflowAnalysis<Fact>
-
edgeTransfer
Description copied from interface:DataflowAnalysisEdge 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:
edgeTransferin interfaceDataflowAnalysis<Fact>- Parameters:
edge- the Edgefact- a dataflow fact- Throws:
DataflowAnalysisException
-
lookupOrCreateFact
-
getLastUpdateTimestamp
- Specified by:
getLastUpdateTimestampin interfaceDataflowAnalysis<Fact>
-
setLastUpdateTimestamp
- Specified by:
setLastUpdateTimestampin interfaceDataflowAnalysis<Fact>
-