Class LocalRangeAccessor
java.lang.Object
com.oracle.truffle.api.bytecode.LocalRangeAccessor
Operation parameter that allows an operation to get, set, or clear locals declared in a
contiguous range.
To use a local range accessor, declare a ConstantOperand
on the operation. The
corresponding builder method for the operation will take a BytecodeLocal
array argument
for the locals to be accessed. These locals must be allocated sequentially during building. At
run time, a LocalRangeAccessor
for the locals will be supplied as a parameter to the
operation.
All of the accessor methods take a BytecodeNode
, the current Frame
, and an
offset. The offset should be a valid compilation-final index into the array of locals. See the
LocalAccessor
javadoc for restrictions on the other parameters and usage recommendations.
- Since:
- 24.2
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Clears the local at the given offset into the range.static LocalRangeAccessor
constantOf
(BytecodeLocal[] locals) Obtains aLocalRangeAccessor
.boolean
boolean
getBoolean
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Loads a boolean from the local at the given offset into the range.byte
getByte
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Loads a byte from the local at the given offset into the range.double
getDouble
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Loads a double from the local at the given offset into the range.float
getFloat
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Loads a float from the local at the given offset into the range.int
getInt
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Loads an int from the local at the given offset into the range.int
Returns the length of the range.getLocalInfo
(BytecodeNode bytecodeNode, int offset) Returns the info associated with the local.getLocalName
(BytecodeNode bytecodeNode, int offset) Returns the name associated with the local.long
getLong
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Loads a long from the local at the given offset into the range.getObject
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Loads an object from the local at the given offset into the range.int
hashCode()
boolean
isCleared
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) Checks whether the local at the given offset into the range has beencleared
(and a new value has not been set).void
setBoolean
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, boolean value) Stores a boolean into the local at the given offset into the range.void
setByte
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, byte value) Stores a byte into the local at the given offset into the range.void
setDouble
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, double value) Stores a double into the local at the given offset into the range.void
setFloat
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, float value) Stores a float into the local at the given offset into the range.void
setInt
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, int value) Stores an int into the local at the given offset into the range.void
setLong
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, long value) Stores a long into the local at the given offset into the range.void
setObject
(BytecodeNode bytecodeNode, VirtualFrame frame, int offset, Object value) Stores an object into the local at the given offset into the range.toString()
Returns a string representation of aLocalRangeAccessor
.
-
Method Details
-
getLength
public int getLength()Returns the length of the range.- Since:
- 24.2
-
hashCode
-
equals
-
toString
Returns a string representation of aLocalRangeAccessor
. -
getObject
Loads an object from the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
getBoolean
public boolean getBoolean(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException Loads a boolean from the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Throws:
UnexpectedResultException
- Since:
- 24.2
-
getByte
public byte getByte(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException Loads a byte from the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Throws:
UnexpectedResultException
- Since:
- 24.2
-
getInt
public int getInt(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException Loads an int from the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Throws:
UnexpectedResultException
- Since:
- 24.2
-
getLong
public long getLong(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException Loads a long from the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Throws:
UnexpectedResultException
- Since:
- 24.2
-
getFloat
public float getFloat(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException Loads a float from the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Throws:
UnexpectedResultException
- Since:
- 24.2
-
getDouble
public double getDouble(BytecodeNode bytecodeNode, VirtualFrame frame, int offset) throws UnexpectedResultException Loads a double from the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Throws:
UnexpectedResultException
- Since:
- 24.2
-
setObject
Stores an object into the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
setBoolean
Stores a boolean into the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
setByte
Stores a byte into the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
setInt
Stores an int into the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
setLong
Stores a long into the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
setFloat
Stores a float into the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
setDouble
Stores a double into the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
-
clear
Clears the local at the given offset into the range.- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
- See Also:
-
isCleared
Checks whether the local at the given offset into the range has beencleared
(and a new value has not been set).- Parameters:
offset
- a partial evaluation constant offset into the range.- Since:
- 24.2
- See Also:
-
getLocalName
Returns the name associated with the local.- Since:
- 24.2
- See Also:
-
getLocalInfo
Returns the info associated with the local.- Since:
- 24.2
- See Also:
-
constantOf
Obtains aLocalRangeAccessor
. This method is invoked by the generated code and should not be called directly.- Since:
- 24.2
-