Class MaterializedLocalAccessor
materialized
local accesses.
To use a materialized local accessor, declare a ConstantOperand on the operation. The
corresponding builder method for the operation will take a BytecodeLocal argument for the
local to be accessed. At run time, a MaterializedLocalAccessor for the local will be
supplied as a parameter to the operation.
Materialized local accessors are useful to implement behaviour that cannot be implemented with
the builtin materialized local operations (like StoreLocalMaterialized), nor with plain
local accessors.
All of the materialized accessor methods take a bytecode node and the
current frame. The bytecode node should be the current bytecode node
(not necessarily corresponding to the root node that declares the local); it should be
compilation-final. The frame should contain the local and be materialized.
Example usage:
@Operation
@ConstantOperand(type = MaterializedLocalAccessor.class)
public static final class GetMaterializedLocal {
@Specialization
public static Object perform(VirtualFrame frame,
MaterializedLocalAccessor accessor,
MaterializedFrame materializedFrame,
@Bind BytecodeNode bytecodeNode) {
return accessor.getObject(bytecodeNode, materializedFrame);
}
}
- Since:
- 24.2
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear(BytecodeNode bytecodeNode, MaterializedFrame frame) Clears the local from the frame.static MaterializedLocalAccessorconstantOf(int rootIndex, BytecodeLocal local) Obtains aMaterializedLocalAccessor.booleanbooleangetBoolean(BytecodeNode bytecodeNode, MaterializedFrame frame) Loads a boolean from the local.bytegetByte(BytecodeNode bytecodeNode, MaterializedFrame frame) Loads a byte from the local.doublegetDouble(BytecodeNode bytecodeNode, MaterializedFrame frame) Loads a double from the local.floatgetFloat(BytecodeNode bytecodeNode, MaterializedFrame frame) Loads a float from the local.intgetInt(BytecodeNode bytecodeNode, MaterializedFrame frame) Loads an int from the local.getLocalInfo(BytecodeNode bytecodeNode) Returns the info associated with the local.getLocalName(BytecodeNode bytecodeNode) Returns the name associated with the local.longgetLong(BytecodeNode bytecodeNode, MaterializedFrame frame) Loads a long from the local.getObject(BytecodeNode bytecodeNode, MaterializedFrame frame) Loads an object from the local.inthashCode()booleanisCleared(BytecodeNode bytecodeNode, MaterializedFrame frame) Checks whether the local has beencleared(and a new value has not been set).voidsetBoolean(BytecodeNode bytecodeNode, MaterializedFrame frame, boolean value) Stores a boolean into the local.voidsetByte(BytecodeNode bytecodeNode, MaterializedFrame frame, byte value) Stores a byte into the local.voidsetDouble(BytecodeNode bytecodeNode, MaterializedFrame frame, double value) Stores a double into the local.voidsetFloat(BytecodeNode bytecodeNode, MaterializedFrame frame, float value) Stores a float into the local.voidsetInt(BytecodeNode bytecodeNode, MaterializedFrame frame, int value) Stores an int into the local.voidsetLong(BytecodeNode bytecodeNode, MaterializedFrame frame, long value) Stores a long into the local.voidsetObject(BytecodeNode bytecodeNode, MaterializedFrame frame, Object value) Stores an object into the local.toString()Returns a string representation of aMaterializedLocalAccessor.
-
Method Details
-
toString
Returns a string representation of aMaterializedLocalAccessor. -
getObject
Loads an object from the local.- Since:
- 24.2
-
getBoolean
public boolean getBoolean(BytecodeNode bytecodeNode, MaterializedFrame frame) throws UnexpectedResultException Loads a boolean from the local.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getByte
public byte getByte(BytecodeNode bytecodeNode, MaterializedFrame frame) throws UnexpectedResultException Loads a byte from the local.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getInt
public int getInt(BytecodeNode bytecodeNode, MaterializedFrame frame) throws UnexpectedResultException Loads an int from the local.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getLong
public long getLong(BytecodeNode bytecodeNode, MaterializedFrame frame) throws UnexpectedResultException Loads a long from the local.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getFloat
public float getFloat(BytecodeNode bytecodeNode, MaterializedFrame frame) throws UnexpectedResultException Loads a float from the local.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getDouble
public double getDouble(BytecodeNode bytecodeNode, MaterializedFrame frame) throws UnexpectedResultException Loads a double from the local.- Throws:
UnexpectedResultException- Since:
- 24.2
-
setObject
Stores an object into the local.- Since:
- 24.2
-
setBoolean
Stores a boolean into the local.- Since:
- 24.2
-
setByte
Stores a byte into the local.- Since:
- 24.2
-
setInt
Stores an int into the local.- Since:
- 24.2
-
setLong
Stores a long into the local.- Since:
- 24.2
-
setFloat
Stores a float into the local.- Since:
- 24.2
-
setDouble
Stores a double into the local.- Since:
- 24.2
-
clear
Clears the local from the frame.Clearing the slot marks the frame slot as
illegal. An exception will be thrown if it is read before being set. Clearing does not insert adefault local value, if specified.- Since:
- 24.2
-
isCleared
Checks whether the local has beencleared(and a new value has not been set).This method also returns
trueif a local has not been initialized and nodefault local valueis specified.- Since:
- 24.2
-
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 aMaterializedLocalAccessor. This method is invoked by the generated code and should not be called directly.- Since:
- 24.2
-
equals
-
hashCode
-