Class TruffleStackTraceElement
- Since:
- 0.27
-
Method Summary
Modifier and TypeMethodDescriptionstatic TruffleStackTraceElement
create
(Node location, RootCallTarget target, Frame frame) Create a new stack trace element.static TruffleStackTraceElement
create
(Node location, RootCallTarget target, Frame frame, int bytecodeIndex) Create a new stack trace element.int
Returns the bytecode index at the time when this frame was created.getFrame()
Returns the read-only frame.Returns an interop object representing this TruffleStackTraceElement supporting thehasExecutableName
and potentiallyhasDeclaringMetaObject
andhasSourceLocation
messages.Returns an instrumentable call node from a frame instance.Returns a node representing the callsite on the stack.Returns the call target on the stack.boolean
Returnstrue
if the stack trace element contains a valid bytecode index, elsefalse
.toString()
-
Method Details
-
create
Create a new stack trace element.- Parameters:
location
- SeegetLocation()
target
- SeegetTarget()
frame
- SeegetFrame()
- Since:
- 20.1.0
-
create
public static TruffleStackTraceElement create(Node location, RootCallTarget target, Frame frame, int bytecodeIndex) Create a new stack trace element.- Parameters:
location
- SeegetLocation()
target
- SeegetTarget()
frame
- SeegetFrame()
bytecodeIndex
- SeegetBytecodeIndex()
- Since:
- 24.1
-
getLocation
Returns a node representing the callsite on the stack.Returns
null
if no detailed callsite information is available. This is the case whenCallTarget.call(Object...)
is used or for the top-of-the-stack element or if the exception is an internal exception or theAbstractTruffleException.getLocation()
returnednull
.See
FrameInstance.getCallNode()
for the relation between callsite and CallTarget.- Since:
- 0.27
-
getInstrumentableLocation
Returns an instrumentable call node from a frame instance. This method should be preferred overgetLocation()
by tools to find the instrumentable node associated with this stack trace element.In case of bytecode interpreters the instrumentable node needs to be resolved by the language and is not directly accessible from the
parent
chain of the regularlocation
. Just likegetLocation()
this method may not directly return an instrumentable node. To find the eventual instrumentable node theparent
chain must be searched. There is no guarantee that an instrumentable node can be found, e.g. if the language does not support instrumentation.- Since:
- 24.2
- See Also:
-
getTarget
Returns the call target on the stack. Never returnsnull
.See
FrameInstance.getCallNode()
for the relation between callsite and CallTarget.- Since:
- 0.27
-
getFrame
Returns the read-only frame. Returnsnull
if the initialRootNode
that filled in the stack trace did not request frames to be captured by overridingRootNode.isCaptureFramesForTrace(Node)
.- Since:
- 0.31
-
hasBytecodeIndex
public boolean hasBytecodeIndex()Returnstrue
if the stack trace element contains a valid bytecode index, elsefalse
. If this method returnsfalse
thengetBytecodeIndex()
will return a negativeint
value.- Since:
- 24.1
-
getBytecodeIndex
public int getBytecodeIndex()Returns the bytecode index at the time when this frame was created. If no bytecode index was captured then a negativeint
value is returned. When the stack trace element is capturedRootNode.findBytecodeIndex(com.oracle.truffle.api.nodes.Node, com.oracle.truffle.api.frame.Frame)
is invoked to resolve the byte code index returned by this method.- Since:
- 24.1
- See Also:
-
getGuestObject
Returns an interop object representing this TruffleStackTraceElement supporting thehasExecutableName
and potentiallyhasDeclaringMetaObject
andhasSourceLocation
messages.This method must only be called on an interpreter thread with a valid
entered
. The current entered context can be accessed through the language or instrument environment.- Since:
- 20.3
-
toString
-