Package edu.umd.cs.findbugs.ba
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 java.lang.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.
- Author:
- David Hovemeyer
-
-
Constructor Summary
Constructors Constructor Description BasicAbstractDataflowAnalysis()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
edgeTransfer(Edge edge, Fact fact)
Edge transfer function.java.lang.String
factToString(Fact fact)
Return a String representation of given Fact.void
finishIteration()
Called after finishing an iteration of analysis.Fact
getFactAfterLocation(Location location)
Get the dataflow fact representing the point just after given Location.Fact
getFactAtLocation(Location location)
Get dataflow fact at (just before) given Location.Fact
getFactOnEdge(Edge edge)
Get the fact that is true on the given control edge, after applying the edge transfer function (if any).int
getLastUpdateTimestamp(Fact fact)
Fact
getResultFact(BasicBlock block)
Get the result fact for given basic block.Fact
getStartFact(BasicBlock block)
Get the start fact for given basic block.java.util.Iterator<Fact>
resultFactIterator()
Get an iterator over the result facts.void
setLastUpdateTimestamp(Fact fact, int lastUpdateTimestamp)
void
startIteration()
Called before beginning an iteration of analysis.-
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
copy, createFact, getBlockOrder, initEntryFact, isForwards, isTop, makeFactTop, meetInto, same, transfer
-
-
-
-
Method Detail
-
resultFactIterator
public java.util.Iterator<Fact> resultFactIterator()
Get an iterator over the result facts.
-
factToString
public java.lang.String factToString(Fact fact)
Description copied from interface:DataflowAnalysis
Return a String representation of given Fact. For debugging purposes.- Specified by:
factToString
in interfaceDataflowAnalysis<Fact>
- Parameters:
fact
- a dataflow fact- Returns:
- String representation of the fact
-
getStartFact
public Fact getStartFact(BasicBlock block)
Description copied from interface:DataflowAnalysis
Get the start fact for given basic block.- Specified by:
getStartFact
in interfaceDataflowAnalysis<Fact>
- Parameters:
block
- the basic block
-
getResultFact
public Fact getResultFact(BasicBlock block)
Description copied from interface:DataflowAnalysis
Get the result fact for given basic block.- Specified by:
getResultFact
in interfaceDataflowAnalysis<Fact>
- Parameters:
block
- the basic block
-
getFactAtLocation
public Fact getFactAtLocation(Location location) throws DataflowAnalysisException
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:
getFactAtLocation
in interfaceDataflowAnalysis<Fact>
- Parameters:
location
- the Location- Returns:
- the dataflow value at given Location
- Throws:
DataflowAnalysisException
-
getFactAfterLocation
public Fact getFactAfterLocation(Location location) throws DataflowAnalysisException
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:
getFactAfterLocation
in interfaceDataflowAnalysis<Fact>
- Parameters:
location
- the Location- Returns:
- the dataflow value after given Location
- Throws:
DataflowAnalysisException
-
getFactOnEdge
public Fact getFactOnEdge(Edge edge) throws DataflowAnalysisException
Get the fact that is true on the given control edge, after applying the edge transfer function (if any).- Specified by:
getFactOnEdge
in 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:DataflowAnalysis
Called before beginning an iteration of analysis. Each iteration visits every basic block in the CFG.- Specified by:
startIteration
in interfaceDataflowAnalysis<Fact>
-
finishIteration
public void finishIteration()
Description copied from interface:DataflowAnalysis
Called after finishing an iteration of analysis.- Specified by:
finishIteration
in interfaceDataflowAnalysis<Fact>
-
edgeTransfer
public void edgeTransfer(Edge edge, Fact 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<Fact>
- Parameters:
edge
- the Edgefact
- a dataflow fact- Throws:
DataflowAnalysisException
-
getLastUpdateTimestamp
public int getLastUpdateTimestamp(Fact fact)
- Specified by:
getLastUpdateTimestamp
in interfaceDataflowAnalysis<Fact>
-
setLastUpdateTimestamp
public void setLastUpdateTimestamp(Fact fact, int lastUpdateTimestamp)
- Specified by:
setLastUpdateTimestamp
in interfaceDataflowAnalysis<Fact>
-
-