changeset 22247:c1c9c6d79f40

Truffle/Instrumentation: remove method Instrumenter.isInstrumentable()
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Wed, 23 Sep 2015 18:26:14 -0700
parents bc3be6efa1cc
children 6d328e688339
files truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTProber.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrumenter.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ProbeFailure.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/WrapperNode.java truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/package-info.java truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/NodeExecCounter.java
diffstat 8 files changed, 16 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java	Wed Sep 23 18:26:14 2015 -0700
@@ -206,8 +206,8 @@
     protected abstract boolean isInstrumentable(Node node);
 
     /**
-     * For nodes in this language that are {@linkplain #isInstrumentable() instrumentable}, this
-     * method returns an {@linkplain Node AST node} that:
+     * For nodes in this language that are <em>instrumentable</em>, this method returns an
+     * {@linkplain Node AST node} that:
      * <ol>
      * <li>implements {@link WrapperNode};</li>
      * <li>has the node argument as it's child; and</li>
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTProber.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTProber.java	Wed Sep 23 18:26:14 2015 -0700
@@ -37,8 +37,7 @@
 
     /**
      * Walk the AST starting at a node and enable instrumentation at selected nodes by attaching
-     * {@linkplain Probe Probes} to them. Ignore {@linkplain Instrumenter#isInstrumentable(Node)
-     * non-instrumentable} nodes.
+     * {@linkplain Probe Probes} to them.
      */
     void probeAST(Instrumenter instrumenter, Node node);
 
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrumenter.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrumenter.java	Wed Sep 23 18:26:14 2015 -0700
@@ -272,17 +272,6 @@
     }
 
     /**
-     * Returns {@code true} if the AST node can be "instrumented" by {@linkplain #probe(Node)
-     * Probing}.
-     * <p>
-     * <b>Note:</b> instrumentation requires a appropriate {@linkplain #createWrapperNode(Node)
-     * WrapperNode}.
-     */
-    public boolean isInstrumentable(Node node) {
-        return ACCESSOR.isInstrumentable(vm, node);
-    }
-
-    /**
      * Prepares an AST node for {@linkplain Instrument instrumentation}, where the node is presumed
      * to be part of a well-formed Truffle AST that has not yet been executed.
      * <p>
@@ -324,7 +313,7 @@
             return wrapper.getProbe();
         }
 
-        if (!isInstrumentable(node)) {
+        if (!ACCESSOR.isInstrumentable(vm, node)) {
             throw new ProbeException(ProbeFailure.Reason.NOT_INSTRUMENTABLE, parent, node, null);
         }
 
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ProbeFailure.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ProbeFailure.java	Wed Sep 23 18:26:14 2015 -0700
@@ -46,7 +46,7 @@
         WRAPPER_NODE("The node to be probed is a wrapper"),
 
         /**
-         * The node to be probed returned {@link Node#isInstrumentable()}{@code == false}.
+         * The node to be probed does not support instrumentation.
          */
         NOT_INSTRUMENTABLE("The node to be project is \"not instrumentable\""),
 
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/WrapperNode.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/WrapperNode.java	Wed Sep 23 18:26:14 2015 -0700
@@ -24,13 +24,11 @@
  */
 package com.oracle.truffle.api.instrument;
 
-import com.oracle.truffle.api.TruffleLanguage;
 import com.oracle.truffle.api.nodes.Node;
 
 /**
  * A {@link Node} instance that must be inserted into a Truffle AST in order to enable
- * {@linkplain Instrument instrumentation} at a particular Guest Language (GL) node. Implementations
- * must ensure that {@link TruffleLanguage#isInstrumentable(Node)} returns {@code false}.
+ * {@linkplain Instrument instrumentation} at a particular Guest Language (GL) node.
  * <p>
  * The implementation must be GL-specific. A wrapper <em>decorates</em> a GL AST node (the wrapper's
  * <em>child</em>) by acting as a transparent <em>proxy</em> with respect to the GL's execution
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/package-info.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/package-info.java	Wed Sep 23 18:26:14 2015 -0700
@@ -60,9 +60,7 @@
  * {@linkplain com.oracle.truffle.api.instrument.Probe Probe} that is permanently associated with a
  * particular segment of source code, e.g. a "statement", that corresponds to an AST location.</li>
  * <li>Probing is only supported at
- * {@linkplain com.oracle.truffle.api.nodes.Node Nodes} that are implemented to be
- * {@linkplain com.oracle.truffle.api.instrument.Instrumenter#isInstrumentable(com.oracle.truffle.api.nodes.Node)
- * instrumentable}.</li>
+ * {@linkplain com.oracle.truffle.api.nodes.Node Nodes} where supported by specific language implementations.</li>
  * <li>The relationship between a
  * {@linkplain com.oracle.truffle.api.instrument.Probe Probe} and
  * a source code location persists across Truffle <em>cloning</em> of ASTs, which is to say, a single
--- a/truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java	Wed Sep 23 18:26:14 2015 -0700
@@ -63,8 +63,8 @@
  * <ul>
  * <li>"Execution call" on a node is is defined as invocation of a node method that is instrumented
  * to produce the event {@link SimpleInstrumentListener#onEnter(Probe)};</li>
- * <li>Execution calls are tabulated only at <em>instrumented</em> nodes, i.e. those for which
- * {@link Instrumenter#isInstrumentable(Node)}{@code == true};</li>
+ * <li>Execution calls are tabulated only at nodes where the guest languages supports
+ * {@linkplain Instrumenter#probe(Node) probing}.</li>
  * <li>Execution calls are tabulated only at nodes present in the AST when originally created;
  * dynamically added nodes will not be instrumented.</li>
  * </ul>
--- a/truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/NodeExecCounter.java	Wed Sep 23 17:24:59 2015 -0700
+++ b/truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/NodeExecCounter.java	Wed Sep 23 18:26:14 2015 -0700
@@ -67,7 +67,7 @@
  * <li>"Execution call" on a node is is defined as invocation of a node method that is instrumented
  * to produce the event {@link StandardInstrumentListener#onEnter(Probe, Node, VirtualFrame)};</li>
  * <li>Execution calls are tabulated only at <em>instrumented</em> nodes, i.e. those for which
- * {@linkplain Instrumenter#isInstrumentable(Node) isInstrumentable() == true};</li>
+ * {@linkplain Instrumenter#probe(Node) probing} is supported;</li>
  * <li>Execution calls are tabulated only at nodes present in the AST when originally created;
  * dynamically added nodes will not be instrumented.</li>
  * </ul>
@@ -297,16 +297,13 @@
             startNode.accept(new NodeVisitor() {
 
                 public boolean visit(Node node) {
-
-                    if (instrumenter.isInstrumentable(node)) {
-                        try {
+                    try {
 
-                            final Probe probe = instrumenter.probe(node);
-                            final Instrument instrument = instrumenter.attach(probe, instrumentListener, "NodeExecCounter");
-                            instruments.add(instrument);
-                        } catch (ProbeException ex) {
-                            failures.add(ex.getFailure());
-                        }
+                        final Probe probe = instrumenter.probe(node);
+                        final Instrument instrument = instrumenter.attach(probe, instrumentListener, "NodeExecCounter");
+                        instruments.add(instrument);
+                    } catch (ProbeException ex) {
+                        failures.add(ex.getFailure());
                     }
                     return true;
                 }