Class LocalRangeAccessor

java.lang.Object
com.oracle.truffle.api.bytecode.LocalRangeAccessor

public final class LocalRangeAccessor extends Object
Operation parameter that allows an operation to get, set, or clear locals declared in a contiguous range.

To use a local range accessor, declare a ConstantOperand on the operation. The corresponding builder method for the operation will take a BytecodeLocal array argument for the locals to be accessed. These locals must be allocated sequentially during building. At run time, a LocalRangeAccessor for the locals will be supplied as a parameter to the operation.

All of the accessor methods take a BytecodeNode, the current Frame, and an offset. The offset should be a valid compilation-final index into the array of locals. See the LocalAccessor javadoc for restrictions on the other parameters and usage recommendations.

Since:
24.2
  • Method Details

    • getLength

      public int getLength()
      Returns the length of the range.
      Since:
      24.2
    • hashCode

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

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

      public String toString()
      Returns a string representation of a LocalRangeAccessor.
      Overrides:
      toString in class Object
      Since:
      24.2
    • getObject

      public Object getObject(BytecodeNode bytecodeNode, VirtualFrame frame, int offset)
      Loads an object from the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • getBoolean

      public boolean getBoolean(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException
      Loads a boolean from the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Throws:
      UnexpectedResultException
      Since:
      24.2
    • getByte

      public byte getByte(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException
      Loads a byte from the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Throws:
      UnexpectedResultException
      Since:
      24.2
    • getInt

      public int getInt(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException
      Loads an int from the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Throws:
      UnexpectedResultException
      Since:
      24.2
    • getLong

      public long getLong(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException
      Loads a long from the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Throws:
      UnexpectedResultException
      Since:
      24.2
    • getFloat

      public float getFloat(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException
      Loads a float from the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Throws:
      UnexpectedResultException
      Since:
      24.2
    • getDouble

      public double getDouble(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException
      Loads a double from the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Throws:
      UnexpectedResultException
      Since:
      24.2
    • setObject

      public void setObject(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, Object value)
      Stores an object into the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • setBoolean

      public void setBoolean(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, boolean value)
      Stores a boolean into the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • setByte

      public void setByte(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, byte value)
      Stores a byte into the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • setInt

      public void setInt(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, int value)
      Stores an int into the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • setLong

      public void setLong(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, long value)
      Stores a long into the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • setFloat

      public void setFloat(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, float value)
      Stores a float into the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • setDouble

      public void setDouble(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, double value)
      Stores a double into the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
    • clear

      public void clear(BytecodeNode bytecodeNode, VirtualFrame frame, int offset)
      Clears the local at the given offset into the range.
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
      See Also:
    • isCleared

      public boolean isCleared(BytecodeNode bytecodeNode, VirtualFrame frame, int offset)
      Checks whether the local at the given offset into the range has been cleared (and a new value has not been set).
      Parameters:
      offset - a partial evaluation constant offset into the range.
      Since:
      24.2
      See Also:
    • getLocalName

      public Object getLocalName(BytecodeNode bytecodeNode, int offset)
      Returns the name associated with the local.
      Since:
      24.2
      See Also:
    • getLocalInfo

      public Object getLocalInfo(BytecodeNode bytecodeNode, int offset)
      Returns the info associated with the local.
      Since:
      24.2
      See Also:
    • constantOf

      public static LocalRangeAccessor constantOf(BytecodeLocal[] locals)
      Obtains a LocalRangeAccessor. This method is invoked by the generated code and should not be called directly.
      Since:
      24.2