Package com.oracle.truffle.api.frame
Class FrameDescriptor
java.lang.Object
com.oracle.truffle.api.frame.FrameDescriptor
- All Implemented Interfaces:
Cloneable
Descriptor of the slots of frame objects. Multiple frame instances are associated with one such
descriptor. The FrameDescriptor is thread-safe.
- Since:
- 0.8 or earlier
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builder API for frame descriptors with indexed slots. -
Constructor Summary
ConstructorDescriptionConstructs empty descriptor.FrameDescriptor
(Object defaultValue) Constructs new descriptor with specifiedgetDefaultValue()
. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Deeper copy of the descriptor.void
Disables the auxiliary slot with the given key, so that subsequently createdFrame
instances may avoid allocating storage for it.int
Find or adds an auxiliary slot to this frame descriptor.Returns all currently active auxiliary slots along with their indexes.Default value for the created slots.getInfo()
int
int
getSlotInfo
(int slot) Queries the info object for a given indexed slot.getSlotKind
(int slot) Returns theFrameSlotKind
associated with the given indexed slot.getSlotName
(int slot) Queries the name for a given indexed slot.static FrameDescriptor.Builder
Builds a new frame descriptor with index-based frame slots.static FrameDescriptor.Builder
newBuilder
(int capacity) Builds a new frame descriptor with index-based frame slots.void
setSlotKind
(int slot, FrameSlotKind kind) Sets theFrameSlotKind
of the given indexed slot.toString()
-
Constructor Details
-
FrameDescriptor
public FrameDescriptor()Constructs empty descriptor. ThegetDefaultValue()
isnull
.- Since:
- 0.8 or earlier
-
FrameDescriptor
Constructs new descriptor with specifiedgetDefaultValue()
.- Parameters:
defaultValue
- to be returned fromgetDefaultValue()
- Since:
- 0.8 or earlier
-
-
Method Details
-
copy
Deeper copy of the descriptor. Copies all slots in the descriptor, but only their identifier and info but not their kind!- Returns:
- new instance of a descriptor with copies of values from this one
- Since:
- 0.8 or earlier
-
getDefaultValue
Default value for the created slots.- Returns:
- value provided to
FrameDescriptor(java.lang.Object)
- Since:
- 0.8 or earlier
-
toString
-
getNumberOfSlots
public int getNumberOfSlots()- Returns:
- the number of indexed slots in this frame descriptor
- Since:
- 22.0
-
getSlotKind
Returns theFrameSlotKind
associated with the given indexed slot.- Parameters:
slot
- index of the slot- Returns:
- a non-null
FrameSlotKind
- Since:
- 22.0
-
setSlotKind
Sets theFrameSlotKind
of the given indexed slot.- Parameters:
slot
- index of the slotkind
- new non-nullFrameSlotKind
- Since:
- 22.0
-
getSlotName
Queries the name for a given indexed slot.- Parameters:
slot
- index of the slot- Returns:
- the name of the slot (may be
null
) - Since:
- 22.0
-
getSlotInfo
Queries the info object for a given indexed slot.- Parameters:
slot
- index of the slot- Returns:
- the info object of the slot (may be
null
) - Since:
- 22.0
-
findOrAddAuxiliarySlot
Find or adds an auxiliary slot to this frame descriptor. Returns an integer index that can be used to access the auxiliary slot in the frame.- Parameters:
key
- used as a hash map entry- Returns:
- an integer that can be used to access the auxiliary slot in the frame
- Since:
- 22.0
-
disableAuxiliarySlot
Disables the auxiliary slot with the given key, so that subsequently createdFrame
instances may avoid allocating storage for it. Depending on the internal storage layout, it may not be possible to remove the storage for individual slots, so it is important to disable _all_ unused slots.- Parameters:
key
- the key, as passed tofindOrAddAuxiliarySlot(Object)
- Since:
- 22.0
-
getAuxiliarySlots
Returns all currently active auxiliary slots along with their indexes. This is a slow operation that returns a data structure that is not backed by the frame descriptor, i.e., which does not reflect changes to the set of active auxiliary slots in either direction.- Since:
- 22.0
-
getNumberOfAuxiliarySlots
public int getNumberOfAuxiliarySlots()- Returns:
- the current number of auxiliary slots in this frame descriptor
- Since:
- 22.0
-
getInfo
- Returns:
- the user-defined info object associated with this frame descriptor
- Since:
- 22.1
-
newBuilder
Builds a new frame descriptor with index-based frame slots.- Since:
- 22.0
-
newBuilder
Builds a new frame descriptor with index-based frame slots.- Parameters:
capacity
- the expected number of index-based frame slots (taken as a hint when allocating internal data structures)- Since:
- 22.0
-