public class NullnessAnalysis extends ForwardBranchedFlowAnalysis<NullnessAnalysis.AnalysisInfo>
BranchedRefVarsAnalysis which is known to have bugs.| Modifier and Type | Class and Description |
|---|---|
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. |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BOTTOM |
protected static int |
NON_NULL |
protected static int |
NULL |
protected static int |
TOP |
protected int |
used |
protected java.util.HashMap<Value,java.lang.Integer> |
valueToIndex |
unitToAfterBranchFlow, unitToAfterFallFlowfilterUnitToBeforeFlow, graph, unitToBeforeFlow| Constructor and Description |
|---|
NullnessAnalysis(UnitGraph graph)
Creates a new analysis for the given graph/
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
copy(NullnessAnalysis.AnalysisInfo s,
NullnessAnalysis.AnalysisInfo d)
Creates a copy of the
source flow object in dest. |
protected void |
flowThrough(NullnessAnalysis.AnalysisInfo in,
Unit u,
java.util.List<NullnessAnalysis.AnalysisInfo> fallOut,
java.util.List<NullnessAnalysis.AnalysisInfo> 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(NullnessAnalysis.AnalysisInfo in1,
NullnessAnalysis.AnalysisInfo in2,
NullnessAnalysis.AnalysisInfo out)
Compute the merge of the
in1 and in2 sets, putting the result into out. |
protected NullnessAnalysis.AnalysisInfo |
newInitialFlow()
Returns the flow object corresponding to the initial values for
each graph node.
|
doAnalysis, isForwardgetBranchFlowAfter, getFallFlowAfterentryInitialFlow, getFlowBefore, merge, mergeInto, treatTrapHandlersAsEntriesprotected static final int BOTTOM
protected static final int NULL
protected static final int NON_NULL
protected static final int TOP
protected final java.util.HashMap<Value,java.lang.Integer> valueToIndex
protected int used
public NullnessAnalysis(UnitGraph graph)
graph - any unit graphprotected void flowThrough(NullnessAnalysis.AnalysisInfo in, Unit u, java.util.List<NullnessAnalysis.AnalysisInfo> fallOut, java.util.List<NullnessAnalysis.AnalysisInfo> branchOuts)
in sets,
compute the fallOut and branchOuts
set for s.flowThrough in class BranchedFlowAnalysis<Unit,NullnessAnalysis.AnalysisInfo>protected boolean isAlwaysNonNull(Value v)
v - any valueprotected void copy(NullnessAnalysis.AnalysisInfo s, NullnessAnalysis.AnalysisInfo d)
source flow object in dest.copy in class AbstractFlowAnalysis<Unit,NullnessAnalysis.AnalysisInfo>protected void merge(NullnessAnalysis.AnalysisInfo in1, NullnessAnalysis.AnalysisInfo in2, NullnessAnalysis.AnalysisInfo 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<Unit,NullnessAnalysis.AnalysisInfo>protected NullnessAnalysis.AnalysisInfo newInitialFlow()
newInitialFlow in class AbstractFlowAnalysis<Unit,NullnessAnalysis.AnalysisInfo>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 bodypublic 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