Package edu.umd.cs.findbugs.ba.vna
Class AvailableLoad
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.vna.AvailableLoad
-
- All Implemented Interfaces:
java.lang.Comparable<AvailableLoad>
public class AvailableLoad extends java.lang.Object implements java.lang.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:
ValueNumberAnalysis
-
-
Constructor Summary
Constructors Constructor Description AvailableLoad(ValueNumber reference, XField field)
Constructor from object reference and instance field.AvailableLoad(XField staticField)
Constructor from static field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(AvailableLoad other)
boolean
equals(java.lang.Object o)
XField
getField()
Get the field for which a load is available.ValueNumber
getReference()
Get the ValueNumber of the object reference.int
hashCode()
boolean
matchesReference(ValueNumber v)
java.lang.String
toString()
-
-
-
Constructor Detail
-
AvailableLoad
public AvailableLoad(XField staticField)
Constructor from static field.- Parameters:
staticField
- the StaticField
-
AvailableLoad
public AvailableLoad(ValueNumber reference, XField field)
Constructor from object reference and instance field.- Parameters:
reference
- the ValueNumber of the object referencefield
- the InstanceField
-
-
Method Detail
-
getReference
public ValueNumber getReference()
Get the ValueNumber of the object reference.- Returns:
- the ValueNumber, or null if this is a an available static field load
-
matchesReference
public boolean matchesReference(ValueNumber v)
-
getField
public XField getField()
Get the field for which a load is available.- Returns:
- the XField
-
compareTo
public int compareTo(AvailableLoad other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<AvailableLoad>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-