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/resumes and
back-edges 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 Node
Node.Child, Node.Children
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BytecodeNode
(Object token) Internal constructor for generated code. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
clearLocalValueInternal
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.final void
copyLocalValues
(int bytecodeIndex, Frame source, Frame destination) Copies the values of the live locals from the source frame to the destination frame.final void
copyLocalValues
(int bytecodeIndex, Frame source, Frame destination, int localOffset, int localCount) Copies a range of locals from thesource
frame to thedestination
frame.protected static final Object
Internal method called by generated code.final String
dump()
Convert this bytecode node to a string representation for debugging purposes.final String
dump
(int bytecodeIndex) Convert this bytecode node to a string representation for debugging purposes.final String
dump
(BytecodeLocation highlightedLocation) Convert this bytecode node to a string representation for debugging purposes.final BytecodeNode
Ensures that sources are materialized for this node and returns an updated bytecode node if it changed during materialization.protected abstract int
findBytecodeIndex
(FrameInstance frameInstance) Internal method to be implemented by generated code.protected abstract int
findBytecodeIndex
(Frame frame, Node operationNode) Internal method to be implemented by generated code.protected abstract Instruction
findInstruction
(int bytecodeIndex) Internal method to be implemented by generated code.protected final BytecodeLocation
findLocation
(int bytecodeIndex) Internal method called by generated code.static BytecodeNode
get
(FrameInstance frameInstance) Gets the bytecode node for a given FrameInstance.static BytecodeNode
Gets the bytecode location for a given Node, if it can be found in the parent chain.static BytecodeNode
get
(TruffleStackTraceElement element) Gets the bytecode location for a givenTruffleStackTraceElement
, if it can be found using the stack trace location.int
getBytecodeIndex
(Frame frame) Reads and returns the bytecode index from theframe
.final BytecodeLocation
getBytecodeLocation
(int bytecodeIndex) Gets the bytecode location associated with a bytecode index.final BytecodeLocation
getBytecodeLocation
(FrameInstance frameInstance) Gets the bytecode location associated with a particularFrameInstance
obtained from a stack walk.final BytecodeLocation
getBytecodeLocation
(Frame frame, Node location) Returns the current bytecode location using the current frame and location.final BytecodeRootNode
Returns theBytecodeRootNode
to which this node belongs.abstract List
<ExceptionHandler> Returns all of theexception handlers
associated with this node.final Instruction
getInstruction
(int bytecodeIndex) Gets the instruction associated with the given bytecode index.final Iterable
<Instruction> Returns the current set ofinstructions
as anIterable
.final List
<Instruction> Returns the current set ofinstructions
as aList
with random access.abstract int
getLocalCount
(int bytecodeIndex) Returns the number of live locals at the givenbytecodeIndex
.abstract Object
getLocalInfo
(int bytecodeIndex, int localOffset) Returns the info of a local, as provided during bytecode building.protected abstract Object
getLocalInfoInternal
(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 Object
getLocalName
(int bytecodeIndex, int localOffset) Returns the name of the local at the givenlocalOffset
, as provided during bytecode building.protected abstract Object
getLocalNameInternal
(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 variables
with liveness info.abstract Object
getLocalValue
(int bytecodeIndex, Frame frame, int localOffset) Returns the current value of the local at offsetlocalOffset
in the frame.protected abstract Object
getLocalValueInternal
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected boolean
getLocalValueInternalBoolean
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected byte
getLocalValueInternalByte
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected double
getLocalValueInternalDouble
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected float
getLocalValueInternalFloat
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected int
getLocalValueInternalInt
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.protected long
getLocalValueInternalLong
(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 ofSourceInformation
for a bytecode node.abstract SourceInformationTree
Produces aSourceInformationTree
for this node.abstract SourceSection
getSourceLocation
(int bytecodeIndex) Finds the most concrete source location associated with the given bytecode index.final SourceSection
getSourceLocation
(FrameInstance frameInstance) Gets the source location associated with a particularframeInstance
.final SourceSection
getSourceLocation
(Frame frame, Node location) Gets the most concretesource location
associated 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 locations
associated with a particular location.abstract TagTree
Returns theTagTree
for this node.abstract BytecodeTier
getTier()
Returns the tier of this bytecode node.abstract boolean
Returnstrue
if source information was materialized for this bytecode node, otherwisefalse
.protected abstract boolean
isLocalClearedInternal
(Frame frame, int localOffset, int localIndex) Internal method to be implemented by generated code.abstract void
setLocalValue
(int bytecodeIndex, Frame frame, int localOffset, Object value) Updates the current value of the local at indexlocalOffset
in the frame.protected abstract void
setLocalValueInternal
(Frame frame, int localOffset, int localIndex, Object value) Internal method to be implemented by generated code.protected void
setLocalValueInternalBoolean
(Frame frame, int localOffset, int localIndex, boolean value) Internal method to be implemented by generated code.protected void
setLocalValueInternalByte
(Frame frame, int localOffset, int localIndex, byte value) Internal method to be implemented by generated code.protected void
setLocalValueInternalDouble
(Frame frame, int localOffset, int localIndex, double value) Internal method to be implemented by generated code.protected void
setLocalValueInternalFloat
(Frame frame, int localOffset, int localIndex, float value) Internal method to be implemented by generated code.protected void
setLocalValueInternalInt
(Frame frame, int localOffset, int localIndex, int value) Internal method to be implemented by generated code.protected void
setLocalValueInternalLong
(Frame frame, int localOffset, int localIndex, long value) Internal method to be implemented by generated code.final void
setLocalValues
(int bytecodeIndex, Frame frame, Object[] values) Updates the values of the live locals in the frame.static boolean
setLocalValues
(FrameInstance frameInstance, Object[] values) Sets the current values of the live locals in theframeInstance
.abstract void
setUncachedThreshold
(int threshold) Sets the number of times the uncached interpreter must be invoked/resumed or branch backwards before transitioning to cached.protected abstract int
translateBytecodeIndex
(BytecodeNode newNode, int bytecodeIndex) Internal method to be implemented by generated code.protected abstract boolean
validateBytecodeIndex
(int bytecodeIndex) Internal method to be implemented by generated code.Methods inherited from class 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 the bytecode index was obtained from this bytecode node by binding$bytecodeIndex
or callinggetBytecodeIndex(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 location
associated with a particular location. Returnsnull
if the node was not parsedwith sources
or 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
null
if the location is invalid or source sections are not available. - Since:
- 24.2
-
getSourceLocations
Gets allsource locations
associated with a particular location. More concrete source sections appear earlier in the array. Returnsnull
if the node was not parsedwith sources
or if there is no associated source section for the given location.If source sections have not yet been materialized, then
null
is 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
null
if 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 returnsnull
if no source section could be found.If source sections have not yet been materialized, then
null
is 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
null
is 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
null
is 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
null
is 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 theBytecodeRootNode
to which this node belongs.- Since:
- 24.2
-
getInstruction
Gets the instruction associated with the given bytecode index. The result is only valid ifbytecodeIndex
was obtained from this bytecode node by binding$bytecodeIndex
or callinggetBytecodeIndex(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 ofinstructions
as 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 ofinstructions
as aList
with 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 ofSourceInformation
for 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
SourceInformation
elements when it isaccessed
.- Since:
- 24.2
-
getSourceInformationTree
Produces aSourceInformationTree
for this node. If no source information is available, returnsnull
.The tree returned by this method will have a
source section
that spans the whole bytecode range, or anull
section 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 benull
even 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()Returnstrue
if source information was materialized for this bytecode node, otherwisefalse
.- Since:
- 24.2
- See Also:
-
getExceptionHandlers
Returns all of theexception handlers
associated 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 (viaLoadLocal
operations 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 offsetlocalOffset
in 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 (viaLoadLocal
operations 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 acreateLocal
overload 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 acreateLocal
overload 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 acreateLocal
overload 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 acreateLocal
overload 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 (viaStoreLocal
operations 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 samedescriptor
as 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 thesource
frame to thedestination
frame. The frames must have the samedescriptor
as 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 indexlocalOffset
in 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 (viaStoreLocal
operations 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 variables
with 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 be invoked/resumed or branch backwards before transitioning to cached. SeeGenerateBytecode.defaultUncachedThreshold()
for information about the default threshold and the meaning of differentthreshold
values.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 theFrameInstance
is 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
-