Class LocalVariable

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

public abstract class LocalVariable extends Object
Introspection class modeling a local variable and its liveness info in a bytecode interpreter. There can be more than one local variable for a given BytecodeLocal because locals can be live for multiple disjoint bytecode ranges.

Note: Introspection classes are intended to be used for debugging purposes only. These APIs may change in the future.

Since:
24.2
See Also:
  • Constructor Details

    • LocalVariable

      protected LocalVariable(Object token)
      Internal constructor for generated code. Do not use.
      Since:
      24.2
  • Method Details

    • getStartIndex

      public int getStartIndex()
      Returns the bytecode index at which this local starts being live. If block scoping is disabled, returns -1.
      Since:
      24.2
    • getEndIndex

      public int getEndIndex()
      Returns the bytecode index at which this local stops being live. If block scoping is disabled, returns -1.
      Since:
      24.2
    • getLocalOffset

      public abstract int getLocalOffset()
      Returns the logical frame offset of a local variable. The local index should be used with local accessor methods like BytecodeNode.getLocalValue(int, Frame, int) (it does not represent a frame index that can be used to directly access the frame). Always returns an integer greater or equal to zero.

      If block scoping is enabled, multiple locals can share an offset; otherwise, the local offset is the same as the local index.

      Note that the local offset can only be read if the current bytecode index is between getStartIndex() and getEndIndex() (exclusive).

      Since:
      24.2
    • getLocalIndex

      public abstract int getLocalIndex()
      Returns the local index, a unique identifier for each BytecodeLocal in a root node.
      Since:
      24.2
    • getTypeProfile

      public abstract FrameSlotKind getTypeProfile()
      Returns the type profile that was collected for this local. Returns null if no profile was yet collected or the interpreter does not collect profiles.
      Since:
      24.2
    • getInfo

      public abstract Object getInfo()
      Returns the info provided for the local, or null if no info was provided.
      Since:
      24.2
    • getName

      public abstract Object getName()
      Returns the name provided for the local, or null if no name was provided.
      Since:
      24.2
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Since:
      24.2