# HG changeset patch # User Michael Van De Vanter # Date 1428713709 25200 # Node ID 37912559d66205c843aae75eb87f0e89d3244d2b # Parent 0e647427eee4b0baca8d58e5ae7b04a7beb30672 Truffle/Instrumentation: Javadoc work on instrument listener interfaces. diff -r 0e647427eee4 -r 37912559d662 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTInstrumentListener.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTInstrumentListener.java Fri Apr 10 16:58:26 2015 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTInstrumentListener.java Fri Apr 10 17:55:09 2015 -0700 @@ -26,32 +26,50 @@ import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; +import com.oracle.truffle.api.source.*; /** - * A listener of Truffle AST runtime execution events that can collect information, examine the - * execution state at a particular node, and possibly intervene on behalf of an external tool. + * A receiver of Truffle execution events that can act on behalf of an external client. + *

+ * The {@link Probe} argument provides access to the {@link SourceSection} associated with the + * event, as well as any {@link SyntaxTag}s that have been applied at that AST location. + *

+ * This listener is designed for clients that also require access to the AST execution state at the + * time of the event. Clients that do not require access to the AST execution state should use the + * simpler {@link InstrumentListener}. + *

+ * Clients are free, of course, to record additional information in the listener implementation that + * carries additional information about the context and reason for the particular {@link Instrument} + * that is to be created. */ public interface ASTInstrumentListener { /** * Receive notification that an AST node's execute method is about to be called. + *

+ * Synchronous: Truffle execution waits until the call returns. */ void enter(Probe probe, Node node, VirtualFrame vFrame); /** * Receive notification that an AST Node's {@code void}-valued execute method has just returned. + *

+ * Synchronous: Truffle execution waits until the call returns. */ void returnVoid(Probe probe, Node node, VirtualFrame vFrame); /** * Receive notification that an AST Node's execute method has just returned a value (boxed if * primitive). + *

+ * Synchronous: Truffle execution waits until the call returns. */ void returnValue(Probe probe, Node node, VirtualFrame vFrame, Object result); /** * Receive notification that an AST Node's execute method has just thrown an exception. + *

+ * Synchronous: Truffle execution waits until the call returns. */ void returnExceptional(Probe probe, Node node, VirtualFrame vFrame, Exception exception); - } diff -r 0e647427eee4 -r 37912559d662 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/InstrumentListener.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/InstrumentListener.java Fri Apr 10 16:58:26 2015 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/InstrumentListener.java Fri Apr 10 17:55:09 2015 -0700 @@ -24,31 +24,51 @@ */ package com.oracle.truffle.api.instrument; +import com.oracle.truffle.api.source.*; + /** - * A listener of Truffle execution events that can collect information on behalf of an external - * tool. Contextual information about the source of the event, if not stored in the implementation - * of the listener, can be obtained via access to the {@link Probe} that generates the event. + * A receiver of Truffle execution events that can act on behalf of an external client. + *

+ * The {@link Probe} instance provides access to the {@link SourceSection} associated with the + * event, as well as any {@link SyntaxTag}s that have been applied at that program's location. + *

+ * This is the simplest kind of listener, suitable for clients that need no other information about + * the program's execution state at the time of the event. Clients that require access to the AST + * execution state should use {@link ASTInstrumentListener}. + *

+ * Clients are free, of course, to record additional information in the listener implementation that + * carries additional information about the context and reason for the particular {@link Instrument} + * that is to be created from the listener. */ public interface InstrumentListener { /** - * Receive notification that an AST node's execute method is about to be called. + * Receive notification that a program location is about to be executed. + *

+ * Synchronous: Truffle execution waits until the call returns. */ void enter(Probe probe); /** - * Receive notification that an AST Node's {@code void}-valued execute method has just returned. + * Receive notification that a program location's {@code void}-valued execution has just + * completed. + *

+ * Synchronous: Truffle execution waits until the call returns. */ void returnVoid(Probe probe); /** - * Receive notification that an AST Node's execute method has just returned a value (boxed if - * primitive). + * Receive notification that a program location's execution has just completed and returned a + * value (boxed if primitive). + *

+ * Synchronous: Truffle execution waits until the call returns. */ void returnValue(Probe probe, Object result); /** - * Receive notification that an AST Node's execute method has just thrown an exception. + * Receive notification that a program location's execution has just thrown an exception. + *

+ * Synchronous: Truffle execution waits until the call returns. */ void returnExceptional(Probe probe, Exception exception); } diff -r 0e647427eee4 -r 37912559d662 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/InstrumentationNode.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/InstrumentationNode.java Fri Apr 10 16:58:26 2015 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/InstrumentationNode.java Fri Apr 10 17:55:09 2015 -0700 @@ -28,8 +28,9 @@ import com.oracle.truffle.api.nodes.*; /** - * A marker interface for Truffle {@linkplain Node nodes} that support Instrumentation and - * are should not be part of any Guest Language execution semantics. + * A marker interface for Truffle {@linkplain Node nodes} that internally implement the + * Instrumentation Framework. Such nodes should not be part of any Guest Language execution + * semantics, and should in general not be visible to ordinary Instrumentation clients. */ public interface InstrumentationNode { @@ -39,7 +40,8 @@ String instrumentationInfo(); /** - * Events at a Truffle node that get propagated through the Instrumentation Framework. + * Events that propagate through the {@linkplain InstrumentationNode implementation nodes} of + * the Instrumentation Framework, not visible in this form to Instrumentation clients. */ interface TruffleEvents { @@ -62,6 +64,5 @@ * An AST Node's execute method has just thrown an exception. */ void returnExceptional(Node node, VirtualFrame vFrame, Exception exception); - } }