Interface ExecuteTracingSupport
public interface ExecuteTracingSupport
Allows tracing of calls to
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
isTracingEnabled() returns true.
Example:
abstract static class BaseNode extends Node implements ExecuteTracingSupport {
static final TruffleLogger 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 abstract Object execute(int arg0, Object arg1);
@Specialization
int doInt(int a, int b) {
return a + b;
}
}
- Since:
- 21.3
-
Method Summary
Modifier and TypeMethodDescriptionbooleanInvoked by the generated code to determine whether tracing is enabled.default voidtraceOnEnter(Object[] arguments) Invoked by the generatedexecutemethods before anySpecializationis called, but after allNodeChildrenare evaluated.default voidInvoked by the generatedexecutemethods when aSpecializationthrows an exception.default voidtraceOnReturn(Object returnValue) Invoked by the generatedexecutemethods when aSpecializationreturns normally.
-
Method Details
-
isTracingEnabled
boolean isTracingEnabled()Invoked by the generated code to determine whether tracing is enabled. If tracing is disabled, no other methods in this interface will be invoked.- Returns:
trueif tracing is enabled- Since:
- 21.3
-
traceOnEnter
Invoked by the generatedexecutemethods before anySpecializationis called, but after allNodeChildrenare evaluated. Called only ifisTracingEnabled()returnstrue.- Parameters:
arguments- the arguments of the specialization except the frame, if any- Since:
- 21.3
-
traceOnReturn
Invoked by the generatedexecutemethods when aSpecializationreturns normally. Called only ifisTracingEnabled()returnstrue.- Parameters:
returnValue- the value returned by the specialization ornullif theexecutemethod is declared to returnvoid- Since:
- 21.3
-
traceOnException
Invoked by the generatedexecutemethods when aSpecializationthrows an exception. Called only ifisTracingEnabled()returnstrue. Exceptions thrown by child node invocations are not traced by the parent.- Parameters:
t- the exception thrown by the specialization- Since:
- 21.3
-