Package com.oracle.truffle.api.frame
Class FrameDescriptor.Builder
java.lang.Object
com.oracle.truffle.api.frame.FrameDescriptor.Builder
- Enclosing class:
FrameDescriptor
Builder API for frame descriptors with indexed slots.
- Since:
- 22.0
-
Method Summary
Modifier and TypeMethodDescriptionint
addSlot
(FrameSlotKind kind, Object name, Object info) Adds an indexed frame slot to theFrameDescriptor
.int
addSlots
(int count, FrameSlotKind kind) Adds the given number of consecutive indexed slots to theFrameDescriptor
, and initializes them with the given kind.build()
Uses the data provided to this builder to create a newFrameDescriptor
.defaultValue
(Object newDefaultValue) Sets the default value for the frame slots in this frame descriptor.Adds a user-defined info object to the frame descriptor.
-
Method Details
-
defaultValue
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
Adds the given number of consecutive indexed slots to theFrameDescriptor
, and initializes them with the given kind.- Parameters:
count
- number of slots to be addedkind
- default type of the newly added frame slots- Returns:
- index of the first slot
- Since:
- 22.0
-
addSlot
Adds an indexed frame slot to theFrameDescriptor
. The frame descriptor's internal arrays for storingname
andinfo
are allocated only when needed, so using onlynull
reduces memory footprint.- Parameters:
kind
- default type of the newly added frame slotname
- 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
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 usingFrameDescriptor.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
Uses the data provided to this builder to create a newFrameDescriptor
.- Returns:
- the newly created
FrameDescriptor
- Since:
- 22.0
-