Interface Frame
- All Known Subinterfaces:
MaterializedFrame, VirtualFrame
Object.- Since:
- 0.8 or earlier
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclear(int slot) Clears the given indexed slot in the frame.default voidclearObjectStatic(int slot) Clears the object value at the given slot in the frame.default voidclearPrimitiveStatic(int slot) Clears the primitive value at the given slot in the frame.default voidclearStatic(int slot) Clears the value at the given slot in the frame.default voidcopy(int srcSlot, int destSlot) Copies, including the type, from one slot to another.default voidcopyObjectStatic(int srcSlot, int destSlot) Copies an object value from one slot to another.default voidcopyPrimitiveStatic(int srcSlot, int destSlot) Copies a primitive value from one slot to another.default voidcopyStatic(int srcSlot, int destSlot) Copies from one slot to another.default voidCopies values from this frame to the given frame.default booleanexpectBoolean(int slot) Read and expects a value of type boolean for a given slot.default byteexpectByte(int slot) Read and expects a value of type byte for a given slot.default doubleexpectDouble(int slot) Read and expects a value of type double for a given slot.default floatexpectFloat(int slot) Read and expects a value of type float for a given slot.default intexpectInt(int slot) Read and expects a value of type int for a given slot.default longexpectLong(int slot) Read and expects a value of type long for a given slot.default ObjectexpectObject(int slot) Read and expects a value of type object for a given slot.Object[]Retrieves the arguments object from this frame.default ObjectgetAuxiliarySlot(int slot) default booleangetBoolean(int slot) Read access to a local variable of type boolean.default booleangetBooleanStatic(int slot) Static read access to a local variable of type boolean.default bytegetByte(int slot) Read access to a local variable of type byte.default bytegetByteStatic(int slot) Static read access to a local variable of type byte.default doublegetDouble(int slot) Read access to a local variable of type double.default doublegetDoubleStatic(int slot) Static read access to a local variable of type double.default floatgetFloat(int slot) Read access to a local variable of type float.default floatgetFloatStatic(int slot) Static read access to a local variable of type float.default intgetInt(int slot) Read access to a local variable of type int.default intgetIntStatic(int slot) Static read access to a local variable of type int.default longgetLong(int slot) Read access to a local variable of type long.default longgetLongStatic(int slot) Static read access to a local variable of type long.default ObjectgetObject(int slot) Read access to a local variable of typeObject.default ObjectgetObjectStatic(int slot) Static read access to a local variable of typeObject.default bytegetTag(int slot) Determines the actualFrameSlotKindof the value in the slot, and returns it asFrameSlotKind.tag.default ObjectgetValue(int slot) Read access to a local variable of any type.default booleanisBoolean(int slot) Check whether the given indexed slot is of type boolean.default booleanisByte(int slot) Check whether the given indexed slot is of type byte.default booleanisDouble(int slot) Check whether the given indexed slot is of type double.default booleanisFloat(int slot) Check whether the given indexed slot is of type float.default booleanisInt(int slot) Check whether the given indexed slot is of type int.default booleanisLong(int slot) Check whether the given indexed slot is of type long.default booleanisObject(int slot) Check whether the given indexed slot is of type object.default booleanisStatic(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 voidsetAuxiliarySlot(int slot, Object value) Sets the value of the given auxiliary slot.default voidsetBoolean(int slot, boolean value) Write access to a local variable of type boolean.default voidsetBooleanStatic(int slot, boolean value) Static write access to a local variable of type boolean.default voidsetByte(int slot, byte value) Write access to a local variable of type byte.default voidsetByteStatic(int slot, byte value) Static write access to a local variable of type byte.default voidsetDouble(int slot, double value) Write access to a local variable of type double.default voidsetDoubleStatic(int slot, double value) Static write access to a local variable of type double.default voidsetFloat(int slot, float value) Write access to a local variable of type float.default voidsetFloatStatic(int slot, float value) Static write access to a local variable of type float.default voidsetInt(int slot, int value) Write access to a local variable of type int.default voidsetIntStatic(int slot, int value) Static write access to a local variable of type int.default voidsetLong(int slot, long value) Write access to a local variable of type long.default voidsetLongStatic(int slot, long value) Static write access to a local variable of type long.default voidWrite access to a local variable of typeObject.default voidsetObjectStatic(int slot, Object value) Static write access to a local variable of typeObject.default voidswap(int first, int second) Swaps, including the type, the contents of two slots.default voidswapObjectStatic(int first, int second) Swaps the object values of two slots.default voidswapPrimitiveStatic(int first, int second) Swaps the primitive values of two slots.default voidswapStatic(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 anUnexpectedResultExceptionwill 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
-
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 anUnexpectedResultExceptionwill 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 anUnexpectedResultExceptionwill 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 anUnexpectedResultExceptionwill 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 anUnexpectedResultExceptionwill 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 anUnexpectedResultExceptionwill 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 anUnexpectedResultExceptionwill 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 actualFrameSlotKindof 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 -
nullif 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
nullif 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
0if 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
falseif 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
0if 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
0if 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
0if 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
0if 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 areObjects.- 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 anAssertionErrorif 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 anAssertionErrorif 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 anAssertionErrorif 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:
sourceOffset- the slot of the first local variabledestination- the destination framedestinationOffset- the first slot to copy locals intolength- the number of slots to copy- Throws:
IllegalArgumentException- if a frame using a differentFrameDescriptoris passed.IndexOutOfBoundsException- if an invalid offset or length was passed.- Since:
- 24.2
-