Class AvailableLoad

java.lang.Object
edu.umd.cs.findbugs.ba.vna.AvailableLoad
All Implemented Interfaces:
Comparable<AvailableLoad>

public class AvailableLoad extends Object implements 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 Details

    • 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 reference
      field - the InstanceField
  • Method Details

    • 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 interface Comparable<AvailableLoad>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object