Package edu.umd.cs.findbugs.ba.vna
Class AvailableLoad
java.lang.Object
edu.umd.cs.findbugs.ba.vna.AvailableLoad
- All Implemented Interfaces:
Comparable<AvailableLoad>
An AvailableLoad indicates a field and (optionally) object reference for which a value is available. It is used to implement redundant load elimination and forward substitution in ValueNumberAnalysis. The idea is that programmers often reload fields unnecessarily when they "know" that the value will not change. In order to deduce the intended meaning of such code, our analyses need to figure out that such loads return the same value.
AvailableLoad objects may be used as keys in both hash and tree sets and maps.
- Author:
- David Hovemeyer
- See Also:
-
Constructor Summary
ConstructorDescriptionAvailableLoad
(ValueNumber reference, XField field) Constructor from object reference and instance field.AvailableLoad
(XField staticField) Constructor from static field. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(AvailableLoad other) boolean
getField()
Get the field for which a load is available.Get the ValueNumber of the object reference.int
hashCode()
boolean
toString()
-
Constructor Details
-
AvailableLoad
Constructor from static field.- Parameters:
staticField
- the StaticField
-
AvailableLoad
Constructor from object reference and instance field.- Parameters:
reference
- the ValueNumber of the object referencefield
- the InstanceField
-
-
Method Details
-
getReference
Get the ValueNumber of the object reference.- Returns:
- the ValueNumber, or null if this is a an available static field load
-
matchesReference
-
getField
Get the field for which a load is available.- Returns:
- the XField
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AvailableLoad>
-
hashCode
public int hashCode() -
equals
-
toString
-