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 extendsNode
implementsExecuteTracingSupport
{ static finalTruffleLogger
LOGGER =TruffleLogger
.getLogger("id", "trace"); @Override
public boolean isTracingEnabled() { return LOGGER.isLoggable(Level
.INFO); } @Override
public void traceOnEnter(Object
[] arguments) { // called before any execute method } @Override
public void traceOnReturn(Object
returnValue) { // called after any execute method if it returns normally } @Override
public void traceOnException(Throwable
t) { // called after any execute method which throws an exception } } abstract static class Operation1Node extends BaseNode { // any execute call would automatically be traced public abstractObject
execute(int arg0,Object
arg1); @Specialization
int 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 void
default 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