# HG changeset patch # User Michael Van De Vanter # Date 1443057974 25200 # Node ID c1c9c6d79f40b4b31a5bbe553c7622ead35a76aa # Parent bc3be6efa1ccfc22a235e1edd50cc8e19d5598a7 Truffle/Instrumentation: remove method Instrumenter.isInstrumentable() diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java --- 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 instrumentable, this method returns an + * {@linkplain Node AST node} that: *
    *
  1. implements {@link WrapperNode};
  2. *
  3. has the node argument as it's child; and
  4. diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTProber.java --- 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); diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrumenter.java --- 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}. - *

    - * Note: 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. *

    @@ -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); } diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ProbeFailure.java --- 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\""), diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/WrapperNode.java --- 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. *

    * The implementation must be GL-specific. A wrapper decorates a GL AST node (the wrapper's * child) by acting as a transparent proxy with respect to the GL's execution diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/package-info.java --- 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. *

  5. 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}.
  6. + * {@linkplain com.oracle.truffle.api.nodes.Node Nodes} where supported by specific language implementations. *
  7. The relationship between a * {@linkplain com.oracle.truffle.api.instrument.Probe Probe} and * a source code location persists across Truffle cloning of ASTs, which is to say, a single diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/CoverageTracker.java --- 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 @@ *
      *
    • "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)};
    • - *
    • Execution calls are tabulated only at instrumented nodes, i.e. those for which - * {@link Instrumenter#isInstrumentable(Node)}{@code == true};
    • + *
    • Execution calls are tabulated only at nodes where the guest languages supports + * {@linkplain Instrumenter#probe(Node) probing}.
    • *
    • Execution calls are tabulated only at nodes present in the AST when originally created; * dynamically added nodes will not be instrumented.
    • *
    diff -r bc3be6efa1cc -r c1c9c6d79f40 truffle/com.oracle.truffle.tools/src/com/oracle/truffle/tools/NodeExecCounter.java --- 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 @@ *
  8. "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)};
  9. *
  10. Execution calls are tabulated only at instrumented nodes, i.e. those for which - * {@linkplain Instrumenter#isInstrumentable(Node) isInstrumentable() == true};
  11. + * {@linkplain Instrumenter#probe(Node) probing} is supported; *
  12. Execution calls are tabulated only at nodes present in the AST when originally created; * dynamically added nodes will not be instrumented.
  13. * @@ -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; }