public interface ExecuteTracingSupport
execute methods of a Node.
The methods declared in this interface are invoked by the code generated by Truffle DSL for nodes
which directly or indirectly implement this interface. All tracing methods are called only if
ExecuteTracingSupport.isTracingEnabled() returns true.
Example:
abstract static class BaseNode extendsNodeimplementsExecuteTracingSupport{ static finalTruffleLoggerLOGGER =TruffleLogger.getLogger("id", "trace"); @Overridepublic boolean isTracingEnabled() { return LOGGER.isLoggable(Level.INFO); } @Overridepublic void traceOnEnter(Object[] arguments) { // called before any execute method } @Overridepublic void traceOnReturn(ObjectreturnValue) { // called after any execute method if it returns normally } @Overridepublic void traceOnException(Throwablet) { // called after any execute method which throws an exception } } abstract static class Operation1Node extends BaseNode { // any execute call would automatically be traced public abstractObjectexecute(int arg0,Objectarg1); @Specializationint doInt(int a, int b) { return a + b; } }
| Modifier and Type | Method and Description |
|---|---|
boolean |
isTracingEnabled()
Invoked by the generated code to determine whether tracing is enabled.
|
default void |
traceOnEnter(Object[] arguments)
Invoked by the generated
execute methods before any Specialization is called,
but after all NodeChildren are evaluated. |
default void |
traceOnException(Throwable t)
Invoked by the generated
execute methods when a Specialization throws an
exception. |
default void |
traceOnReturn(Object returnValue)
Invoked by the generated
execute methods when a Specialization returns
normally. |
boolean isTracingEnabled()
true if tracing is enableddefault void traceOnEnter(Object[] arguments)
execute methods before any Specialization is called,
but after all NodeChildren are evaluated. Called only if ExecuteTracingSupport.isTracingEnabled()
returns true.arguments - the arguments of the specialization except the frame, if anydefault void traceOnReturn(Object returnValue)
execute methods when a Specialization returns
normally. Called only if ExecuteTracingSupport.isTracingEnabled() returns true.returnValue - the value returned by the specialization or null if the
execute method is declared to return voiddefault void traceOnException(Throwable t)
execute methods when a Specialization throws an
exception. Called only if ExecuteTracingSupport.isTracingEnabled() returns true. Exceptions thrown
by child node invocations are not traced by the parent.t - the exception thrown by the specialization