Package edu.umd.cs.findbugs.ba.deref
Class UnconditionalValueDerefSet
java.lang.Object
edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet
A set of values unconditionally dereferenced in the future.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
private final Map
<ValueNumber, Set<Location>> Map of value numbers to locationsprivate int
private final int
Number of distinct value numbers in method(package private) boolean
private final BitSet
Set of value numbers unconditionally dereferenced -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDeref
(ValueNumber vn, Location location) Mark a value as being dereferenced at given Location.void
cleanDerefSet
(Location location, ValueNumberFrame vnaFrame) (package private) void
clear()
Clear the deref set.void
clearDerefSet
(ValueNumber value) Clear the set of dereferences for given ValueNumbergetDerefLocationSet
(int vn) Get the set of dereference Locations for given value number.int
Get the set of Locations where given value is guaranteed to be dereferenced.boolean
isBottom()
Is this the bottom value?boolean
isEmpty()
boolean
isSameAs
(UnconditionalValueDerefSet otherFact) Return whether or not this dataflow fact is identical to the one given.boolean
isTop()
Is this the top value?boolean
Return whether or not the given value number is unconditionally dereferenced.void
makeSameAs
(UnconditionalValueDerefSet source) Make this dataflow fact the same as the given one.void
mergeWith
(UnconditionalValueDerefSet fact, ValueNumber skipMe, ValueNumberFactory valueNumberFactory) Merge given dataflow fact into this one.void
retainOnlyTheseValueNumbers
(Collection<ValueNumber> valueNumbers) void
setDerefSet
(ValueNumber vn, Set<Location> derefSet) Set a value as being unconditionally dereferenced at the given set of locations.void
Make this dataflow fact the bottom value.void
setIsTop()
Make this dataflow fact the top value.void
setLastUpdateTimestamp
(int lastUpdateTimestamp) toString()
void
unionWith
(UnconditionalValueDerefSet fact, ValueNumberFactory valueNumberFactory)
-
Field Details
-
numValueNumbersInMethod
private final int numValueNumbersInMethodNumber of distinct value numbers in method -
valueNumbersUnconditionallyDereferenced
Set of value numbers unconditionally dereferenced -
derefLocationSetMap
Map of value numbers to locations -
resultsFromBackEdge
boolean resultsFromBackEdge -
backEdgeUpdateCount
int backEdgeUpdateCount -
lastUpdateTimestamp
private int lastUpdateTimestamp
-
-
Constructor Details
-
UnconditionalValueDerefSet
public UnconditionalValueDerefSet(int numValueNumbersInMethod) Constructor.- Parameters:
numValueNumbersInMethod
- number of distinct value numbers in method
-
-
Method Details
-
isBottom
public boolean isBottom()Is this the bottom value?- Returns:
- true if this is the bottom value, false otherwise
-
setIsBottom
public void setIsBottom()Make this dataflow fact the bottom value. -
isTop
public boolean isTop()Is this the top value?- Returns:
- true if this is the top value, false otherwise
-
setIsTop
public void setIsTop()Make this dataflow fact the top value. -
clear
void clear()Clear the deref set. This sets the fact so it is valid as the dataflow entry fact: no future dereferences are guaranteed. -
makeSameAs
Make this dataflow fact the same as the given one.- Parameters:
source
- another dataflow fact
-
isSameAs
Return whether or not this dataflow fact is identical to the one given.- Parameters:
otherFact
- another dataflow fact- Returns:
- true if the other dataflow fact is identical to this one, false otherwise
-
mergeWith
public void mergeWith(UnconditionalValueDerefSet fact, @CheckForNull ValueNumber skipMe, ValueNumberFactory valueNumberFactory) Merge given dataflow fact into this one. We take the intersection of the unconditional deref value number set, and union the deref locations.- Parameters:
fact
- another dataflow factskipMe
- TODO
-
unionWith
-
addDeref
Mark a value as being dereferenced at given Location.- Parameters:
vn
- the valuelocation
- the Location
-
setDerefSet
Set a value as being unconditionally dereferenced at the given set of locations.- Parameters:
vn
- the valuederefSet
- the Set of dereference Locations
-
clearDerefSet
Clear the set of dereferences for given ValueNumber- Parameters:
value
- the ValueNumber
-
getDerefLocationSet
Get the set of dereference Locations for given value number.- Parameters:
vn
- the value number- Returns:
- the set of dereference Locations
-
isUnconditionallyDereferenced
Return whether or not the given value number is unconditionally dereferenced.- Parameters:
vn
- the value number- Returns:
- true if the value is unconditionally dereferenced, false otherwise
-
getValueNumbersThatAreUnconditionallyDereferenced
-
retainOnlyTheseValueNumbers
-
getUnconditionalDerefLocationSet
Get the set of Locations where given value is guaranteed to be dereferenced. (I.e., if non-implicit-exception control paths are followed, one of these locations will be reached).- Parameters:
vn
- the value- Returns:
- set of Locations, one of which will definitely be reached if non-implicit-exception control paths are followed
-
toString
-
getDerefLocationSet
-
cleanDerefSet
- Parameters:
location
-vnaFrame
-
-
setLastUpdateTimestamp
public void setLastUpdateTimestamp(int lastUpdateTimestamp) - Parameters:
lastUpdateTimestamp
- The lastUpdateTimestamp to set.
-
getLastUpdateTimestamp
public int getLastUpdateTimestamp()- Returns:
- Returns the lastUpdateTimestamp.
-
isEmpty
public boolean isEmpty()- Returns:
true
if the set is empty
-