|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<Fact>
public abstract class AbstractDataflowAnalysis<Fact>
Abstract base class providing functionality that will be useful for most dataflow analysis implementations. In particular, it implements the transfer() function by calling down to the transferInstruction() function. It also maintains a map of the dataflow fact for every location in the CFG, which is useful when using the results of the analysis.
Dataflow
,
DataflowAnalysis
Field Summary | |
---|---|
private static boolean |
DEBUG
|
private java.util.IdentityHashMap<BasicBlock,Fact> |
resultFactMap
|
private java.util.IdentityHashMap<BasicBlock,Fact> |
startFactMap
|
Constructor Summary | |
---|---|
AbstractDataflowAnalysis()
|
Method Summary | |
---|---|
void |
endTransfer(BasicBlock basicBlock,
org.apache.bcel.generic.InstructionHandle end,
java.lang.Object result)
Subclasses may override this. |
java.lang.String |
factToString(Fact fact)
Call this to get a dataflow value as a String. |
Fact |
getFactAfterLocation(Location location)
Get the dataflow fact representing the point just after given Location. |
Fact |
getFactAtLocation(Location location)
Get the dataflow fact representing the point just before given Location. |
Fact |
getResultFact(BasicBlock block)
Get the result fact for given basic block. |
Fact |
getStartFact(BasicBlock block)
Get the start fact for given basic block. |
abstract boolean |
isFactValid(Fact fact)
Determine whether the given fact is valid (neither top nor bottom). |
private Fact |
lookupOrCreateFact(java.util.Map<BasicBlock,Fact> map,
BasicBlock block)
|
java.util.Iterator<Fact> |
resultFactIterator()
Get an iterator over the result facts. |
void |
startTransfer(BasicBlock basicBlock,
java.lang.Object fact)
Subclasses may override this. |
void |
transfer(BasicBlock basicBlock,
org.apache.bcel.generic.InstructionHandle end,
Fact start,
Fact result)
Transfer function for the analysis. |
abstract void |
transferInstruction(org.apache.bcel.generic.InstructionHandle handle,
BasicBlock basicBlock,
Fact fact)
Transfer function for a single instruction. |
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, initResultFact, isForwards, makeFactTop, meetInto, same |
Field Detail |
---|
private static final boolean DEBUG
private java.util.IdentityHashMap<BasicBlock,Fact> startFactMap
private java.util.IdentityHashMap<BasicBlock,Fact> resultFactMap
Constructor Detail |
---|
public AbstractDataflowAnalysis()
Method Detail |
---|
public abstract void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, Fact fact) throws DataflowAnalysisException
handle
- the instructionbasicBlock
- the BasicBlock containing the instruction; needed to disambiguate
instructions in inlined JSR subroutinesfact
- which should be modified based on the instruction
DataflowAnalysisException
public abstract boolean isFactValid(Fact fact)
public void startTransfer(BasicBlock basicBlock, java.lang.Object fact) throws DataflowAnalysisException
basicBlock
- the basic blockfact
- the start fact for the block
DataflowAnalysisException
public void endTransfer(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle end, java.lang.Object result) throws DataflowAnalysisException
basicBlock
- the basic blockend
- last instruction analyzed (null if entire block was analyzed)result
- the result fact for the block
DataflowAnalysisException
public Fact getFactAtLocation(Location location) throws DataflowAnalysisException
location
- the location
DataflowAnalysisException
public Fact getFactAfterLocation(Location location) throws DataflowAnalysisException
DataflowAnalysisException
public java.util.Iterator<Fact> resultFactIterator()
public java.lang.String factToString(Fact fact)
public Fact getStartFact(BasicBlock block)
DataflowAnalysis
getStartFact
in interface DataflowAnalysis<Fact>
block
- the basic blockpublic Fact getResultFact(BasicBlock block)
DataflowAnalysis
getResultFact
in interface DataflowAnalysis<Fact>
block
- the basic blockprivate Fact lookupOrCreateFact(java.util.Map<BasicBlock,Fact> map, BasicBlock block)
public void transfer(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle end, Fact start, Fact result) throws DataflowAnalysisException
DataflowAnalysis
transfer
in interface DataflowAnalysis<Fact>
basicBlock
- the basic blockend
- if nonnull, stop before considering this instruction;
otherwise, consider all of the instructions in the basic blockstart
- dataflow facts at beginning of block (if forward analysis)
or end of block (if backwards analysis)result
- resulting dataflow facts at other end of block
DataflowAnalysisException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |