Class Instruction.Argument
java.lang.Object
com.oracle.truffle.api.bytecode.Instruction.Argument
- Enclosing class:
Instruction
Represents metadata for an argument of an instruction in a bytecode node.
Compatibility note: The data contained in instruction classes is subject to change without notice between Truffle versions. This introspection API is therefore intended to be used for debugging and tracing purposes only. Do not rely on instructions for your language semantics.
- Since:
- 24.2
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Represents a branch profile.static enum
Represents the kind of anInstruction.Argument
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts this argument to abranch profile
.int
Converts this argument to a bytecode index.Converts this argument to acached node
.Converts this argument to a object constant.int
Converts this argument to anint
value.int
Converts this argument to a local index.int
Converts this argument to a local offset.Converts this argument to atag tree node
.abstract Instruction.Argument.Kind
getKind()
Returns theInstruction.Argument.Kind
of this argument.abstract String
getName()
Returns a human readable name for this argument.Converts this argument to aspecialization info
.final String
toString()
-
Constructor Details
-
Argument
-
-
Method Details
-
getKind
Returns theInstruction.Argument.Kind
of this argument. The kind determines whichasX
method can be called on a given argument.For example, if the kind is
Instruction.Argument.Kind.INTEGER
, theasInteger()
method will return the integer value. All otherasX
methods (e.g.,asBranchProfile()
) will throw an exception.- Since:
- 24.2
-
getName
Returns a human readable name for this argument. This could be for example"localOffset"
for a local variable access instruction. Arguments with the samegetKind()
may have differentnames
. A name is typically more descriptive than just the kind and should be preferred over the kind for debug output.- Since:
- 24.2
-
asInteger
Converts this argument to anint
value. This method is only supported if the argumentkind
isInstruction.Argument.Kind.INTEGER
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown.- Throws:
UnsupportedOperationException
- Since:
- 24.2
-
asBytecodeIndex
public int asBytecodeIndex()Converts this argument to a bytecode index. This method is only supported if the argumentkind
isInstruction.Argument.Kind.BYTECODE_INDEX
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown. If the returned value is >= 0 then the bytecode index can be used to be converted to aBytecodeLocation
.- Since:
- 24.2
-
asConstant
Converts this argument to a object constant. This method is only supported if the argumentkind
isInstruction.Argument.Kind.CONSTANT
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown.- Since:
- 24.2
-
asCachedNode
Converts this argument to acached node
. This method is only supported if the argumentkind
isInstruction.Argument.Kind.NODE_PROFILE
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown. The returned value is nevernull
if theBytecodeTier
isBytecodeTier.CACHED
.- Since:
- 24.2
-
asTagNode
Converts this argument to atag tree node
. This method is only supported if the argumentkind
isInstruction.Argument.Kind.TAG_NODE
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown. The returned value is nevernull
.- Since:
- 24.2
-
asLocalOffset
public int asLocalOffset()Converts this argument to a local offset. This method is only supported if the argumentkind
isInstruction.Argument.Kind.LOCAL_OFFSET
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown. This index may be used to access locals with the local access methods inBytecodeNode
.- Since:
- 24.2
- See Also:
-
asLocalIndex
public int asLocalIndex()Converts this argument to a local index. This method is only supported if the argumentkind
isInstruction.Argument.Kind.LOCAL_INDEX
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown. The local index can be used to index into the list oflocals
.- Since:
- 24.2
- See Also:
-
asBranchProfile
Converts this argument to abranch profile
. This method is only supported if the argumentkind
isInstruction.Argument.Kind.BRANCH_PROFILE
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown. The returned value is nevernull
.- Since:
- 24.2
-
getSpecializationInfo
Converts this argument to aspecialization info
. This method is only supported if the argumentkind
isInstruction.Argument.Kind.NODE_PROFILE
. If called for arguments of other kinds then anUnsupportedOperationException
is thrown. The specialization info is only available ifGenerateBytecode.enableSpecializationIntrospection()
is set totrue
.- Since:
- 24.2
-
toString
-