Package edu.umd.cs.findbugs.ba.vna
Class ValueNumberFrame
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.Frame<ValueNumber>
-
- edu.umd.cs.findbugs.ba.vna.ValueNumberFrame
-
- All Implemented Interfaces:
ValueNumberAnalysisFeatures
public class ValueNumberFrame extends Frame<ValueNumber> implements ValueNumberAnalysisFeatures
A dataflow value representing a Java stack frame with value number information.- See Also:
ValueNumber
,ValueNumberAnalysis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ValueNumberFrame.AvailableLoadBiMap
A wrapper for the AvailableLoad to ValueNumber[] map also keeping track of a reverse map.
-
Field Summary
Fields Modifier and Type Field Description private ValueNumberFrame.AvailableLoadBiMap
availableLoadMap
(package private) static int
constructedUnmodifiableMap
(package private) static int
createdEmptyMap
(package private) static int
madeImmutableMutable
private java.util.Map<AvailableLoad,ValueNumber>
mergedLoads
private java.util.ArrayList<ValueNumber>
mergedValueList
boolean
phiNodeForLoads
private java.util.Map<ValueNumber,AvailableLoad>
previouslyKnownAs
(package private) static int
reusedMap
(package private) static int
reusedMutableMap
private static boolean
USE_WRITTEN_OUTSIDE_OF_CONSTRUCTOR
-
Fields inherited from interface edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysisFeatures
REDUNDANT_LOAD_ELIMINATION, RLE_DEBUG
-
-
Constructor Summary
Constructors Constructor Description ValueNumberFrame(int numLocals)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAvailableLoad(AvailableLoad availableLoad, ValueNumber[] value)
Add an available load.private void
assignAvailableLoadMap(ValueNumberFrame other)
private void
assignPreviouslyKnownAs(ValueNumberFrame other)
java.lang.String
availableLoadMapAsString()
void
copyFrom(Frame<ValueNumber> other)
Make this Frame exactly the same as the one given as a parameter.private java.lang.String
extractPackageName(java.lang.String className)
boolean
fromMatchingFields(ValueNumber v1, ValueNumber v2)
boolean
fromMatchingLoads(ValueNumber v1, ValueNumber v2)
boolean
fuzzyMatch(ValueNumber v1, ValueNumber v2)
ValueNumber[]
getAvailableLoad(AvailableLoad availableLoad)
Look for an available load.private ValueNumberFrame.AvailableLoadBiMap
getAvailableLoadMap()
AvailableLoad
getLoad(ValueNumber v)
private java.util.Map<AvailableLoad,ValueNumber>
getMergedLoads()
(package private) ValueNumber
getMergedValue(int slot)
private java.util.Map<ValueNumber,AvailableLoad>
getPreviouslyKnownAs()
private ValueNumberFrame.AvailableLoadBiMap
getUpdateableAvailableLoadMap()
private java.util.Map<AvailableLoad,ValueNumber>
getUpdateableMergedLoads()
private java.util.Map<ValueNumber,AvailableLoad>
getUpdateablePreviouslyKnownAs()
boolean
hasAvailableLoads()
boolean
haveMatchingFlags(ValueNumber v1, ValueNumber v2)
void
killAllLoads()
Kill all loads.void
killAllLoads(boolean primitiveOnly)
void
killAllLoadsExceptFor(ValueNumber v)
void
killAllLoadsOf(ValueNumber v)
Kill all loads.private void
killAvailableLoads(java.util.HashSet<AvailableLoad> killMe)
void
killLoadsOf(java.util.Set<XField> fieldsToKill)
void
killLoadsOfField(XField field)
Kill all loads of given field.void
killLoadsWithSimilarName(java.lang.String className, java.lang.String methodName)
(package private) void
mergeAvailableLoadSets(ValueNumberFrame other, ValueNumberFactory factory, MergeTree mergeTree)
private static void
removeAllKeys(ValueNumberFrame.AvailableLoadBiMap map, java.lang.Iterable<AvailableLoad> removeMe)
boolean
sameAs(Frame<ValueNumber> other)
Return true if this stack frame is the same as the one given as a parameter.private void
setAvailableLoadMap(ValueNumberFrame.AvailableLoadBiMap availableLoadMap)
private void
setMergedLoads(java.util.Map<AvailableLoad,ValueNumber> mergedLoads)
(package private) void
setMergedValue(int slot, ValueNumber value)
private void
setPreviouslyKnownAs(java.util.Map<ValueNumber,AvailableLoad> previouslyKnownAs)
java.lang.String
toString()
Convert to string.java.util.Collection<ValueNumber>
valueNumbersForLoads()
private static java.lang.String
valueToString(ValueNumber[] valueNumberList)
boolean
veryFuzzyMatch(ValueNumber v1, ValueNumber v2)
-
Methods inherited from class edu.umd.cs.findbugs.ba.Frame
allSlots, clearStack, contains, getArgument, getArgument, getArgumentSet, getArgumentSlot, getInstance, getInstanceSlot, getInstanceStackLocation, getLastUpdateTimestamp, getNumArguments, getNumArgumentsIncludingObjectInstance, getNumLocals, getNumSlots, getOperand, getStackDepth, getStackLocation, getStackValue, getTopStackWords, getTopValue, getValue, isBottom, isTop, isValid, popValue, pushValue, setBottom, setLastUpdateTimestamp, setTop, setValid, setValue, valueToString
-
-
-
-
Field Detail
-
mergedValueList
private java.util.ArrayList<ValueNumber> mergedValueList
-
availableLoadMap
private ValueNumberFrame.AvailableLoadBiMap availableLoadMap
-
mergedLoads
private java.util.Map<AvailableLoad,ValueNumber> mergedLoads
-
previouslyKnownAs
private java.util.Map<ValueNumber,AvailableLoad> previouslyKnownAs
-
phiNodeForLoads
public boolean phiNodeForLoads
-
USE_WRITTEN_OUTSIDE_OF_CONSTRUCTOR
private static final boolean USE_WRITTEN_OUTSIDE_OF_CONSTRUCTOR
- See Also:
- Constant Field Values
-
constructedUnmodifiableMap
static int constructedUnmodifiableMap
-
reusedMap
static int reusedMap
-
createdEmptyMap
static int createdEmptyMap
-
madeImmutableMutable
static int madeImmutableMutable
-
reusedMutableMap
static int reusedMutableMap
-
-
Method Detail
-
availableLoadMapAsString
public java.lang.String availableLoadMapAsString()
-
getLoad
@CheckForNull public AvailableLoad getLoad(ValueNumber v)
-
getAvailableLoad
public ValueNumber[] getAvailableLoad(AvailableLoad availableLoad)
Look for an available load.- Parameters:
availableLoad
- the AvailableLoad (reference and field)- Returns:
- the value(s) available, or null if no matching entry is found
-
addAvailableLoad
public void addAvailableLoad(AvailableLoad availableLoad, @Nonnull ValueNumber[] value)
Add an available load.- Parameters:
availableLoad
- the AvailableLoad (reference and field)value
- the value(s) loaded
-
removeAllKeys
private static void removeAllKeys(ValueNumberFrame.AvailableLoadBiMap map, java.lang.Iterable<AvailableLoad> removeMe)
-
killLoadsOfField
public void killLoadsOfField(XField field)
Kill all loads of given field.- Parameters:
field
- the field
-
killAllLoads
public void killAllLoads()
Kill all loads. This conservatively handles method calls where we don't really know what fields might be assigned.
-
killAllLoads
public void killAllLoads(boolean primitiveOnly)
-
killAllLoadsExceptFor
public void killAllLoadsExceptFor(@CheckForNull ValueNumber v)
-
killAllLoadsOf
public void killAllLoadsOf(@CheckForNull ValueNumber v)
Kill all loads. This conservatively handles method calls where we don't really know what fields might be assigned.
-
killLoadsOf
public void killLoadsOf(java.util.Set<XField> fieldsToKill)
-
killLoadsWithSimilarName
public void killLoadsWithSimilarName(java.lang.String className, java.lang.String methodName)
-
killAvailableLoads
private void killAvailableLoads(java.util.HashSet<AvailableLoad> killMe)
-
extractPackageName
private java.lang.String extractPackageName(java.lang.String className)
-
mergeAvailableLoadSets
void mergeAvailableLoadSets(ValueNumberFrame other, ValueNumberFactory factory, MergeTree mergeTree)
-
getMergedValue
ValueNumber getMergedValue(int slot)
-
setMergedValue
void setMergedValue(int slot, ValueNumber value)
-
copyFrom
public void copyFrom(Frame<ValueNumber> other)
Description copied from class:Frame
Make this Frame exactly the same as the one given as a parameter.- Overrides:
copyFrom
in classFrame<ValueNumber>
- Parameters:
other
- the Frame to make this object the same as
-
assignAvailableLoadMap
private void assignAvailableLoadMap(ValueNumberFrame other)
-
assignPreviouslyKnownAs
private void assignPreviouslyKnownAs(ValueNumberFrame other)
-
toString
public java.lang.String toString()
Description copied from class:Frame
Convert to string.- Overrides:
toString
in classFrame<ValueNumber>
-
valueToString
private static java.lang.String valueToString(ValueNumber[] valueNumberList)
-
fuzzyMatch
public boolean fuzzyMatch(ValueNumber v1, ValueNumber v2)
-
veryFuzzyMatch
public boolean veryFuzzyMatch(ValueNumber v1, ValueNumber v2)
-
fromMatchingLoads
public boolean fromMatchingLoads(ValueNumber v1, ValueNumber v2)
-
fromMatchingFields
public boolean fromMatchingFields(ValueNumber v1, ValueNumber v2)
-
haveMatchingFlags
public boolean haveMatchingFlags(ValueNumber v1, ValueNumber v2)
- Returns:
- true if v1 and v2 have a flag in common
-
valueNumbersForLoads
public java.util.Collection<ValueNumber> valueNumbersForLoads()
-
setAvailableLoadMap
private void setAvailableLoadMap(ValueNumberFrame.AvailableLoadBiMap availableLoadMap)
-
getAvailableLoadMap
private ValueNumberFrame.AvailableLoadBiMap getAvailableLoadMap()
-
getUpdateableAvailableLoadMap
private ValueNumberFrame.AvailableLoadBiMap getUpdateableAvailableLoadMap()
-
setMergedLoads
private void setMergedLoads(java.util.Map<AvailableLoad,ValueNumber> mergedLoads)
-
getMergedLoads
private java.util.Map<AvailableLoad,ValueNumber> getMergedLoads()
-
getUpdateableMergedLoads
private java.util.Map<AvailableLoad,ValueNumber> getUpdateableMergedLoads()
-
setPreviouslyKnownAs
private void setPreviouslyKnownAs(java.util.Map<ValueNumber,AvailableLoad> previouslyKnownAs)
-
getPreviouslyKnownAs
private java.util.Map<ValueNumber,AvailableLoad> getPreviouslyKnownAs()
-
getUpdateablePreviouslyKnownAs
private java.util.Map<ValueNumber,AvailableLoad> getUpdateablePreviouslyKnownAs()
-
sameAs
public boolean sameAs(Frame<ValueNumber> other)
Description copied from class:Frame
Return true if this stack frame is the same as the one given as a parameter.- Overrides:
sameAs
in classFrame<ValueNumber>
- Parameters:
other
- the other Frame- Returns:
- true if the frames are the same, false otherwise
-
hasAvailableLoads
public boolean hasAvailableLoads()
-
-