Mercurial > hg > truffle
changeset 20890:263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/InstrumentationPartialEvaluationTest.java Fri Apr 10 21:00:26 2015 -0700 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/InstrumentationPartialEvaluationTest.java Fri Apr 10 21:14:14 2015 -0700 @@ -79,7 +79,7 @@ RootTestNode root = new RootTestNode(fd, "constantValue", result); root.adoptChildren(); Probe probe = result.probe(); - Instrument instrument = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument"); + Instrument instrument = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument"); probe.attach(instrument); assertPartialEvalEquals("constant42", root); } @@ -104,7 +104,7 @@ RootTestNode root = new RootTestNode(fd, "constantValue", result); root.adoptChildren(); Probe probe = result.probe(); - Instrument instrument = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument"); + Instrument instrument = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument"); probe.attach(instrument); instrument.dispose(); assertPartialEvalEquals("constant42", root); @@ -131,9 +131,9 @@ RootTestNode root = new RootTestNode(fd, "constantValue", result); root.adoptChildren(); Probe probe = result.probe(); - Instrument instrument1 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 1"); + Instrument instrument1 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 1"); probe.attach(instrument1); - Instrument instrument2 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 2"); + Instrument instrument2 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 2"); probe.attach(instrument2); assertPartialEvalEquals("constant42", root); } @@ -161,11 +161,11 @@ RootTestNode root = new RootTestNode(fd, "constantValue", result); root.adoptChildren(); Probe probe = result.probe(); - Instrument instrument1 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 1"); + Instrument instrument1 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 1"); probe.attach(instrument1); - Instrument instrument2 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 2"); + Instrument instrument2 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 2"); probe.attach(instrument2); - Instrument instrument3 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 3"); + Instrument instrument3 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 3"); probe.attach(instrument3); assertPartialEvalEquals("constant42", root); } @@ -194,11 +194,11 @@ RootTestNode root = new RootTestNode(fd, "constantValue", result); root.adoptChildren(); Probe probe = result.probe(); - Instrument instrument1 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 1"); + Instrument instrument1 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 1"); probe.attach(instrument1); - Instrument instrument2 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 2"); + Instrument instrument2 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 2"); probe.attach(instrument2); - Instrument instrument3 = Instrument.create(new DefaultASTInstrumentListener(), "Null test Instrument 3"); + Instrument instrument3 = Instrument.create(new DefaultStandardInstrumentListener(), "Null test Instrument 3"); probe.attach(instrument3); instrument2.dispose(); assertPartialEvalEquals("constant42", root);
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTest.java Fri Apr 10 21:00:26 2015 -0700 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTest.java Fri Apr 10 21:14:14 2015 -0700 @@ -180,7 +180,7 @@ checkCounters(probe, callTarget, rootNode, new TestSimpleInstrumentCounter(), new TestSimpleInstrumentCounter(), new TestSimpleInstrumentCounter()); // Now try with the more complex flavor of listener - checkCounters(probe, callTarget, rootNode, new TestASTInstrumentCounter(), new TestASTInstrumentCounter(), new TestASTInstrumentCounter()); + checkCounters(probe, callTarget, rootNode, new TestStandardInstrumentCounter(), new TestStandardInstrumentCounter(), new TestStandardInstrumentCounter()); } private static void checkCounters(Probe probe, CallTarget callTarget, RootNode rootNode, TestCounter counterA, TestCounter counterB, TestCounter counterC) { @@ -405,14 +405,14 @@ /** * A counter for the number of times execution enters and leaves a probed AST node. */ - private class TestASTInstrumentCounter implements TestCounter { + private class TestStandardInstrumentCounter implements TestCounter { public int enterCount = 0; public int leaveCount = 0; public final Instrument instrument; - public TestASTInstrumentCounter() { - this.instrument = Instrument.create(new ASTInstrumentListener() { + public TestStandardInstrumentCounter() { + this.instrument = Instrument.create(new StandardInstrumentListener() { public void enter(Probe probe, Node node, VirtualFrame vFrame) { enterCount++; @@ -498,7 +498,7 @@ /** * Counts the number of "enter" events at probed nodes using the AST listener. */ - static final class TestASTInstrumentListener extends DefaultASTInstrumentListener { + static final class TestASTInstrumentListener extends DefaultStandardInstrumentListener { public int counter = 0;
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTInstrumentListener.java Fri Apr 10 21:00:26 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.truffle.api.instrument; - -import com.oracle.truffle.api.frame.*; -import com.oracle.truffle.api.nodes.*; -import com.oracle.truffle.api.source.*; - -/** - * A receiver of Truffle execution events that can act on behalf of an external client. - * <p> - * 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 node. - * <p> - * 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 - * {@link SimpleInstrumentListener}. - * <p> - * 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 ASTInstrumentListener { - - /** - * Receive notification that an AST node's execute method is about to be called. - * <p> - * <strong>Synchronous</strong>: 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. - * <p> - * <strong>Synchronous</strong>: 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). - * <p> - * <strong>Synchronous</strong>: 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. - * <p> - * <strong>Synchronous</strong>: Truffle execution waits until the call returns. - */ - void returnExceptional(Probe probe, Node node, VirtualFrame vFrame, Exception exception); -}
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrument.java Fri Apr 10 21:00:26 2015 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrument.java Fri Apr 10 21:14:14 2015 -0700 @@ -41,13 +41,13 @@ * and a <em>listener</em>, which consumes notifications on behalf of an external tool. There are at * present two kinds of listeners that be used: * <ol> - * <li>{@link SimpleInstrumentListener} is the simplest and is intended for tools that require no access - * to the <em>internal execution state</em> of the Truffle execution, only that execution has passed - * through a particular location in the program. Information about that location is made available - * via the {@link Probe} argument in notification methods, including the {@linkplain SourceSection - * source location} of the node and any {@linkplain SyntaxTag tags} that have been applied to the - * node.</li> - * <li>{@link ASTInstrumentListener} reports the same events and {@link Probe} argument, but + * <li>{@link SimpleInstrumentListener} is the simplest and is intended for tools that require no + * access to the <em>internal execution state</em> of the Truffle execution, only that execution has + * passed through a particular location in the program. Information about that location is made + * available via the {@link Probe} argument in notification methods, including the + * {@linkplain SourceSection source location} of the node and any {@linkplain SyntaxTag tags} that + * have been applied to the node.</li> + * <li>{@link StandardInstrumentListener} reports the same events and {@link Probe} argument, but * additionally provides access to the execution state via the explicit {@link Node} and * {@link Frame} at the current execution site.</li> * </ol> @@ -58,36 +58,36 @@ * <li>Create an implementation of a <em>listener</em> interface.</li> * <li>Create an Instrument via factory methods * {@link Instrument#create(SimpleInstrumentListener, String)} or - * {@link Instrument#create(ASTInstrumentListener, String)}.</li> + * {@link Instrument#create(StandardInstrumentListener, String)}.</li> * <li>"Attach" the Instrument to a Probe via {@link Probe#attach(Instrument)}, at which point event * notifications begin to arrive at the listener.</li> - * <li>When no longer needed, "detach" the Instrument via {@link ASTInstrument#dispose()}, at which - * point event notifications to the listener cease, and the Instrument becomes unusable.</li> + * <li>When no longer needed, "detach" the Instrument via {@link StandardInstrument#dispose()}, at + * which point event notifications to the listener cease, and the Instrument becomes unusable.</li> * </ol> * <p> * <h4>Options for creating listeners:</h4> * <p> * <ol> * <li>Implement one of the <em>listener interfaces</em>: {@link SimpleInstrumentListener} or - * {@link ASTInstrumentListener} . Their event handling methods account for both the entry into an + * {@link StandardInstrumentListener} . Their event handling methods account for both the entry into an * AST node (about to call) and three possible kinds of <em>execution return</em> from an AST node.</li> * <li>Extend one of the <em>helper implementations</em>: {@link DefaultSimpleInstrumentListener} or - * {@link DefaultASTInstrumentListener}. These provide no-op implementation of every listener + * {@link DefaultStandardInstrumentListener}. These provide no-op implementation of every listener * method, so only the methods of interest need to be overridden.</li> * </ol> * <p> - * <h4>General guidelines for {@link ASTInstrumentListener} implementation:</h4> + * <h4>General guidelines for {@link StandardInstrumentListener} implementation:</h4> * <p> * Unlike the listener interface {@link SimpleInstrumentListener}, which isolates implementations - * completely from Truffle internals (and is thus <em>Truffle-safe</em>), implementations of - * {@link ASTInstrumentListener} can interact directly with (and potentially affect) Truffle + * from Truffle internals (and is thus <em>Truffle-safe</em>), implementations of + * {@link StandardInstrumentListener} can interact directly with (and potentially affect) Truffle * execution in general and Truffle optimization in particular. For example, it is possible to * implement a debugger with this interface. * </p> * <p> - * As a consequence, implementations of {@link ASTInstrumentListener} effectively become part of the - * Truffle execution and must be coded according to general guidelines for Truffle implementations. - * For example: + * As a consequence, implementations of {@link StandardInstrumentListener} effectively become part of + * the Truffle execution and must be coded according to general guidelines for Truffle + * implementations. For example: * <ul> * <li>Do not store {@link Frame} or {@link Node} references in fields.</li> * <li>Prefer {@code final} fields and (where performance is important) short methods.</li> @@ -110,8 +110,8 @@ * <h4>Allowing for AST cloning:</h4> * <p> * Truffle routinely <em>clones</em> ASTs, which has consequences for implementations of - * {@link ASTInstrumentListener} (but not for implementations of {@link SimpleInstrumentListener}, from - * which cloning is hidden). + * {@link StandardInstrumentListener} (but not for implementations of {@link SimpleInstrumentListener}, + * from which cloning is hidden). * <ul> * <li>Even though a {@link Probe} is uniquely associated with a particular location in the * executing Guest Language program, execution events at that location will in general be @@ -122,7 +122,7 @@ * be treated as equivalent for most purposes.</li> * </ul> * <p> - * <h4>Access to execution state via {@link ASTInstrumentListener}:</h4> + * <h4>Access to execution state via {@link StandardInstrumentListener}:</h4> * <p> * <ul> * <li>Notification arguments provide primary access to the GL program's execution states: @@ -181,13 +181,13 @@ * Creates an instrument that will route execution events to a listener, along with access to * internal execution state. * - * @param astListener a listener for event generated by the instrument that provides access to + * @param standardListener a listener for event generated by the instrument that provides access to * internal execution state * @param instrumentInfo optional description of the instrument's role, useful for debugging. * @return a new instrument, ready for attachment at a probe */ - public static Instrument create(ASTInstrumentListener astListener, String instrumentInfo) { - return new ASTInstrument(astListener, instrumentInfo); + public static Instrument create(StandardInstrumentListener standardListener, String instrumentInfo) { + return new StandardInstrument(standardListener, instrumentInfo); } /** @@ -346,23 +346,23 @@ abstract AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode); /** - * An instrument that propagates events to an instance of {@link ASTInstrumentListener}. + * An instrument that propagates events to an instance of {@link StandardInstrumentListener}. */ - private static final class ASTInstrument extends Instrument { + private static final class StandardInstrument extends Instrument { /** * Tool-supplied listener for AST events. */ - private final ASTInstrumentListener astListener; + private final StandardInstrumentListener standardListener; - private ASTInstrument(ASTInstrumentListener astListener, String instrumentInfo) { + private StandardInstrument(StandardInstrumentListener standardListener, String instrumentInfo) { super(instrumentInfo); - this.astListener = astListener; + this.standardListener = standardListener; } @Override AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) { - return new ASTInstrumentNode(nextNode); + return new StandardInstrumentNode(nextNode); } @Override @@ -374,7 +374,7 @@ return instrumentNode.nextInstrumentNode; } // Match not at the head of the chain; remove it. - found = instrumentNode.removeFromChain(ASTInstrument.this); + found = instrumentNode.removeFromChain(StandardInstrument.this); } if (!found) { throw new IllegalStateException("Couldn't find instrument node to remove: " + this); @@ -383,35 +383,35 @@ } @NodeInfo(cost = NodeCost.NONE) - private final class ASTInstrumentNode extends AbstractInstrumentNode { + private final class StandardInstrumentNode extends AbstractInstrumentNode { - private ASTInstrumentNode(AbstractInstrumentNode nextNode) { + private StandardInstrumentNode(AbstractInstrumentNode nextNode) { super(nextNode); } public void enter(Node node, VirtualFrame vFrame) { - ASTInstrument.this.astListener.enter(ASTInstrument.this.probe, node, vFrame); + standardListener.enter(StandardInstrument.this.probe, node, vFrame); if (nextInstrumentNode != null) { nextInstrumentNode.enter(node, vFrame); } } public void returnVoid(Node node, VirtualFrame vFrame) { - ASTInstrument.this.astListener.returnVoid(ASTInstrument.this.probe, node, vFrame); + standardListener.returnVoid(StandardInstrument.this.probe, node, vFrame); if (nextInstrumentNode != null) { nextInstrumentNode.returnVoid(node, vFrame); } } public void returnValue(Node node, VirtualFrame vFrame, Object result) { - ASTInstrument.this.astListener.returnValue(ASTInstrument.this.probe, node, vFrame, result); + standardListener.returnValue(StandardInstrument.this.probe, node, vFrame, result); if (nextInstrumentNode != null) { nextInstrumentNode.returnValue(node, vFrame, result); } } public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { - ASTInstrument.this.astListener.returnExceptional(ASTInstrument.this.probe, node, vFrame, exception); + standardListener.returnExceptional(StandardInstrument.this.probe, node, vFrame, exception); if (nextInstrumentNode != null) { nextInstrumentNode.returnExceptional(node, vFrame, exception); } @@ -419,14 +419,13 @@ public String instrumentationInfo() { final String info = getInstrumentInfo(); - return info != null ? info : astListener.getClass().getSimpleName(); + return info != null ? info : standardListener.getClass().getSimpleName(); } } - } /** - * An instrument that propagates events to an instance of {@link ASTInstrumentListener}. + * An instrument that propagates events to an instance of {@link StandardInstrumentListener}. */ private static final class ToolNodeInstrument extends Instrument { @@ -520,7 +519,6 @@ return info != null ? info : toolNodeListener.getClass().getSimpleName(); } } - } public interface TruffleOptListener { @@ -601,7 +599,6 @@ return info != null ? info : toolOptListener.getClass().getSimpleName(); } } - } @NodeInfo(cost = NodeCost.NONE) @@ -654,7 +651,5 @@ protected String getInstrumentInfo() { return Instrument.this.instrumentInfo; } - } - }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/SimpleInstrumentListener.java Fri Apr 10 21:00:26 2015 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/SimpleInstrumentListener.java Fri Apr 10 21:14:14 2015 -0700 @@ -34,7 +34,7 @@ * <p> * 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}. + * execution state should use {@link StandardInstrumentListener}. * <p> * 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}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/StandardInstrumentListener.java Fri Apr 10 21:14:14 2015 -0700 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.api.instrument; + +import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.api.nodes.*; +import com.oracle.truffle.api.source.*; + +/** + * A receiver of Truffle execution events that can act on behalf of an external client. + * <p> + * 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 node. + * <p> + * 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 + * {@link SimpleInstrumentListener}. + * <p> + * 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 StandardInstrumentListener { + + /** + * Receive notification that an AST node's execute method is about to be called. + * <p> + * <strong>Synchronous</strong>: 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. + * <p> + * <strong>Synchronous</strong>: 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). + * <p> + * <strong>Synchronous</strong>: 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. + * <p> + * <strong>Synchronous</strong>: Truffle execution waits until the call returns. + */ + void returnExceptional(Probe probe, Node node, VirtualFrame vFrame, Exception exception); +}
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/DefaultASTInstrumentListener.java Fri Apr 10 21:00:26 2015 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.truffle.api.instrument.impl; - -import com.oracle.truffle.api.frame.*; -import com.oracle.truffle.api.instrument.*; -import com.oracle.truffle.api.nodes.*; - -/** - * A listener for AST {@linkplain ASTInstrumentListener execution events} that provides a no-op - * implementation of every event. - */ -public class DefaultASTInstrumentListener implements ASTInstrumentListener { - - public void enter(Probe probe, Node node, VirtualFrame vFrame) { - } - - public void returnVoid(Probe probe, Node node, VirtualFrame vFrame) { - } - - public void returnValue(Probe probe, Node node, VirtualFrame vFrame, Object result) { - } - - public void returnExceptional(Probe probe, Node node, VirtualFrame vFrame, Exception exception) { - } - -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/DefaultStandardInstrumentListener.java Fri Apr 10 21:14:14 2015 -0700 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.api.instrument.impl; + +import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.api.instrument.*; +import com.oracle.truffle.api.nodes.*; + +/** + * A listener for AST {@linkplain StandardInstrumentListener execution events} that provides a no-op + * implementation of every event. + */ +public class DefaultStandardInstrumentListener implements StandardInstrumentListener { + + public void enter(Probe probe, Node node, VirtualFrame vFrame) { + } + + public void returnVoid(Probe probe, Node node, VirtualFrame vFrame) { + } + + public void returnValue(Probe probe, Node node, VirtualFrame vFrame, Object result) { + } + + public void returnExceptional(Probe probe, Node node, VirtualFrame vFrame, Exception exception) { + } + +}
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/tools/NodeExecCounter.java Fri Apr 10 21:00:26 2015 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/tools/NodeExecCounter.java Fri Apr 10 21:14:14 2015 -0700 @@ -49,7 +49,7 @@ * <p> * <ul> * <li>"Execution call" on a node is is defined as invocation of a node method that is instrumented - * to produce the event {@link ASTInstrumentListener#enter(Probe, Node, VirtualFrame)};</li> + * to produce the event {@link StandardInstrumentListener#enter(Probe, Node, VirtualFrame)};</li> * <li>Execution calls are tabulated only at <em>instrumented</em> nodes, i.e. those for which * {@linkplain Node#isInstrumentable() isInstrumentable() == true};</li> * <li>Execution calls are tabulated only at nodes present in the AST when originally created; @@ -95,7 +95,7 @@ * Listener for events at instrumented nodes. Counts are maintained in a shared table, so the * listener is stateless and can be shared by every {@link Instrument}. */ - private final ASTInstrumentListener instrumentListener = new DefaultASTInstrumentListener() { + private final StandardInstrumentListener instrumentListener = new DefaultStandardInstrumentListener() { @Override public void enter(Probe probe, Node node, VirtualFrame vFrame) { if (isEnabled()) {