Class BytecodeLocation
java.lang.Object
com.oracle.truffle.api.bytecode.BytecodeLocation
A materialized bytecode location.
The current bytecode location can be bound using @Bind BytecodeLocation location
in
operations
. In order to avoid the overhead of the BytecodeLocation allocation,
e.g. for exceptional cases, it is possible to create the bytecode location lazily from two
fields: @Bind BytecodeNode bytecode
and
@Bind("$bytecodeIndex") int bci
. This avoids the eager allocation of the bytecode
location. To create a bytecode location when it is needed the
get(Node, int)
method can be used.
- Since:
- 24.2
-
Method Summary
Modifier and TypeMethodDescriptiondump()
Dumps the bytecode debug information, highlighting this location in the result.Ensures source information available for this location andupdates
this location to a new location of the bytecode node with source information.boolean
static BytecodeLocation
get
(FrameInstance frameInstance) Gets the bytecode location for a given FrameInstance.static BytecodeLocation
Creates aBytecodeLocation
associated with the given node and bci.static BytecodeLocation
get
(TruffleStackTraceElement element) Creates aBytecodeLocation
associated with aTruffleStackTraceElement
.int
Returns the bytecode index.Returns theBytecodeNode
associated with this location.Returns all exception handlers that span over this bytecode location.Returns the bytecode instruction at this location, which provides additional debug information for debugging and tracing.Returns all source informations available at this location.Computes the most concrete source location of this bytecode location.Computes all source locations of this bytecode location.int
hashCode()
toString()
update()
Updates this location to the newestbytecode node
of the parentbytecode root node
, translating thebytecode index
to the new bytecode node in the process.
-
Method Details
-
getBytecodeIndex
public int getBytecodeIndex()Returns the bytecode index. This index is not stable and should only be used for debugging purposes. The bytecode index is only meaningful when coupled with a particularbytecode node
.- Since:
- 24.2
-
getBytecodeNode
Returns theBytecodeNode
associated with this location. Thebytecode index
is only valid for the returned node.- Since:
- 24.2
-
hashCode
-
equals
-
toString
-
dump
Dumps the bytecode debug information, highlighting this location in the result.- Returns:
- dump string
- Since:
- 24.2
- See Also:
-
update
Updates this location to the newestbytecode node
of the parentbytecode root node
, translating thebytecode index
to the new bytecode node in the process. It is useful to update the location if source information or instrumentations were materialized in the meantime. Note that thebytecode index
may be different in the updated location.- Since:
- 24.2
-
ensureSourceInformation
Ensures source information available for this location andupdates
this location to a new location of the bytecode node with source information. Materialization of source information may be an expensive operation if the source information was not yet materialized yet.- Since:
- 24.2
-
getSourceLocation
Computes the most concrete source location of this bytecode location.- Since:
- 24.2
- See Also:
-
getSourceLocations
Computes all source locations of this bytecode location. Returns an empty array if no source locations are available. The list is ordered from most to least concrete.- Since:
- 24.2
- See Also:
-
getInstruction
Returns the bytecode instruction at this location, which provides additional debug information for debugging and tracing.- Since:
- 24.2
-
getExceptionHandlers
Returns all exception handlers that span over this bytecode location. Returns an empty list if no exception handlers span over this location.- Since:
- 24.2
-
getSourceInformation
Returns all source informations available at this location.- Since:
- 24.2
-
get
Gets the bytecode location for a given FrameInstance. Frame instances are invalid as soon as the execution of a frame is continued. A bytecode location can be used to materialize an execution location in a bytecode interpreter, which can be used after theFrameInstance
is no longer valid.- Parameters:
frameInstance
- the frame instance- Returns:
- the corresponding bytecode location or null if no location can be found.
- Since:
- 24.2
-
get
Creates aBytecodeLocation
associated with the given node and bci.- Parameters:
location
- a node in the interpreter (can be bound using@Bind BytecodeNode bytecode
)bci
- a bytecode index (can be bound using@Bind("$bytecodeIndex") int bci
)- Returns:
- the
BytecodeLocation
ornull
iflocation
is not adopted by aBytecodeNode
. - Since:
- 24.2
-
get
Creates aBytecodeLocation
associated with aTruffleStackTraceElement
.- Returns:
- the
BytecodeLocation
ornull
if no bytecode interpreter can be found in the stack trace element. - Since:
- 24.2
-