Class BytecodeNode
- All Implemented Interfaces:
NodeInterface,Cloneable
bytecode configuration or the tier changes a new
BytecodeNode is created and automatically replaced.
The tier of a bytecode node initially always starts out as
BytecodeTier.UNCACHED. This means that no cached nodes were created yet. The
uncached threshold determines how many calls, back-edges, and
yields are necessary for the node to transition to the cached tier. By default the uncached
threshold is 16 if the uncached interpreter
is enabled, and 0 if not (i.e., it will transition to cached on the first execution). The
intention of the uncached bytecode tier is to reduce the footprint of root nodes that are only
executed infrequently.
The current bytecode node can be bound using @Bind BytecodeNode bytecode in the
specialization of an Operation. Since the instructions for a root node can change between
bytecode nodes, a bytecode index is only valid for a particular bytecode node. It is therefore
recommended to create a BytecodeLocation when storing a location (by using
getBytecodeLocation(int) or using @Bind BytecodeLocation location to bind it).
This class is not intended to be subclassed by clients, only by code generated by the Bytecode DSL.
- Since:
- 24.2
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
Node.Child, Node.Children -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBytecodeNode(Object token) Internal constructor for generated code. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidclearLocalValueInternal(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.final voidcopyLocalValues(int bytecodeIndex, Frame source, Frame destination) Copies the values of the live locals from the source frame to the destination frame.final voidcopyLocalValues(int bytecodeIndex, Frame source, Frame destination, int localOffset, int localCount) Copies the firstlengthlocals from thesourceframe to thedestinationframe.protected static final Objectfinal Stringdump()Dumps the bytecode with no highlighted location.final Stringdump(int bytecodeIndex) Convert this bytecode node to a string representation for debugging purposes.final Stringdump(BytecodeLocation highlightedLocation) Convert this bytecode node to a string representation for debugging purposes.final BytecodeNodeEnsures that sources are materialized for this node and returns an updated bytecode node if it changed during materialization.protected abstract intfindBytecodeIndex(FrameInstance frameInstance) protected abstract intfindBytecodeIndex(Frame frame, Node operationNode) protected abstract InstructionfindInstruction(int bytecodeIndex) protected final BytecodeLocationfindLocation(int bytecodeIndex) static BytecodeNodeget(FrameInstance frameInstance) Gets the bytecode node for a given FrameInstance.static BytecodeNodeGets the bytecode location for a given Node, if it can be found in the parent chain.static BytecodeNodeget(TruffleStackTraceElement element) Gets the bytecode location for a givenTruffleStackTraceElement, if it can be found using the stack trace location.intgetBytecodeIndex(Frame frame) Reads and returns the bytecode index from theframe.final BytecodeLocationgetBytecodeLocation(int bytecodeIndex) Gets the bytecode location associated with a bytecode index.final BytecodeLocationgetBytecodeLocation(FrameInstance frameInstance) Gets the bytecode location associated with a particularframeInstance, obtained from a stack walk.final BytecodeLocationgetBytecodeLocation(Frame frame, Node location) Returns the current bytecode location using the current frame and location.final BytecodeRootNodeReturns theBytecodeRootNodeto which this node belongs.abstract List<ExceptionHandler> Returns all of theexception handlersassociated with this node.final InstructiongetInstruction(int bytecodeIndex) Gets the instruction with a bytecode index.final Iterable<Instruction> Returns the current set ofinstructionsas anIterable.final List<Instruction> Returns the current set ofinstructionsas aListwith random access.abstract intgetLocalCount(int bytecodeIndex) Returns the number of live locals at the givenbytecodeIndex.abstract ObjectgetLocalInfo(int bytecodeIndex, int localOffset) Returns theinfoof a local, as provided during bytecode building.final Object[]getLocalInfos(int bytecodeIndex) Returns a new array containing theinfosof locals, as provided during bytecode building.abstract ObjectgetLocalName(int bytecodeIndex, int localOffset) Returns the name of the local at the givenlocalOffset, as provided during bytecode building.final Object[]getLocalNames(int bytecodeIndex) Returns a new array containing the slot name of locals, as provided during bytecode building.static Object[]getLocalNames(FrameInstance frameInstance) Returns a new array containing the names of the live locals in theframeInstance.abstract List<LocalVariable> Returns a list of all of thelocal variableswith liveness info.abstract ObjectgetLocalValue(int bytecodeIndex, Frame frame, int localOffset) Returns the current value of the local at offsetlocalOffsetin the frame.booleangetLocalValueBoolean(int bytecodeIndex, Frame frame, int localOffset) Returns the current boolean value of the local at offsetlocalOffsetin the frame.protected abstract ObjectgetLocalValueInternal(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected booleangetLocalValueInternalBoolean(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected bytegetLocalValueInternalByte(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected doublegetLocalValueInternalDouble(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected floatgetLocalValueInternalFloat(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected intgetLocalValueInternalInt(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected longgetLocalValueInternalLong(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected shortgetLocalValueInternalShort(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.final Object[]getLocalValues(int bytecodeIndex, Frame frame) Returns a new array containing the current value of each local in the frame.static Object[]getLocalValues(FrameInstance frameInstance) Returns a new array containing the current value of each live local in theframeInstance.abstract List<SourceInformation> Produces a list ofSourceInformationfor a bytecode node.abstract SourceInformationTreeProduces aSourceInformationTreefor this node.abstract SourceSectiongetSourceLocation(int bytecodeIndex) Finds the most concrete source location associated with the given bytecode index.final SourceSectiongetSourceLocation(FrameInstance frameInstance) Gets the source location associated with a particularframeInstance.final SourceSectiongetSourceLocation(Frame frame, Node location) Gets the most concretesource locationassociated with a particular location.abstract SourceSection[]getSourceLocations(int bytecodeIndex) Finds all source locations associated with the given bytecode index.final SourceSection[]getSourceLocations(FrameInstance frameInstance) Gets all source locations associated with a particularframeInstance.final SourceSection[]getSourceLocations(Frame frame, Node location) Gets allsource locationsassociated with a particular location.abstract TagTreeReturns theTagTreefor this node.abstract BytecodeTiergetTier()Returns the tier of this bytecode node.abstract booleanReturnstrueif source information was materialized for this bytecode node, otherwisefalse.protected abstract booleanisLocalClearedInternal(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.abstract voidsetLocalValue(int bytecodeIndex, Frame frame, int localOffset, Object value) Updates the current value of the local at indexlocalOffsetin the frame.protected abstract voidsetLocalValueInternal(Frame frame, int localOffset, int localIndex, Object value) Internal method to be implemented by generated code.protected voidsetLocalValueInternalBoolean(Frame frame, int localOffset, int localIndex, boolean value) Internal method to be implemented by generated code.protected voidsetLocalValueInternalByte(Frame frame, int localOffset, int localIndex, byte value) Internal method to be implemented by generated code.protected voidsetLocalValueInternalDouble(Frame frame, int localOffset, int localIndex, double value) Internal method to be implemented by generated code.protected voidsetLocalValueInternalFloat(Frame frame, int localOffset, int localIndex, float value) Internal method to be implemented by generated code.protected voidsetLocalValueInternalInt(Frame frame, int localOffset, int localIndex, int value) Internal method to be implemented by generated code.protected voidsetLocalValueInternalLong(Frame frame, int localOffset, int localIndex, long value) Internal method to be implemented by generated code.protected voidsetLocalValueInternalShort(Frame frame, int localOffset, int localIndex, short value) Internal method to be implemented by generated code.final voidsetLocalValues(int bytecodeIndex, Frame frame, Object[] values) Updates the values of the live locals in the frame.static booleansetLocalValues(FrameInstance frameInstance, Object[] values) Sets the current values of the live locals in theframeInstance.abstract voidsetUncachedThreshold(int threshold) Sets the number of times an uncached interpreter must return, branch backwards, or yield before transitioning to cached.protected abstract inttranslateBytecodeIndex(BytecodeNode newNode, int bytecodeIndex) protected abstract booleanvalidateBytecodeIndex(int bytecodeIndex) Methods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, reportReplace, toString
-
Constructor Details
-
BytecodeNode
Internal constructor for generated code. Do not use.- Since:
- 24.2
-
-
Method Details
-
getBytecodeLocation
Returns the current bytecode location using the current frame and location.- Parameters:
frame- the current framelocation- the current location- Returns:
- the bytecode location, or null if the frame and node do not originate from a Bytecode DSL root node.
- Since:
- 24.2
-
getBytecodeLocation
Gets the bytecode location associated with a particularframeInstance, obtained from a stack walk.- Parameters:
frameInstance- the frame instance- Returns:
- the bytecode location, or null if the frame instance does not originate from a Bytecode DSL root node.
- Since:
- 24.2
-
getBytecodeLocation
Gets the bytecode location associated with a bytecode index. The result is only valid if bytecode index was obtained from this bytecode node using a bind variable $bytecodeIndex orgetBytecodeIndex(com.oracle.truffle.api.frame.Frame).- Parameters:
bytecodeIndex- the current bytecode index. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation.- Throws:
IllegalArgumentException- if an invalid bytecode index was passed. This check is performed only if assertions (-ea) are enabled for performance reasons.- Since:
- 24.2
-
getBytecodeIndex
Reads and returns the bytecode index from theframe. This method should only be called if the interpreter is configured tostore the bytecode index in the frame; be sure to read the documentation before using this feature.- Returns:
- the bytecode index stored in the frame
- Throws:
UnsupportedOperationException- if the interpreter does not always store the bytecode index in the frame. SeeGenerateBytecode.storeBytecodeIndexInFrame()- Since:
- 24.2
-
getSourceLocation
Gets the most concretesource locationassociated with a particular location. Returnsnullif the node was not parsedwith sourcesor if there is no associated source section for the given location. A location must always be provided to get a source location otherwisenullwill be returned.- Parameters:
frame- the current framelocation- the current location- Returns:
- a source section corresponding to the location. Returns
nullif the location is invalid or source sections are not available. - Since:
- 24.2
-
getSourceLocations
Gets allsource locationsassociated with a particular location. Returnsnullif the node was not parsedwith sourcesor if there is no associated source section for the given location. A location must always be provided to get a source location otherwisenullwill be returned.If source sections have not yet been materialized, then
nullis returned. Source sections may be materialized by callingensureSourceInformation().- Parameters:
frame- the current framelocation- the current location- Returns:
- an array of source sections corresponding to the location. Returns
nullif the location is invalid or source sections are not available.
-
getSourceLocation
Finds the most concrete source location associated with the given bytecode index. The method returnsnullif no source section could be found.If source sections have not yet been materialized, then
nullis returned. Source sections can be materialized by callingensureSourceInformation().- Parameters:
bytecodeIndex- the bytecode index, used to determine liveness of source sections. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant.- Since:
- 24.2
-
getSourceLocations
Finds all source locations associated with the given bytecode index. More concrete source sections appear earlier in the array. Typically, a given section will contain the previous source section, but there is no guarantee that this the case.If source sections have not yet been materialized, then
nullis returned. Source sections can be materialized by callingensureSourceInformation().- Parameters:
bytecodeIndex- the bytecode index, used to determine liveness of source sections. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant.- Since:
- 24.2
-
getSourceLocation
Gets the source location associated with a particularframeInstance. *If source sections have not yet been materialized, then
nullis returned. Source sections can be materialized by callingensureSourceInformation().- Parameters:
frameInstance- the frame instance- Returns:
- the source location, or null if a location could not be found
- Since:
- 24.2
-
getSourceLocations
Gets all source locations associated with a particularframeInstance. *If source sections have not yet been materialized, then
nullis returned. Source sections can be materialized by callingensureSourceInformation().- Parameters:
frameInstance- the frame instance- Returns:
- the source locations, or null if they could not be found
- Since:
- 24.2
-
getBytecodeRootNode
Returns theBytecodeRootNodeto which this node belongs.- Since:
- 24.2
-
getInstruction
Gets the instruction with a bytecode index. The result is only valid if bytecode index was obtained from this bytecode node using a bind variable $bytecodeIndex orgetBytecodeIndex(com.oracle.truffle.api.frame.Frame).Compatibility note: The result of this method 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.
- Parameters:
bytecodeIndex- the current bytecode index. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation.- Since:
- 24.2
-
getInstructions
Returns the current set ofinstructionsas anIterable.Compatibility note: The result of this method 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.
Footprint note: the backing iterable implementation consumes a fixed amount of memory. It allocates the underlying instructions when it is iterated.
- Since:
- 24.2
-
getInstructionsAsList
Returns the current set ofinstructionsas aListwith random access.Compatibility note: The result of this method 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.
Footprint note: this method eagerly materializes an entire list, unlike
getInstructions(), which allocates its elements on demand. Prefer to usegetInstructions()for simple iteration use cases.- Since:
- 24.2
-
getSourceInformation
Produces a list ofSourceInformationfor a bytecode node. If no source information is available, returnsnull.Footprint note: the backing list implementation consumes a fixed amount of memory. It allocates the underlying
SourceInformationelements when it isaccessed.- Since:
- 24.2
-
getSourceInformationTree
Produces aSourceInformationTreefor this node. If no source information is available, returnsnull.The tree returned by this method will have a
source sectionthat spans the whole bytecode range, or anullsection if no such section exists. For example, the Root operation could directly contain two SourceSection operations that cover different bytecode ranges. The source section can benulleven if there is a single SourceSection operation containing the entire root body. For reliable source information that covers the entire bytecode range, the Root operation should be nested inside of a SourceSection operation.Footprint note: this method eagerly materializes an entire tree, unlike
getSourceInformation(), which allocates its elements on demand. Prefer to usegetSourceInformation()unless you need to traverse the source tree.- Since:
- 24.2
-
ensureSourceInformation
Ensures that sources are materialized for this node and returns an updated bytecode node if it changed during materialization.- Since:
- 24.2
- See Also:
-
hasSourceInformation
public abstract boolean hasSourceInformation()Returnstrueif source information was materialized for this bytecode node, otherwisefalse. This methods is guaranteed to returntrueifensureSourceInformation()was called prior to this method.- Since:
- 24.2
- See Also:
-
getExceptionHandlers
Returns all of theexception handlersassociated with this node.- Since:
- 24.2
-
getTagTree
Returns theTagTreefor this node. The tree only contains tag operations for the tags that were enabled during parsing; if no tags were enabled, returnsnull.- Since:
- 24.2
-
getLocalValues
Returns a new array containing the current value of each local in the frame. This method should only be used for slow-path use cases (like frame introspection). Prefer regular local load operations (viaLoadLocaloperations) when possible. If not possible usingLocalAccessorshould be preferred over using this method.An operation can use this method by binding the bytecode node to a specialization parameter (via
@Bind("$bytecodeNode")) and then invoking the method on the bytecode node.The order of the locals corresponds to the order in which they were created using one of the
createLocal()overloads. It is up to the language to track the creation order.- Parameters:
bytecodeIndex- the current bytecode index of the given frame. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant. If the bytecode index is inconsistent with the state of the frame passed then the result of this method is unspecified.frame- the frame to read locals from- Returns:
- an array of local values
- Since:
- 24.2
- See Also:
-
getLocalValue
Returns the current value of the local at offsetlocalOffsetin the frame. This method should be used for uncommon scenarios, like when a node needs to read a local directly from the frame. Prefer reading locals directly in the bytecode (viaLoadLocaloperations orLocalAccessor) when possible.- Parameters:
bytecodeIndex- the current bytecode index of the given frame. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant. If the bytecode index is inconsistent with the state of the frame passed then the result of this method is unspecified.frame- the frame to read locals fromlocalOffset- the logical offset of the local (as obtained byBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()).- Returns:
- the current local value, or null if the local never written to (and there is no
default local value). - Since:
- 24.2
- See Also:
-
getLocalValueBoolean
public boolean getLocalValueBoolean(int bytecodeIndex, Frame frame, int localOffset) throws UnexpectedResultException Returns the current boolean value of the local at offsetlocalOffsetin the frame. ThrowsUnexpectedResultExceptionif the value is not a boolean.- Throws:
UnexpectedResultException- Since:
- 24.2
- See Also:
-
getLocalNames
Returns a new array containing the slot name of locals, as provided during bytecode building. If a local is not allocated using acreateLocaloverload that takes aname, its name will benull.The order of the local names corresponds to the order in which the locals were created using one of the
createLocal()overloads. It is up to the language to track the creation order.- Parameters:
bytecodeIndex- the current bytecode index, used to determine liveness of locals. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant.- Returns:
- an array of local names
- Since:
- 24.2
- See Also:
-
getLocalName
Returns the name of the local at the givenlocalOffset, as provided during bytecode building. If a local is not allocated using acreateLocaloverload that takes aname, its name will benull.- Parameters:
bytecodeIndex- the current bytecode index, used to determine liveness of locals. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant.localOffset- the logical offset of the local (as obtained byBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()).- Returns:
- the local name as a partial evaluation constant
- Since:
- 24.2
- See Also:
-
getLocalInfos
Returns a new array containing theinfosof locals, as provided during bytecode building. If a local is not allocated using acreateLocaloverload that takes aninfo, its info will benull.The order of the local infos corresponds to the order in which the locals were created using one of the
createLocal()overloads. It is up to the language to track the creation order.- Parameters:
bytecodeIndex- the current bytecode index, used to determine liveness of locals. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant.- Returns:
- an array of local names
- Since:
- 24.2
- See Also:
-
getLocalInfo
Returns theinfoof a local, as provided during bytecode building. If a local is not allocated using acreateLocaloverload that takes aninfo, its info will benull.- Parameters:
bytecodeIndex- bytecodeIndex the current bytecode index, used to determine liveness of locals. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant.localOffset- the logical offset of the local (as obtained byBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()).- Returns:
- the local info as a partial evaluation constant
- Since:
- 24.2
- See Also:
-
setLocalValues
Updates the values of the live locals in the frame. This method should be used for uncommon scenarios, like setting locals in the prolog/epilog or from another root node. Prefer setting locals directly in the bytecode (viaStoreLocaloperations or) when possible.invalid reference
LocalAccessorRange- Parameters:
bytecodeIndex- the current bytecode index of the given frame. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant. If the bytecode index is inconsistent with the state of the frame passed then the result of this method is unspecified.frame- the frame to store the local values intovalues- the values to store into the frame- Since:
- 24.2
- See Also:
-
copyLocalValues
Copies the values of the live locals from the source frame to the destination frame.- Parameters:
bytecodeIndex- the current bytecode index of the given frames. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant. If the bytecode index is inconsistent with the state of the frames passed then the result of this method is unspecified.source- the frame to copy locals fromdestination- the frame to copy locals into- Since:
- 24.2
- See Also:
-
copyLocalValues
public final void copyLocalValues(int bytecodeIndex, Frame source, Frame destination, int localOffset, int localCount) Copies the firstlengthlocals from thesourceframe to thedestinationframe. The frames must have the samelayouts. Compared tocopyLocalValues(int, Frame, Frame), this method allows languages to selectively copy a subset of the frame's locals.For example, suppose that in addition to regular locals, a root node uses temporary locals for intermediate computations. Suppose also that the node needs to be able to compute the values of its regular locals (e.g., for frame introspection). This method can be used to only copy the regular locals and not the temporary locals -- assuming all of the regular locals were allocated (using
createLocal()) before the temporary locals.- Parameters:
bytecodeIndex- the current bytecode index of the given frames. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant. If the bytecode index is inconsistent with the state of the frame passed then the result of this method is unspecified.source- the frame to copy locals fromdestination- the frame to copy locals intolocalOffset- the logical offset of the first local to be copied (as obtained byBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()).localCount- the number of locals to copy- Since:
- 24.2
- See Also:
-
setLocalValue
Updates the current value of the local at indexlocalOffsetin the frame. This method should be used for uncommon scenarios, like setting a local in the prolog/epilog or from another root node. Prefer setting locals directly in the bytecode (viaStoreLocaloperations orLocalAccessor) when possible.This method will be generated by the Bytecode DSL. Do not override.
- Parameters:
bytecodeIndex- the current bytecode index of the given frame. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant. If the bytecode index is inconsistent with the state of the frame passed then the result of this method is unspecified.frame- the frame to store the local value intolocalOffset- the logical offset of the local (as obtained byBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()).value- the value to store into the local- Since:
- 24.2
- See Also:
-
getLocalValueInternal
Internal method to be implemented by generated code.- Since:
- 24.2
-
getLocalValueInternalBoolean
protected boolean getLocalValueInternalBoolean(Frame frame, int localOffset, int localIndex) throws UnexpectedResultException Internal method to be implemented by generated code.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getLocalValueInternalByte
protected byte getLocalValueInternalByte(Frame frame, int localOffset, int localIndex) throws UnexpectedResultException Internal method to be implemented by generated code.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getLocalValueInternalShort
protected short getLocalValueInternalShort(Frame frame, int localOffset, int localIndex) throws UnexpectedResultException Internal method to be implemented by generated code.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getLocalValueInternalInt
protected int getLocalValueInternalInt(Frame frame, int localOffset, int localIndex) throws UnexpectedResultException Internal method to be implemented by generated code.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getLocalValueInternalLong
protected long getLocalValueInternalLong(Frame frame, int localOffset, int localIndex) throws UnexpectedResultException Internal method to be implemented by generated code.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getLocalValueInternalFloat
protected float getLocalValueInternalFloat(Frame frame, int localOffset, int localIndex) throws UnexpectedResultException Internal method to be implemented by generated code.- Throws:
UnexpectedResultException- Since:
- 24.2
-
getLocalValueInternalDouble
protected double getLocalValueInternalDouble(Frame frame, int localOffset, int localIndex) throws UnexpectedResultException Internal method to be implemented by generated code.- Throws:
UnexpectedResultException- Since:
- 24.2
-
setLocalValueInternal
protected abstract void setLocalValueInternal(Frame frame, int localOffset, int localIndex, Object value) Internal method to be implemented by generated code.- Since:
- 24.2
-
setLocalValueInternalBoolean
protected void setLocalValueInternalBoolean(Frame frame, int localOffset, int localIndex, boolean value) Internal method to be implemented by generated code.- Since:
- 24.2
-
setLocalValueInternalByte
Internal method to be implemented by generated code.- Since:
- 24.2
-
setLocalValueInternalShort
protected void setLocalValueInternalShort(Frame frame, int localOffset, int localIndex, short value) Internal method to be implemented by generated code.- Since:
- 24.2
-
setLocalValueInternalInt
Internal method to be implemented by generated code.- Since:
- 24.2
-
setLocalValueInternalLong
Internal method to be implemented by generated code.- Since:
- 24.2
-
setLocalValueInternalFloat
protected void setLocalValueInternalFloat(Frame frame, int localOffset, int localIndex, float value) Internal method to be implemented by generated code.- Since:
- 24.2
-
setLocalValueInternalDouble
protected void setLocalValueInternalDouble(Frame frame, int localOffset, int localIndex, double value) Internal method to be implemented by generated code.- Since:
- 24.2
-
clearLocalValueInternal
Internal method to be implemented by generated code.- Since:
- 24.2
-
isLocalClearedInternal
Internal method to be implemented by generated code.- Since:
- 24.2
-
getLocalCount
public abstract int getLocalCount(int bytecodeIndex) Returns the number of live locals at the givenbytecodeIndex.- Parameters:
bytecodeIndex- the current bytecode index, used to determine liveness of locals. A valid bytecode index can be obtained by callingBytecodeLocation.getBytecodeIndex()or using @Bind("$bytecodeIndex") annotation. The value must be a partial evaluation constant.- Returns:
- the number of live locals
- Since:
- 24.2
- See Also:
-
getLocals
Returns a list of all of thelocal variableswith liveness info.- Returns:
- a list of locals
- Since:
- 24.2
-
setUncachedThreshold
public abstract void setUncachedThreshold(int threshold) Sets the number of times an uncached interpreter must return, branch backwards, or yield before transitioning to cached. The default threshold is16. Thethresholdshould be a positive value,0, orInteger.MIN_VALUE. A threshold of0forces the uncached interpreter to transition to cached on the next invocation. A threshold ofInteger.MIN_VALUEforces the uncached interpreter to stay uncached (i.e., it will not transition to cached).This method should be called before executing the root node. It will not have any effect on an uncached interpreter that is currently executing, an interpreter that is already cached, or an interpreter that does not
enable uncached.- Since:
- 24.2
-
getTier
Returns the tier of this bytecode node.- Since:
- 24.2
-
dump
Dumps the bytecode with no highlighted location.- Since:
- 24.2
- See Also:
-
dump
Convert this bytecode node to a string representation for debugging purposes.- Parameters:
bytecodeIndex- an optional location to highlight in the dump.- Since:
- 24.2
-
dump
Convert this bytecode node to a string representation for debugging purposes.- Parameters:
highlightedLocation- an optional location to highlight in the dump.- Since:
- 24.2
-
findInstruction
-
findBytecodeIndex
-
findBytecodeIndex
-
translateBytecodeIndex
-
validateBytecodeIndex
protected abstract boolean validateBytecodeIndex(int bytecodeIndex) -
findLocation
-
createDefaultStackTraceElement
-
getLocalValues
Returns a new array containing the current value of each live local in theframeInstance.- Parameters:
frameInstance- the frame instance- Returns:
- a new array of local values, or null if the frame instance does not correspond to an
BytecodeRootNode - Since:
- 24.2
- See Also:
-
getLocalNames
Returns a new array containing the names of the live locals in theframeInstance.- Parameters:
frameInstance- the frame instance- Returns:
- a new array of names, or null if the frame instance does not correspond to an
BytecodeRootNode - Since:
- 24.2
- See Also:
-
setLocalValues
Sets the current values of the live locals in theframeInstance.- Parameters:
frameInstance- the frame instance- Returns:
- whether the locals could be set with the information available in the frame instance
- Since:
- 24.2
- See Also:
-
get
Gets the bytecode node for a given FrameInstance. Frame instances are invalid as soon as the execution of a frame is continued. A bytecode node can be used to materialize aBytecodeLocation, which can be used after theFrameInstanceis no longer valid.- Parameters:
frameInstance- the frame instance- Returns:
- the corresponding bytecode node or null if no node can be found.
- Since:
- 24.2
-
get
Gets the bytecode location for a given Node, if it can be found in the parent chain.- Parameters:
node- the node- Returns:
- the corresponding bytecode location or null if no location can be found.
- Since:
- 24.2
-
get
Gets the bytecode location for a givenTruffleStackTraceElement, if it can be found using the stack trace location.- Parameters:
element- the stack trace element- Returns:
- the corresponding bytecode location or null if no location can be found.
- Since:
- 24.2
-