Class 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 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 reference
        field - 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 interface java.lang.Comparable<AvailableLoad>
      • hashCode

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object