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 recordRepresents a branch profile.static enumRepresents the kind of anInstruction.Argument. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConverts this argument to abranch profile.intConverts this argument to a bytecode index.Converts this argument to acached node.Converts this argument to a object constant.intConverts this argument to anintvalue.intConverts this argument to a local index.intConverts this argument to a local offset.Converts this argument to atag tree node.abstract Instruction.Argument.KindgetKind()Returns theInstruction.Argument.Kindof this argument.abstract StringgetName()Returns a human readable name for this argument.Converts this argument to aspecialization info.final StringtoString()
-
Constructor Details
-
Argument
-
-
Method Details
-
getKind
Returns theInstruction.Argument.Kindof this argument. The kind determines whichasXmethod 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 otherasXmethods (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 anintvalue. This method is only supported if the argumentkindisInstruction.Argument.Kind.INTEGER. If called for arguments of other kinds then anUnsupportedOperationExceptionis thrown.- Throws:
UnsupportedOperationException- Since:
- 24.2
-
asBytecodeIndex
public int asBytecodeIndex()Converts this argument to a bytecode index. This method is only supported if the argumentkindisInstruction.Argument.Kind.BYTECODE_INDEX. If called for arguments of other kinds then anUnsupportedOperationExceptionis 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 argumentkindisInstruction.Argument.Kind.CONSTANT. If called for arguments of other kinds then anUnsupportedOperationExceptionis thrown.- Since:
- 24.2
-
asCachedNode
Converts this argument to acached node. This method is only supported if the argumentkindisInstruction.Argument.Kind.NODE_PROFILE. If called for arguments of other kinds then anUnsupportedOperationExceptionis thrown. The returned value is nevernullif theBytecodeTierisBytecodeTier.CACHED.- Since:
- 24.2
-
asTagNode
Converts this argument to atag tree node. This method is only supported if the argumentkindisInstruction.Argument.Kind.TAG_NODE. If called for arguments of other kinds then anUnsupportedOperationExceptionis 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 argumentkindisInstruction.Argument.Kind.LOCAL_OFFSET. If called for arguments of other kinds then anUnsupportedOperationExceptionis 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 argumentkindisInstruction.Argument.Kind.LOCAL_INDEX. If called for arguments of other kinds then anUnsupportedOperationExceptionis 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 argumentkindisInstruction.Argument.Kind.BRANCH_PROFILE. If called for arguments of other kinds then anUnsupportedOperationExceptionis thrown. The returned value is nevernull.- Since:
- 24.2
-
getSpecializationInfo
Converts this argument to aspecialization info. This method is only supported if the argumentkindisInstruction.Argument.Kind.NODE_PROFILE. If called for arguments of other kinds then anUnsupportedOperationExceptionis thrown. The specialization info is only available ifGenerateBytecode.enableSpecializationIntrospection()is set totrue.- Since:
- 24.2
-
toString
-