|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoot.toolkits.scalar.AbstractFlowAnalysis<N,A>
soot.toolkits.scalar.BranchedFlowAnalysis<Unit,A>
soot.toolkits.scalar.ForwardBranchedFlowAnalysis
soot.jimple.toolkits.annotation.nullcheck.NullnessAnalysis
public class NullnessAnalysis
An intraprocedural nullness analysis that computes for each location and each value
in a method if the value is (before or after that location) definetely null,
definetely non-null or neither.
This class replaces BranchedRefVarsAnalysis
which is known to have bugs.
Nested Class Summary | |
---|---|
protected class |
NullnessAnalysis.AnalysisInfo
The analysis info is a simple mapping of type Value to
any of the constants BOTTOM, NON_NULL, NULL or TOP. |
Field Summary | |
---|---|
protected static int |
BOTTOM
|
protected static int |
NON_NULL
|
protected static int |
NULL
|
protected static int |
TOP
|
protected int |
used
|
protected HashMap<Value,Integer> |
valueToIndex
|
Fields inherited from class soot.toolkits.scalar.BranchedFlowAnalysis |
---|
unitToAfterBranchFlow, unitToAfterFallFlow |
Fields inherited from class soot.toolkits.scalar.AbstractFlowAnalysis |
---|
filterUnitToBeforeFlow, graph, unitToBeforeFlow |
Constructor Summary | |
---|---|
NullnessAnalysis(UnitGraph graph)
Creates a new analysis for the given graph/ |
Method Summary | |
---|---|
protected void |
copy(Object source,
Object dest)
Creates a copy of the source flow object in dest . |
protected Object |
entryInitialFlow()
Returns the initial flow value for entry/exit graph nodes. |
protected void |
flowThrough(Object flowin,
Unit u,
List fallOut,
List branchOuts)
Given the merge of the in sets,
compute the fallOut and branchOuts
set for s . |
protected boolean |
isAlwaysNonNull(Value v)
This can be overwritten by sublasses to mark a certain value as constantly non-null. |
boolean |
isAlwaysNonNullBefore(Unit s,
Immediate i)
Returns true if the analysis could determine that i is always non-null
before the statement s. |
boolean |
isAlwaysNullBefore(Unit s,
Immediate i)
Returns true if the analysis could determine that i is always null
before the statement s. |
protected void |
merge(Object in1,
Object in2,
Object out)
Compute the merge of the in1 and in2 sets, putting the result into out . |
protected Object |
newInitialFlow()
Returns the flow object corresponding to the initial values for each graph node. |
Methods inherited from class soot.toolkits.scalar.ForwardBranchedFlowAnalysis |
---|
doAnalysis, isForward |
Methods inherited from class soot.toolkits.scalar.BranchedFlowAnalysis |
---|
getBranchFlowAfter, getFallFlowAfter, getFlowBefore |
Methods inherited from class soot.toolkits.scalar.AbstractFlowAnalysis |
---|
merge, mergeInto, treatTrapHandlersAsEntries |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int BOTTOM
protected static final int NULL
protected static final int NON_NULL
protected static final int TOP
protected final HashMap<Value,Integer> valueToIndex
protected int used
Constructor Detail |
---|
public NullnessAnalysis(UnitGraph graph)
graph
- any unit graphMethod Detail |
---|
protected void flowThrough(Object flowin, Unit u, List fallOut, List branchOuts)
in
sets,
compute the fallOut
and branchOuts
set for s
.
flowThrough
in class BranchedFlowAnalysis
protected boolean isAlwaysNonNull(Value v)
v
- any value
protected void copy(Object source, Object dest)
source
flow object in dest
.
copy
in class AbstractFlowAnalysis
protected Object entryInitialFlow()
entryInitialFlow
in class AbstractFlowAnalysis
protected void merge(Object in1, Object in2, Object out)
in1
and in2
sets, putting the result into out
.
The behavior of this function depends on the implementation ( it may be necessary to check whether
in1
and in2
are equal or aliased ).
Used by the doAnalysis method.
merge
in class AbstractFlowAnalysis
protected Object newInitialFlow()
newInitialFlow
in class AbstractFlowAnalysis
public boolean isAlwaysNullBefore(Unit s, Immediate i)
true
if the analysis could determine that i is always null
before the statement s.
s
- a statement of the respective bodyi
- a local or constant of that body
public boolean isAlwaysNonNullBefore(Unit s, Immediate i)
true
if the analysis could determine that i is always non-null
before the statement s.
s
- a statement of the respective bodyi
- a local of that body
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |