|
|||||||||
| 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>
edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis<FrameType>
edu.umd.cs.findbugs.ba.FrameDataflowAnalysis<IsNullValue,IsNullValueFrame>
edu.umd.cs.findbugs.ba.IsNullValueAnalysis
public class IsNullValueAnalysis
A dataflow analysis to detect potential null pointer dereferences.
IsNullValue,
IsNullValueFrame,
IsNullValueFrameModelingVisitor| Field Summary | |
|---|---|
private static boolean |
DEBUG
|
private IsNullValueFrame |
lastFrame
|
private org.apache.bcel.generic.MethodGen |
methodGen
|
private static boolean |
NO_SPLIT_DOWNGRADE_NSP
|
private static boolean |
NO_SWITCH_DEFAULT_AS_EXCEPTION
|
private static java.util.BitSet |
nullComparisonInstructionSet
|
private int[] |
numNonExceptionSuccessorMap
|
(package private) static boolean |
UNKNOWN_VALUES_ARE_NSP
If this property is true, then we assume parameters and return values can be null (but aren't definitely null). |
private IsNullValueFrameModelingVisitor |
visitor
|
private ValueNumberDataflow |
vnaDataflow
|
| Fields inherited from interface edu.umd.cs.findbugs.ba.EdgeTypes |
|---|
BACKEDGE_SOURCE_EDGE, BACKEDGE_TARGET_EDGE, CHECKED_EXCEPTIONS_FLAG, EXIT_EDGE, EXPLICIT_EXCEPTIONS_FLAG, FALL_THROUGH_EDGE, GOTO_EDGE, HANDLED_EXCEPTION_EDGE, IFCMP_EDGE, JSR_EDGE, RET_EDGE, RETURN_EDGE, START_EDGE, SWITCH_DEFAULT_EDGE, SWITCH_EDGE, UNHANDLED_EXCEPTION_EDGE, UNKNOWN_EDGE |
| Constructor Summary | |
|---|---|
IsNullValueAnalysis(org.apache.bcel.generic.MethodGen methodGen,
CFG cfg,
ValueNumberDataflow vnaDataflow,
DepthFirstSearch dfs,
AssertionMethods assertionMethods)
|
|
| Method Summary | |
|---|---|
IsNullValueFrame |
createFact()
Create empty (uninitialized) dataflow facts for one program point. |
void |
endTransfer(BasicBlock basicBlock,
org.apache.bcel.generic.InstructionHandle end,
java.lang.Object result_)
Subclasses may override this. |
private IsNullConditionDecision |
getDecision(BasicBlock basicBlock,
IsNullValueFrame lastFrame)
Determine if the given basic block ends in a redundant null comparison. |
void |
initEntryFact(IsNullValueFrame result)
Initialize the "entry" fact for the graph. |
static void |
main(java.lang.String[] argv)
Test driver. |
void |
meetInto(IsNullValueFrame fact,
Edge edge,
IsNullValueFrame result)
Meet a dataflow fact associated with an incoming edge into another fact. |
protected IsNullValue |
mergeValues(IsNullValueFrame frame,
int slot,
IsNullValue a,
IsNullValue b)
Merge two values in a particular slot of a Frame. |
private IsNullValueFrame |
replaceValues(IsNullValueFrame origFrame,
IsNullValueFrame frame,
ValueNumber replaceMe,
ValueNumberFrame prevVnaFrame,
ValueNumberFrame targetVnaFrame,
IsNullValue replacementValue)
Update is-null information at a branch target based on information gained at a null comparison branch. |
void |
startTransfer(BasicBlock basicBlock,
java.lang.Object start_)
Subclasses may override this. |
void |
transferInstruction(org.apache.bcel.generic.InstructionHandle handle,
BasicBlock basicBlock,
IsNullValueFrame fact)
Transfer function for a single instruction. |
| Methods inherited from class edu.umd.cs.findbugs.ba.FrameDataflowAnalysis |
|---|
copy, initResultFact, isFactValid, makeFactTop, mergeInto, modifyFrame, same |
| Methods inherited from class edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis |
|---|
getBlockOrder, getDepthFirstSearch, isForwards |
| Methods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis |
|---|
factToString, getFactAfterLocation, getFactAtLocation, getResultFact, getStartFact, resultFactIterator, transfer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final boolean DEBUG
private static final boolean NO_SPLIT_DOWNGRADE_NSP
private static final boolean NO_SWITCH_DEFAULT_AS_EXCEPTION
static final boolean UNKNOWN_VALUES_ARE_NSP
private org.apache.bcel.generic.MethodGen methodGen
private IsNullValueFrameModelingVisitor visitor
private ValueNumberDataflow vnaDataflow
private int[] numNonExceptionSuccessorMap
private IsNullValueFrame lastFrame
private static final java.util.BitSet nullComparisonInstructionSet
| Constructor Detail |
|---|
public IsNullValueAnalysis(org.apache.bcel.generic.MethodGen methodGen,
CFG cfg,
ValueNumberDataflow vnaDataflow,
DepthFirstSearch dfs,
AssertionMethods assertionMethods)
| Method Detail |
|---|
public IsNullValueFrame createFact()
DataflowAnalysis
createFact in interface DataflowAnalysis<IsNullValueFrame>public void initEntryFact(IsNullValueFrame result)
DataflowAnalysis
initEntryFact in interface DataflowAnalysis<IsNullValueFrame>
public void startTransfer(BasicBlock basicBlock,
java.lang.Object start_)
throws DataflowAnalysisException
AbstractDataflowAnalysis
startTransfer in class AbstractDataflowAnalysis<IsNullValueFrame>basicBlock - the basic blockstart_ - the start fact for the block
DataflowAnalysisException
public void endTransfer(BasicBlock basicBlock,
org.apache.bcel.generic.InstructionHandle end,
java.lang.Object result_)
throws DataflowAnalysisException
AbstractDataflowAnalysis
endTransfer in class AbstractDataflowAnalysis<IsNullValueFrame>basicBlock - the basic blockend - last instruction analyzed (null if entire block was analyzed)result_ - the result fact for the block
DataflowAnalysisException
public void transferInstruction(org.apache.bcel.generic.InstructionHandle handle,
BasicBlock basicBlock,
IsNullValueFrame fact)
throws DataflowAnalysisException
AbstractDataflowAnalysis
transferInstruction in class AbstractDataflowAnalysis<IsNullValueFrame>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 void meetInto(IsNullValueFrame fact,
Edge edge,
IsNullValueFrame result)
throws DataflowAnalysisException
DataflowAnalysis
meetInto in interface DataflowAnalysis<IsNullValueFrame>fact - the predecessor fact (incoming edge)edge - the edge from the predecessorresult - the result fact
DataflowAnalysisException
protected IsNullValue mergeValues(IsNullValueFrame frame,
int slot,
IsNullValue a,
IsNullValue b)
throws DataflowAnalysisException
FrameDataflowAnalysis
mergeValues in class FrameDataflowAnalysis<IsNullValue,IsNullValueFrame>frame - the Frameslot - the slot of the Framea - a valueb - another value
DataflowAnalysisException
private IsNullConditionDecision getDecision(BasicBlock basicBlock,
IsNullValueFrame lastFrame)
throws DataflowAnalysisException
basicBlock - the basic blocklastFrame - the IsNullValueFrame representing values at the final instruction
of the block
DataflowAnalysisException
private IsNullValueFrame replaceValues(IsNullValueFrame origFrame,
IsNullValueFrame frame,
ValueNumber replaceMe,
ValueNumberFrame prevVnaFrame,
ValueNumberFrame targetVnaFrame,
IsNullValue replacementValue)
origFrame - the original is-null frame at entry to basic blockframe - the modified version of the is-null entry frame;
null if the entry frame has not been modified yetreplaceMe - the ValueNumber in the value number frame at the if comparison
whose is-null information will be updatedprevVnaFrame - the ValueNumberFrame at the if comparisontargetVnaFrame - the ValueNumberFrame at entry to the basic blockreplacementValue - the IsNullValue representing the updated
is-null information
public static void main(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||