Interface Frame
- All Known Subinterfaces:
MaterializedFrame
,VirtualFrame
Object
.- Since:
- 0.8 or earlier
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
clear
(int slot) Clears the given indexed slot in the frame.default void
clearObjectStatic
(int slot) Clears the object value at the given slot in the frame.default void
clearPrimitiveStatic
(int slot) Clears the primitive value at the given slot in the frame.default void
clearStatic
(int slot) Clears the value at the given slot in the frame.default void
copy
(int srcSlot, int destSlot) Copies, including the type, from one slot to another.default void
copyObjectStatic
(int srcSlot, int destSlot) Copies an object value from one slot to another.default void
copyPrimitiveStatic
(int srcSlot, int destSlot) Copies a primitive value from one slot to another.default void
copyStatic
(int srcSlot, int destSlot) Copies from one slot to another.default void
Copies values from this frame to the given frame.default boolean
expectBoolean
(int slot) Read and expects a value of type boolean for a given slot.default byte
expectByte
(int slot) Read and expects a value of type byte for a given slot.default double
expectDouble
(int slot) Read and expects a value of type double for a given slot.default float
expectFloat
(int slot) Read and expects a value of type float for a given slot.default int
expectInt
(int slot) Read and expects a value of type int for a given slot.default long
expectLong
(int slot) Read and expects a value of type long for a given slot.default Object
expectObject
(int slot) Read and expects a value of type object for a given slot.Object[]
Retrieves the arguments object from this frame.default Object
getAuxiliarySlot
(int slot) default boolean
getBoolean
(int slot) Read access to a local variable of type boolean.default boolean
getBooleanStatic
(int slot) Static read access to a local variable of type boolean.default byte
getByte
(int slot) Read access to a local variable of type byte.default byte
getByteStatic
(int slot) Static read access to a local variable of type byte.default double
getDouble
(int slot) Read access to a local variable of type double.default double
getDoubleStatic
(int slot) Static read access to a local variable of type double.default float
getFloat
(int slot) Read access to a local variable of type float.default float
getFloatStatic
(int slot) Static read access to a local variable of type float.default int
getInt
(int slot) Read access to a local variable of type int.default int
getIntStatic
(int slot) Static read access to a local variable of type int.default long
getLong
(int slot) Read access to a local variable of type long.default long
getLongStatic
(int slot) Static read access to a local variable of type long.default Object
getObject
(int slot) Read access to a local variable of typeObject
.default Object
getObjectStatic
(int slot) Static read access to a local variable of typeObject
.default byte
getTag
(int slot) Determines the actualFrameSlotKind
of the value in the slot, and returns it asFrameSlotKind.tag
.default Object
getValue
(int slot) Read access to a local variable of any type.default boolean
isBoolean
(int slot) Check whether the given indexed slot is of type boolean.default boolean
isByte
(int slot) Check whether the given indexed slot is of type byte.default boolean
isDouble
(int slot) Check whether the given indexed slot is of type double.default boolean
isFloat
(int slot) Check whether the given indexed slot is of type float.default boolean
isInt
(int slot) Check whether the given indexed slot is of type int.default boolean
isLong
(int slot) Check whether the given indexed slot is of type long.default boolean
isObject
(int slot) Check whether the given indexed slot is of type object.default boolean
isStatic
(int slot) Checks whether the given indexed slot is static.Materializes this frame, which allows it to be stored in a field or cast toObject
.default void
setAuxiliarySlot
(int slot, Object value) Sets the value of the given auxiliary slot.default void
setBoolean
(int slot, boolean value) Write access to a local variable of type boolean.default void
setBooleanStatic
(int slot, boolean value) Static write access to a local variable of type boolean.default void
setByte
(int slot, byte value) Write access to a local variable of type byte.default void
setByteStatic
(int slot, byte value) Static write access to a local variable of type byte.default void
setDouble
(int slot, double value) Write access to a local variable of type double.default void
setDoubleStatic
(int slot, double value) Static write access to a local variable of type double.default void
setFloat
(int slot, float value) Write access to a local variable of type float.default void
setFloatStatic
(int slot, float value) Static write access to a local variable of type float.default void
setInt
(int slot, int value) Write access to a local variable of type int.default void
setIntStatic
(int slot, int value) Static write access to a local variable of type int.default void
setLong
(int slot, long value) Write access to a local variable of type long.default void
setLongStatic
(int slot, long value) Static write access to a local variable of type long.default void
Write access to a local variable of typeObject
.default void
setObjectStatic
(int slot, Object value) Static write access to a local variable of typeObject
.default void
swap
(int first, int second) Swaps, including the type, the contents of two slots.default void
swapObjectStatic
(int first, int second) Swaps the object values of two slots.default void
swapPrimitiveStatic
(int first, int second) Swaps the primitive values of two slots.default void
swapStatic
(int first, int second) Swaps the contents of two slots.
-
Method Details
-
getFrameDescriptor
FrameDescriptor getFrameDescriptor()- Returns:
- the object describing the layout of this frame
- Since:
- 0.8 or earlier
-
getArguments
Object[] getArguments()Retrieves the arguments object from this frame. The runtime assumes that the arguments object is never null.- Returns:
- the arguments used when calling this method
- Since:
- 0.8 or earlier
-
materialize
MaterializedFrame materialize()Materializes this frame, which allows it to be stored in a field or cast toObject
.- Returns:
- the new materialized frame
- Since:
- 0.8 or earlier
-
getObject
Read access to a local variable of typeObject
.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable
- Throws:
FrameSlotTypeException
- if the current value is not of type object- Since:
- 22.0
-
expectObject
Read and expects a value of type object for a given slot. Expect methods are intended to be used to implement speculative behavior where slots are expected to be tagged with a type. If the type changes anUnexpectedResultException
will be thrown containing the result ofgetValue(slot)
. Clients of this API are then expected to rewrite and no longer use an expect methods for future reads of that slot. Expect methods are particularly useful to implement stack like behavior with a frame.- Parameters:
slot
- the index of the slot- Returns:
- the value of the slot in this frame
- Throws:
UnexpectedResultException
- if the current value is not of type object- Since:
- 24.2
-
setObject
Write access to a local variable of typeObject
.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.0
-
getByte
Read access to a local variable of type byte.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable
- Throws:
FrameSlotTypeException
- Since:
- 22.0
-
expectByte
Read and expects a value of type byte for a given slot. Expect methods are intended to be used to implement speculative behavior where slots are expected to be tagged with a type. If the type changes anUnexpectedResultException
will be thrown containing the result ofgetValue(slot)
. Clients of this API are then expected to rewrite and no longer use an expect methods for future reads of that slot. Expect methods are particularly useful to implement stack like behavior with a frame.- Parameters:
slot
- the index of the slot- Returns:
- the value of the slot in this frame
- Throws:
UnexpectedResultException
- if the current value is not of type byte- Since:
- 24.2
-
setByte
default void setByte(int slot, byte value) Write access to a local variable of type byte.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.0
-
getBoolean
Read access to a local variable of type boolean.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable
- Throws:
FrameSlotTypeException
- if the current value is not of type boolean- Since:
- 22.0
-
expectBoolean
Read and expects a value of type boolean for a given slot. Expect methods are intended to be used to implement speculative behavior where slots are expected to be tagged with a type. If the type changes anUnexpectedResultException
will be thrown containing the result ofgetValue(slot)
. Clients of this API are then expected to rewrite and no longer use an expect methods for future reads of that slot. Expect methods are particularly useful to implement stack like behavior with a frame.- Parameters:
slot
- the index of the slot- Returns:
- the value of the slot in this frame
- Throws:
UnexpectedResultException
- if the current value is not of type boolean- Since:
- 24.2
-
setBoolean
default void setBoolean(int slot, boolean value) Write access to a local variable of type boolean.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.0
-
getInt
Read access to a local variable of type int.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable
- Throws:
FrameSlotTypeException
- if the current value is not of type int- Since:
- 22.0
-
expectInt
Read and expects a value of type int for a given slot. Expect methods are intended to be used to implement speculative behavior where slots are expected to be tagged with a type. If the type changes anUnexpectedResultException
will be thrown containing the result ofgetValue(slot)
. Clients of this API are then expected to rewrite and no longer use an expect methods for future reads of that slot. Expect methods are particularly useful to implement stack like behavior with a frame.- Parameters:
slot
- the index of the slot- Returns:
- the value of the slot in this frame
- Throws:
UnexpectedResultException
- if the current value is not of type int- Since:
- 24.2
-
setInt
default void setInt(int slot, int value) Write access to a local variable of type int.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.0
-
getLong
Read access to a local variable of type long.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable
- Throws:
FrameSlotTypeException
- if the current value is not of type long- Since:
- 22.0
-
expectLong
Read and expects a value of type long for a given slot. Expect methods are intended to be used to implement speculative behavior where slots are expected to be tagged with a type. If the type changes anUnexpectedResultException
will be thrown containing the result ofgetValue(slot)
. Clients of this API are then expected to rewrite and no longer use an expect methods for future reads of that slot. Expect methods are particularly useful to implement stack like behavior with a frame.- Parameters:
slot
- the index of the slot- Returns:
- the value of the slot in this frame
- Throws:
UnexpectedResultException
- if the current value is not of type long- Since:
- 24.2
-
setLong
default void setLong(int slot, long value) Write access to a local variable of type long.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.0
-
getFloat
Read access to a local variable of type float.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable
- Throws:
FrameSlotTypeException
- if the current value is not of type float- Since:
- 22.0
-
expectFloat
Read and expects a value of type float for a given slot. Expect methods are intended to be used to implement speculative behavior where slots are expected to be tagged with a type. If the type changes anUnexpectedResultException
will be thrown containing the result ofgetValue(slot)
. Clients of this API are then expected to rewrite and no longer use an expect methods for future reads of that slot. Expect methods are particularly useful to implement stack like behavior with a frame.- Parameters:
slot
- the index of the slot- Returns:
- the value of the slot in this frame
- Throws:
UnexpectedResultException
- if the current value is not of type float- Since:
- 24.2
-
setFloat
default void setFloat(int slot, float value) Write access to a local variable of type float.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.0
-
getDouble
Read access to a local variable of type double.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable
- Throws:
FrameSlotTypeException
- if the current value is not of type double- Since:
- 22.0
-
expectDouble
Read and expects a value of type double for a given slot. Expect methods are intended to be used to implement speculative behavior where slots are expected to be tagged with a type. If the type changes anUnexpectedResultException
will be thrown containing the result ofgetValue(slot)
. Clients of this API are then expected to rewrite and no longer use an expect methods for future reads of that slot. Expect methods are particularly useful to implement stack like behavior with a frame.- Parameters:
slot
- the index of the slot- Returns:
- the value of the slot in this frame
- Throws:
UnexpectedResultException
- if the current value is not of type double- Since:
- 24.2
-
setDouble
default void setDouble(int slot, double value) Write access to a local variable of type double.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.0
-
getValue
Read access to a local variable of any type.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable or defaultValue if unset
- Since:
- 22.0
-
copy
default void copy(int srcSlot, int destSlot) Copies, including the type, from one slot to another.- Parameters:
srcSlot
- the slot of the source local variabledestSlot
- the slot of the target local variable- Since:
- 22.0
-
swap
default void swap(int first, int second) Swaps, including the type, the contents of two slots.- Parameters:
first
- the slot of the first local variablesecond
- the slot of the second local variable- Since:
- 22.0
-
getTag
default byte getTag(int slot) Determines the actualFrameSlotKind
of the value in the slot, and returns it asFrameSlotKind.tag
.- Parameters:
slot
- the slot of the local variable- Returns:
- the tag of the value in the slot
- Since:
- 22.0
-
isObject
default boolean isObject(int slot) Check whether the given indexed slot is of type object.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
isByte
default boolean isByte(int slot) Check whether the given indexed slot is of type byte.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
isBoolean
default boolean isBoolean(int slot) Check whether the given indexed slot is of type boolean.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
isInt
default boolean isInt(int slot) Check whether the given indexed slot is of type int.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
isLong
default boolean isLong(int slot) Check whether the given indexed slot is of type long.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
isFloat
default boolean isFloat(int slot) Check whether the given indexed slot is of type float.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
isDouble
default boolean isDouble(int slot) Check whether the given indexed slot is of type double.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
isStatic
default boolean isStatic(int slot) Checks whether the given indexed slot is static.This method should not be used with static slots.
- Parameters:
slot
- the slot of the local variable- Since:
- 22.2
-
clear
default void clear(int slot) Clears the given indexed slot in the frame. Writing over a previously cleared slot is still allowed. Subsequent reads to this slot, unless re-written to, will fail withFrameSlotTypeException
.This method is intended to be used for implementations of liveness analysis. As such, the compiler will find and report any inconsistency with respect to liveness analysis when using this method, such as clearing a slot in a branch, but not on another one, and their execution merge.
Liveness analysis implementations are expected to clear unused slots on method entry
- Parameters:
slot
- the slot of the local variable- Since:
- 22.0
-
getAuxiliarySlot
- Parameters:
slot
- the auxiliary slot index to query- Returns:
- the current value of the auxiliary slot -
null
if it was never set (not the frame descriptor's default value) - Since:
- 22.0
-
setAuxiliarySlot
Sets the value of the given auxiliary slot.- Parameters:
slot
- the auxiliary slot indexvalue
- the new value- Since:
- 22.0
-
getObjectStatic
Static read access to a local variable of typeObject
. Requires the given slot to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable in the given slot is of typeObject
.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable, or
null
if slot is uninitialized. - Since:
- 22.2
-
setObjectStatic
Static write access to a local variable of typeObject
. Requires the given slot to useFrameSlotKind.Static
. Since this method does not update the internal slot type, language implementations have to track this information.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.2
-
getByteStatic
default byte getByteStatic(int slot) Static read access to a local variable of type byte. Requires the given slot to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable in the given slot is of type byte.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable, or
0
if slot is uninitialized. - Since:
- 22.2
-
setByteStatic
default void setByteStatic(int slot, byte value) Static write access to a local variable of type byte. Requires the given slot to useFrameSlotKind.Static
. Since this method does not update the internal slot type, language implementations have to track this information.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.2
-
getBooleanStatic
default boolean getBooleanStatic(int slot) Static read access to a local variable of type boolean. Requires the given slot to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable in the given slot is of type boolean.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable, or
false
if slot is uninitialized. - Since:
- 22.2
-
setBooleanStatic
default void setBooleanStatic(int slot, boolean value) Static write access to a local variable of type boolean. Requires the given slot to useFrameSlotKind.Static
. Since this method does not update the internal slot type, language implementations have to track this information.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.2
-
getIntStatic
default int getIntStatic(int slot) Static read access to a local variable of type int. Requires the given slot to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable in the given slot can is of type int.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable, or
0
if slot is uninitialized. - Since:
- 22.2
-
setIntStatic
default void setIntStatic(int slot, int value) Static write access to a local variable of type int. Requires the given slot to useFrameSlotKind.Static
. Since this method does not update the internal slot type, language implementations have to track this information.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.2
-
getLongStatic
default long getLongStatic(int slot) Static read access to a local variable of type long. Requires the given slot to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable in the given slot is of type long.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable, or
0
if slot is uninitialized. - Since:
- 22.2
-
setLongStatic
default void setLongStatic(int slot, long value) Static write access to a local variable of type long. Requires the given slot to useFrameSlotKind.Static
. Since this method does not update the internal slot type, language implementations have to track this information.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.2
-
getFloatStatic
default float getFloatStatic(int slot) Static read access to a local variable of type float. Requires the given slot to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable in the given slot is of type float.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable, or
0
if slot is uninitialized. - Since:
- 22.2
-
setFloatStatic
default void setFloatStatic(int slot, float value) Static write access to a local variable of type float. Requires the given slot to useFrameSlotKind.Static
. Since this method does not update the internal slot type, language implementations have to track this information.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.2
-
getDoubleStatic
default double getDoubleStatic(int slot) Static read access to a local variable of type double. Requires the given slot to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable in the given slot is of type double.- Parameters:
slot
- the slot of the local variable- Returns:
- the current value of the local variable, or
0
if slot is uninitialized. - Since:
- 22.2
-
setDoubleStatic
default void setDoubleStatic(int slot, double value) Static write access to a local variable of type double. Requires the given slot to useFrameSlotKind.Static
. Since this method does not update the internal slot type, language implementations have to track this information.- Parameters:
slot
- the slot of the local variablevalue
- the new value of the local variable- Since:
- 22.2
-
copyPrimitiveStatic
default void copyPrimitiveStatic(int srcSlot, int destSlot) Copies a primitive value from one slot to another. Requires both slots to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable at the source slot is a primitive value.- Parameters:
srcSlot
- the slot of the source local variabledestSlot
- the slot of the target local variable- Since:
- 22.2
-
copyObjectStatic
default void copyObjectStatic(int srcSlot, int destSlot) Copies an object value from one slot to another. Requires both slots to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variable at the source slot is anObject
.- Parameters:
srcSlot
- the slot of the source local variabledestSlot
- the slot of the target local variable- Since:
- 22.2
-
copyStatic
default void copyStatic(int srcSlot, int destSlot) Copies from one slot to another. Requires both slots to useFrameSlotKind.Static
. In cases where the underlying slot type is known,copyPrimitiveStatic(int, int)
andcopyObjectStatic(int, int)
should be used for performance reasons.- Parameters:
srcSlot
- the slot of the source local variabledestSlot
- the slot of the target local variable- Since:
- 22.3
-
swapPrimitiveStatic
default void swapPrimitiveStatic(int first, int second) Swaps the primitive values of two slots. Requires both slots to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variables in both slots are primitive values.- Parameters:
first
- the slot of the first local variablesecond
- the slot of the second local variable- Since:
- 22.3
-
swapObjectStatic
default void swapObjectStatic(int first, int second) Swaps the object values of two slots. Requires both slots to useFrameSlotKind.Static
. Since this method does not perform any type checks, language implementations have to guarantee that the variables in both slots areObject
s.- Parameters:
first
- the slot of the first local variablesecond
- the slot of the second local variable- Since:
- 22.3
-
swapStatic
default void swapStatic(int first, int second) Swaps the contents of two slots. Requires both slots to useFrameSlotKind.Static
. In cases where the underlying slot type is known,swapPrimitiveStatic(int, int)
andswapObjectStatic(int, int)
should be used for performance reasons.- Parameters:
first
- the slot of the first local variablesecond
- the slot of the second local variable- Since:
- 22.3
-
clearPrimitiveStatic
default void clearPrimitiveStatic(int slot) Clears the primitive value at the given slot in the frame. Requires the given slot to useFrameSlotKind.Static
. Writing over a previously cleared slot is still allowed. Subsequent reads to the slot, unless re-written to, are not allowed and will fail with anAssertionError
if assertions are enabled. Since this method does not perform any type checks, language implementations have to guarantee that the variable at the given slot is a primitive value.This method is intended to be used for implementations of liveness analysis. As such, the compiler will find and report any inconsistency with respect to liveness analysis when using this method, such as clearing a slot in a branch, but not on another one, and their execution merge.
Liveness analysis implementations are expected to clear unused slots on method entry.- Parameters:
slot
- the slot of the local variable- Since:
- 22.2
-
clearObjectStatic
default void clearObjectStatic(int slot) Clears the object value at the given slot in the frame. Requires the given slot to useFrameSlotKind.Static
. Writing over a previously cleared slot is still allowed. Subsequent reads to the slot, unless re-written to, are not allowed and will fail with anAssertionError
if assertions are enabled. Since this method does not perform any type checks, language implementations have to guarantee that the variable at the given slot is anObject
.This method is intended to be used for implementations of liveness analysis. As such, the compiler will find and report any inconsistency with respect to liveness analysis when using this method, such as clearing a slot in a branch, but not on another one, and their execution merge.
Liveness analysis implementations are expected to clear unused slots on method entry.- Parameters:
slot
- the slot of the local variable- Since:
- 22.2
-
clearStatic
default void clearStatic(int slot) Clears the value at the given slot in the frame. Requires the given slot to useFrameSlotKind.Static
. Writing over a previously cleared slot is still allowed. Subsequent reads to the slot, unless re-written to, are not allowed and will fail with anAssertionError
if assertions are enabled. In cases where the underlying slot type is known,clearPrimitiveStatic(int)
andclearObjectStatic(int)
should be used for performance reasons.- Parameters:
slot
- The slot of the local variable- Since:
- 22.3
-
copyTo
Copies values from this frame to the given frame. The frames are required to have the sameframe descriptors
.- Parameters:
srcOffset
- the slot of the first local variabledst
- the destination framedstOffset
- the first slot to copy locals intolength
- the number of slots to copy- Since:
- 24.2
-