public final class TruffleStackTrace extends Exception
Throwable passes through a
call target. ControlFlowException and PolyglotException do not
get a TruffleStackTrace. Other Throwable are added a TruffleStackTrace, as long as there
is a null cause available to insert the TruffleStackTrace.
A guest language stack trace element is automatically added by the Truffle runtime every time the
Throwable passes through a call target. This is incremental and
therefore efficient if the exception is later caught in the same compilation unit.
Note that if the Throwable is caught, its stack trace should be filled eagerly with
TruffleStackTrace.fillIn(Throwable), unless it can be guaranteed to be re-thrown in the same
call target, or that the stack trace will not be used.
| Modifier and Type | Method and Description |
|---|---|
static TruffleStackTrace |
fillIn(Throwable throwable)
Fills in the guest language stack frames from the current frames on the stack.
|
Throwable |
fillInStackTrace() |
static List<TruffleStackTraceElement> |
getStackTrace(Throwable throwable)
Returns the guest language frames that are stored in this throwable or
null if
no guest language frames can ever be stored in this throwable. |
String |
toString() |
addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTracepublic Throwable fillInStackTrace()
fillInStackTrace in class Throwablepublic static List<TruffleStackTraceElement> getStackTrace(Throwable throwable)
null if
no guest language frames can ever be stored in this throwable. This method fills in the
stacktrace by calling TruffleStackTrace.fillIn(Throwable), so it is not necessary to call
TruffleStackTrace.fillIn(Throwable) before. The returned list is not modifiable. The number of stack
trace elements that are filled in can be customized by implementing
TruffleException.getStackTraceElementLimit().throwable - the throwable instance to look for guest language framespublic static TruffleStackTrace fillIn(Throwable throwable)
cause
chain of the exception. The number stack trace elements that are filled in can be customized
by implementing TruffleException.getStackTraceElementLimit().throwable - the Throwable to fill