Class BytecodeNode
- All Implemented Interfaces:
NodeInterface,Cloneable
bytecode configuration or the
tier changes.
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
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 when
the bytecode node changes, 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 binding it with @Bind BytecodeLocation location).
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 a range of locals from thesourceframe to thedestinationframe.protected static final ObjectInternal method called by generated code.final Stringdump()Convert this bytecode node to a string representation for debugging purposes.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) Internal method to be implemented by generated code.protected abstract intfindBytecodeIndex(Frame frame, Node operationNode) Internal method to be implemented by generated code.protected abstract InstructionfindInstruction(int bytecodeIndex) Internal method to be implemented by generated code.protected final BytecodeLocationfindLocation(int bytecodeIndex) Internal method called by generated code.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 particularFrameInstanceobtained 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 associated with the given 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 the info of a local, as provided during bytecode building.protected abstract ObjectgetLocalInfoInternal(int localOffset, int localIndex) Internal method to be implemented by generated code.final Object[]getLocalInfos(int bytecodeIndex) Returns a new array containing the infos of 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.protected abstract ObjectgetLocalNameInternal(int localOffset, int localIndex) Internal method to be implemented by generated code.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.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.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.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 the uncached interpreter must return, branch backwards, or yield before transitioning to cached.protected abstract inttranslateBytecodeIndex(BytecodeNode newNode, int bytecodeIndex) Internal method to be implemented by generated code.protected abstract booleanvalidateBytecodeIndex(int bytecodeIndex) Internal method to be implemented by generated code.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 particularFrameInstanceobtained 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 the bytecode index was obtained from this bytecode node by binding$bytecodeIndexor callinggetBytecodeIndex(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.- 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. More concrete source sections appear earlier in the array. Returnsnullif the node was not parsedwith sourcesor if there is no associated source section for the given location.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 associated with the given bytecode index. The result is only valid ifbytecodeIndexwas obtained from this bytecode node by binding$bytecodeIndexor callinggetBytecodeIndex(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, if Root operation directly contains two SourceSection operations covering different bytecode ranges, the tree's source section will benull. 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.- Since:
- 24.2
- See Also:
-
getExceptionHandlers
Returns all of theexception handlersassociated with this node.- Since:
- 24.2
-
getTagTree
-
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 reading locals directly in the bytecode (viaLoadLocaloperations orLocalAccessor) when possible.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 offset of the local. The offset should be between 0 andgetLocalCount(int)(and may come fromBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()). The value must be a partial evaluation constant.- Returns:
- the current local value, or null if the local was never written to (and there is no
default local value). - 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 offset of the local. The offset should be between 0 andgetLocalCount(int)(and may come fromBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()). The value must be a partial evaluation constant.- Returns:
- the local name as a partial evaluation constant
- Since:
- 24.2
- See Also:
-
getLocalInfos
Returns a new array containing the infos of 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 the info of 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 offset of the local. The offset should be between 0 andgetLocalCount(int)(and may come fromBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()). The value must be a partial evaluation constant.- 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 orLocalRangeAccessor) 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 store the local values intovalues- the values to store into the frame. The length of this array should match the number of live locals.- Since:
- 24.2
- See Also:
-
copyLocalValues
Copies the values of the live locals from the source frame to the destination frame. The frames must have the samedescriptoras this bytecode node.- 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 a range of locals from thesourceframe to thedestinationframe. The frames must have the samedescriptoras this bytecode node. 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 offset of the first local to be copied. The offset should be between 0 andgetLocalCount(int)(and may come fromBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()). The value must be a partial evaluation constant.localCount- the number of locals to copy. The value must be a partial evaluation constant.- 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 offset of the local. The offset should be between 0 andgetLocalCount(int)(and may come fromBytecodeLocal.getLocalOffset()orLocalVariable.getLocalOffset()). The value must be a partial evaluation constant.value- the value to store into the local- Since:
- 24.2
- See Also:
-
getLocalValueInternal
-
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
-
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
-
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
-
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
-
getLocalNameInternal
Internal method to be implemented by generated code.- Since:
- 24.2
-
getLocalInfoInternal
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 as a partial evaluation constant.
- 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 the uncached interpreter must return, branch backwards, or yield before transitioning to cached. SeeGenerateBytecode.defaultUncachedThreshold()for information about the default threshold and the meaning of differentthresholdvalues.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
-
dump
Convert this bytecode node to a string representation for debugging purposes.- Since:
- 24.2
- See Also:
-
dump
Convert this bytecode node to a string representation for debugging purposes. Highlights the location at the given bytecode index.- 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. Highlights the given bytecode location.- Parameters:
highlightedLocation- an optional location to highlight in the dump.- Since:
- 24.2
-
findInstruction
Internal method to be implemented by generated code.- Since:
- 24.2
-
findBytecodeIndex
-
findBytecodeIndex
Internal method to be implemented by generated code.- Since:
- 24.2
-
translateBytecodeIndex
Internal method to be implemented by generated code.- Since:
- 24.2
-
validateBytecodeIndex
protected abstract boolean validateBytecodeIndex(int bytecodeIndex) Internal method to be implemented by generated code.- Since:
- 24.2
-
findLocation
Internal method called by generated code.- Since:
- 24.2
-
createDefaultStackTraceElement
Internal method called by generated code.- Since:
- 24.2
-
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
-