Package edu.umd.cs.findbugs.ba
Class LiveLocalStoreAnalysis
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<Fact>
-
- edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<Fact>
-
- edu.umd.cs.findbugs.ba.BackwardDataflowAnalysis<java.util.BitSet>
-
- edu.umd.cs.findbugs.ba.LiveLocalStoreAnalysis
-
- All Implemented Interfaces:
DataflowAnalysis<java.util.BitSet>,Debug
public class LiveLocalStoreAnalysis extends BackwardDataflowAnalysis<java.util.BitSet> implements Debug
Dataflow analysis to find live stores of locals. This is just a backward analysis to see which loads reach stores of the same local.This analysis also computes which stores that were killed by a subsequent store on any subsequent reachable path. (The FindDeadLocalStores detector uses this information to reduce false positives.)
- Author:
- David Hovemeyer
-
-
Field Summary
-
Fields inherited from interface edu.umd.cs.findbugs.ba.Debug
VERIFY_INTEGRITY
-
-
Constructor Summary
Constructors Constructor Description LiveLocalStoreAnalysis(org.apache.bcel.generic.MethodGen methodGen, ReverseDepthFirstSearch rdfs, DepthFirstSearch dfs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopy(java.util.BitSet source, java.util.BitSet dest)Copy dataflow facts.java.util.BitSetcreateFact()Create empty (uninitialized) dataflow facts for one program point.java.lang.StringfactToString(java.util.BitSet fact)Return a String representation of given Fact.voidinitEntryFact(java.util.BitSet result)Initialize the "entry" fact for the graph.booleanisFactValid(java.util.BitSet fact)Determine whether the given fact is valid (neither top nor bottom).booleanisStoreAlive(java.util.BitSet fact, int local)Return whether or not a store of given local is alive.booleanisTop(java.util.BitSet fact)Return whether or not given fact is the special TOP value.booleankilledByStore(java.util.BitSet fact, int local)Return whether or not a store of given local was killed by a subsequent (dominated) store.voidmakeFactTop(java.util.BitSet fact)Make given fact the top value.voidmeetInto(java.util.BitSet fact, Edge edge, java.util.BitSet result)Meet a dataflow fact associated with an incoming edge into another fact.booleansame(java.util.BitSet fact1, java.util.BitSet fact2)Are given dataflow facts the same?voidtransferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, java.util.BitSet fact)Transfer function for a single instruction.-
Methods inherited from class edu.umd.cs.findbugs.ba.BackwardDataflowAnalysis
getBlockOrder, getReverseDepthFirstSearch, isForwards
-
Methods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis
getFactAfterLocation, getFactAtLocation, transfer
-
Methods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis
edgeTransfer, finishIteration, getFactOnEdge, getLastUpdateTimestamp, getResultFact, getStartFact, resultFactIterator, setLastUpdateTimestamp, startIteration
-
-
-
-
Constructor Detail
-
LiveLocalStoreAnalysis
public LiveLocalStoreAnalysis(org.apache.bcel.generic.MethodGen methodGen, ReverseDepthFirstSearch rdfs, DepthFirstSearch dfs)
-
-
Method Detail
-
createFact
public java.util.BitSet createFact()
Description copied from interface:DataflowAnalysisCreate empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used.- Specified by:
createFactin interfaceDataflowAnalysis<java.util.BitSet>
-
copy
public void copy(java.util.BitSet source, java.util.BitSet dest)Description copied from interface:DataflowAnalysisCopy dataflow facts.- Specified by:
copyin interfaceDataflowAnalysis<java.util.BitSet>
-
initEntryFact
public void initEntryFact(java.util.BitSet result) throws DataflowAnalysisExceptionDescription copied from interface:DataflowAnalysisInitialize the "entry" fact for the graph.- Specified by:
initEntryFactin interfaceDataflowAnalysis<java.util.BitSet>- Throws:
DataflowAnalysisException
-
makeFactTop
public void makeFactTop(java.util.BitSet fact)
Description copied from interface:DataflowAnalysisMake given fact the top value.- Specified by:
makeFactTopin interfaceDataflowAnalysis<java.util.BitSet>
-
same
public boolean same(java.util.BitSet fact1, java.util.BitSet fact2)Description copied from interface:DataflowAnalysisAre given dataflow facts the same?- Specified by:
samein interfaceDataflowAnalysis<java.util.BitSet>
-
meetInto
public void meetInto(java.util.BitSet fact, Edge edge, java.util.BitSet result) throws DataflowAnalysisExceptionDescription copied from interface:DataflowAnalysisMeet a dataflow fact associated with an incoming edge into another fact. This is used to determine the start fact for a basic block.- Specified by:
meetIntoin interfaceDataflowAnalysis<java.util.BitSet>- Parameters:
fact- the predecessor fact (incoming edge)edge- the edge from the predecessorresult- the result fact- Throws:
DataflowAnalysisException
-
transferInstruction
public void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, java.util.BitSet fact) throws DataflowAnalysisExceptionDescription copied from class:AbstractDataflowAnalysisTransfer function for a single instruction.- Specified by:
transferInstructionin classAbstractDataflowAnalysis<java.util.BitSet>- 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
-
isFactValid
public boolean isFactValid(java.util.BitSet fact)
Description copied from class:AbstractDataflowAnalysisDetermine whether the given fact is valid (neither top nor bottom).- Specified by:
isFactValidin classAbstractDataflowAnalysis<java.util.BitSet>
-
factToString
public java.lang.String factToString(java.util.BitSet fact)
Description copied from interface:DataflowAnalysisReturn a String representation of given Fact. For debugging purposes.- Specified by:
factToStringin interfaceDataflowAnalysis<java.util.BitSet>- Overrides:
factToStringin classBasicAbstractDataflowAnalysis<java.util.BitSet>- Parameters:
fact- a dataflow fact- Returns:
- String representation of the fact
-
isTop
public boolean isTop(java.util.BitSet fact)
Return whether or not given fact is the special TOP value.- Specified by:
isTopin interfaceDataflowAnalysis<java.util.BitSet>
-
isStoreAlive
public boolean isStoreAlive(java.util.BitSet fact, int local)Return whether or not a store of given local is alive.- Parameters:
fact- a dataflow fact created by this analysislocal- the local
-
killedByStore
public boolean killedByStore(java.util.BitSet fact, int local)Return whether or not a store of given local was killed by a subsequent (dominated) store.
-
-