Class FrameDescriptor.Builder

java.lang.Object
com.oracle.truffle.api.frame.FrameDescriptor.Builder
Enclosing class:
FrameDescriptor

public static final class FrameDescriptor.Builder extends Object
Builder API for frame descriptors with indexed slots.
Since:
22.0
  • Method Details

    • defaultValue

      public FrameDescriptor.Builder defaultValue(Object newDefaultValue)
      Sets the default value for the frame slots in this frame descriptor.
      Parameters:
      newDefaultValue - the default value for the resulting frame descriptor
      Since:
      22.0
    • addSlots

      public int addSlots(int count, FrameSlotKind kind)
      Adds the given number of consecutive indexed slots to the FrameDescriptor, and initializes them with the given kind.
      Parameters:
      count - number of slots to be added
      kind - default type of the newly added frame slots
      Returns:
      index of the first slot
      Since:
      22.0
    • addSlot

      public int addSlot(FrameSlotKind kind, Object name, Object info)
      Adds an indexed frame slot to the FrameDescriptor. The frame descriptor's internal arrays for storing name and info are allocated only when needed, so using only null reduces memory footprint.
      Parameters:
      kind - default type of the newly added frame slot
      name - Name of the newly added frame slot. Can (and should, if possible) be null.
      info - Info object for the newly added frame slot. Can (and should, if possible) be null.
      Since:
      22.0
    • info

      public FrameDescriptor.Builder info(Object info)
      Adds a user-defined info object to the frame descriptor. The contents of this object are strongly referenced from the frame descriptor and can be queried using FrameDescriptor.getInfo(). They do not influence the semantics of the frame descriptor in any other way.
      Parameters:
      info - the user-defined info object
      Since:
      22.1
    • build

      public FrameDescriptor build()
      Uses the data provided to this builder to create a new FrameDescriptor.
      Returns:
      the newly created FrameDescriptor
      Since:
      22.0