diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/AdvancedInstrumentRootFactory.java @ 21354:575032310b2c

Truffle/Instrumentation: runtime failures executing an AdvancedInstrument root are now reported automatically via a new mehtod onAdvancedInstrumentResultListener.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 12 May 2015 14:48:33 -0700
parents 876e710523c5
children 442b57a7f208
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/AdvancedInstrumentRootFactory.java	Tue May 12 12:57:47 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/AdvancedInstrumentRootFactory.java	Tue May 12 14:48:33 2015 -0700
@@ -34,7 +34,9 @@
  * @see Instrument
  * @see AdvancedInstrumentRoot
  */
-public interface AdvancedInstrumentRootFactory {
+public abstract class AdvancedInstrumentRootFactory {
+
+    private final AdvancedInstrumentResultListener resultListener;
 
     /**
      * Provider of {@linkplain AdvancedInstrumentRoot AST fragment} instances for efficient
@@ -47,5 +49,17 @@
      * @return a newly created AST fragment suitable for execution, via instrumentation, in the
      *         execution context of the specified guest-language AST site.
      */
-    AdvancedInstrumentRoot createInstrumentRoot(Probe probe, Node node);
+    public abstract AdvancedInstrumentRoot createInstrumentRoot(Probe probe, Node node);
+
+    /**
+     * Gets the listener, if one was specified, to notify with the result of executing every
+     * {@link AdvancedInstrumentRoot} created by this factory.
+     */
+    public final AdvancedInstrumentResultListener resultListener() {
+        return resultListener;
+    }
+
+    protected AdvancedInstrumentRootFactory(AdvancedInstrumentResultListener resultListener) {
+        this.resultListener = resultListener;
+    }
 }