annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrument.java @ 20889:73b1844b5b14

Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Fri, 10 Apr 2015 21:00:26 -0700
parents e7ece52e1ff3
children 263ab98b3bf0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
1 /*
18985
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
4 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
10 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
11 * This code is distributed in the hope that it will be useful, but WITHOUT
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
14 * version 2 for more details (a copy is included in the LICENSE file that
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
15 * accompanied this code).
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
16 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License version
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
18 * 2 along with this work; if not, write to the Free Software Foundation,
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
20 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
22 * or visit www.oracle.com if you need additional information or have any
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
23 * questions.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
24 */
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
25 package com.oracle.truffle.api.instrument;
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
26
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
27 import com.oracle.truffle.api.*;
18130
b4e38f4ca414 Truffle: rename @SlowPath to @TruffleBoundary.
Christian Humer <christian.humer@gmail.com>
parents: 15779
diff changeset
28 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
29 import com.oracle.truffle.api.frame.*;
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
30 import com.oracle.truffle.api.instrument.InstrumentationNode.TruffleEvents;
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
31 import com.oracle.truffle.api.instrument.impl.*;
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
32 import com.oracle.truffle.api.nodes.*;
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
33 import com.oracle.truffle.api.source.*;
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
34
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
35 // TODO (mlvdv) migrate some of this to external documentation.
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
36 // TODO (mlvdv) move all this to a factory implemented in .impl (together with Probe),
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
37 // then break out some of the nested classes into package privates.
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
38 /**
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
39 * A dynamically added/removed binding between a {@link Probe}, which provides notification of
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
40 * <em>execution events</em> taking place at a {@link Node} in a Guest Language (GL) Truffle AST,
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
41 * and a <em>listener</em>, which consumes notifications on behalf of an external tool. There are at
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
42 * present two kinds of listeners that be used:
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
43 * <ol>
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
44 * <li>{@link SimpleInstrumentListener} is the simplest and is intended for tools that require no access
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
45 * to the <em>internal execution state</em> of the Truffle execution, only that execution has passed
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
46 * through a particular location in the program. Information about that location is made available
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
47 * via the {@link Probe} argument in notification methods, including the {@linkplain SourceSection
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
48 * source location} of the node and any {@linkplain SyntaxTag tags} that have been applied to the
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
49 * node.</li>
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
50 * <li>{@link ASTInstrumentListener} reports the same events and {@link Probe} argument, but
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
51 * additionally provides access to the execution state via the explicit {@link Node} and
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
52 * {@link Frame} at the current execution site.</li>
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
53 * </ol>
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
54 * <p>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
55 * <h4>Summary: How to "instrument" an AST location:</h4>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
56 * <p>
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
57 * <ol>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
58 * <li>Create an implementation of a <em>listener</em> interface.</li>
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
59 * <li>Create an Instrument via factory methods
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
60 * {@link Instrument#create(SimpleInstrumentListener, String)} or
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
61 * {@link Instrument#create(ASTInstrumentListener, String)}.</li>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
62 * <li>"Attach" the Instrument to a Probe via {@link Probe#attach(Instrument)}, at which point event
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
63 * notifications begin to arrive at the listener.</li>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
64 * <li>When no longer needed, "detach" the Instrument via {@link ASTInstrument#dispose()}, at which
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
65 * point event notifications to the listener cease, and the Instrument becomes unusable.</li>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
66 * </ol>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
67 * <p>
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
68 * <h4>Options for creating listeners:</h4>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
69 * <p>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
70 * <ol>
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
71 * <li>Implement one of the <em>listener interfaces</em>: {@link SimpleInstrumentListener} or
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
72 * {@link ASTInstrumentListener} . Their event handling methods account for both the entry into an
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
73 * AST node (about to call) and three possible kinds of <em>execution return</em> from an AST node.</li>
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
74 * <li>Extend one of the <em>helper implementations</em>: {@link DefaultSimpleInstrumentListener} or
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
75 * {@link DefaultASTInstrumentListener}. These provide no-op implementation of every listener
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
76 * method, so only the methods of interest need to be overridden.</li>
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
77 * </ol>
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
78 * <p>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
79 * <h4>General guidelines for {@link ASTInstrumentListener} implementation:</h4>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
80 * <p>
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
81 * Unlike the listener interface {@link SimpleInstrumentListener}, which isolates implementations
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
82 * completely from Truffle internals (and is thus <em>Truffle-safe</em>), implementations of
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
83 * {@link ASTInstrumentListener} can interact directly with (and potentially affect) Truffle
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
84 * execution in general and Truffle optimization in particular. For example, it is possible to
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
85 * implement a debugger with this interface.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
86 * </p>
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
87 * <p>
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
88 * As a consequence, implementations of {@link ASTInstrumentListener} effectively become part of the
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
89 * Truffle execution and must be coded according to general guidelines for Truffle implementations.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
90 * For example:
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
91 * <ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
92 * <li>Do not store {@link Frame} or {@link Node} references in fields.</li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
93 * <li>Prefer {@code final} fields and (where performance is important) short methods.</li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
94 * <li>If needed, pass along the {@link VirtualFrame} reference from an event notification as far as
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
95 * possible through code that is expected to be inlined, since this incurs no runtime overhead. When
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
96 * access to frame data is needed, substitute a more expensive {@linkplain Frame#materialize()
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
97 * materialized} representation of the frame.</li>
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
98 * <li>If a listener calls back to its tool during event handling, and if performance is an issue,
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
99 * then this should be through a final "callback" field in the instrument, and the called methods
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
100 * should be minimal.</li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
101 * <li>On the other hand, implementations should prevent Truffle from inlining beyond a reasonable
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
102 * point with the method annotation {@link TruffleBoundary}.</li>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
103 * <li>The implicit "outer" pointer in a non-static inner class is a useful (and
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
104 * Truffle-optimizable) way to implement callbacks to owner tools.</li>
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
105 * <li>Primitive-valued return events are boxed for event notification, but Truffle will eliminate
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
106 * the boxing if they are cast back to their primitive values quickly (in particular before crossing
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
107 * any {@link TruffleBoundary} annotations).
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
108 * </ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
109 * <p>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
110 * <h4>Allowing for AST cloning:</h4>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
111 * <p>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
112 * Truffle routinely <em>clones</em> ASTs, which has consequences for implementations of
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
113 * {@link ASTInstrumentListener} (but not for implementations of {@link SimpleInstrumentListener}, from
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
114 * which cloning is hidden).
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
115 * <ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
116 * <li>Even though a {@link Probe} is uniquely associated with a particular location in the
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
117 * executing Guest Language program, execution events at that location will in general be
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
118 * implemented by different {@link Node} instances, i.e. <em>clones</em> of the originally probed
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
119 * node.</li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
120 * <li>Because of <em>cloning</em> the {@link Node} supplied with notifications to a particular
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
121 * listener will vary, but because they all represent the same GL program location the events should
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
122 * be treated as equivalent for most purposes.</li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
123 * </ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
124 * <p>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
125 * <h4>Access to execution state via {@link ASTInstrumentListener}:</h4>
15779
8c34e2cc4add Truffle/Instrumentation: significant reorganization of the instrumentation framework's implementation and connection to the runtime ExecutionContext, with some new features, including a Tag-based "trap" mechanisms.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15605
diff changeset
126 * <p>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
127 * <ul>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
128 * <li>Notification arguments provide primary access to the GL program's execution states:
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
129 * <ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
130 * <li>{@link Node}: the concrete node (in one of the AST's clones) from which the event originated.
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
131 * </li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
132 * <li>{@link VirtualFrame}: the current execution frame.
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
133 * </ul>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
134 * <li>Truffle global information is available, for example the execution
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
135 * {@linkplain TruffleRuntime#iterateFrames(FrameInstanceVisitor) stack}.</li>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
136 * <li>Additional API access to execution state may be added in the future.</li>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
137 * </ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
138 * <p>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
139 * <h4>Activating and deactivating Instruments:</h4>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
140 * <p>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
141 * Instruments are <em>single-use</em>:
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
142 * <ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
143 * <li>An instrument becomes active only when <em>attached</em> to a Probe via
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
144 * {@link Probe#attach(Instrument)}, and it may only be attached to a single Probe. It is a runtime
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
145 * error to attempt attaching a previously attached instrument.</li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
146 * <li>Attaching an instrument modifies every existing clone of the AST to which it is being
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
147 * attached, which can trigger deoptimization.</li>
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
148 * <li>The method {@link Instrument#dispose()} makes an instrument inactive by removing it from the
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
149 * Probe to which it was attached and rendering it permanently inert.</li>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
150 * <li>Disposal removes the implementation of an instrument from all ASTs to which it was attached,
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
151 * which can trigger deoptimization.</li>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
152 * </ul>
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
153 * <p>
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
154 * <h4>Sharing listeners:</h4>
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
155 * <p>
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
156 * Although an Instrument may only be attached to a single Probe, a listener can be shared among
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
157 * multiple Instruments. This can be useful for observing events that might happen at different
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
158 * locations in a single AST, for example all assignments to a particular variable. In this case a
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
159 * new Instrument would be created and attached at each assignment node, but all the Instruments
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
160 * would be created with the same listener.
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
161 * <p>
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
162 * <strong>Disclaimer:</strong> experimental; under development.
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
163 *
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
164 * @see Probe
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
165 * @see TruffleEvents
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
166 */
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
167 public abstract class Instrument {
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
168
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
169 /**
19247
128586040207 Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18985
diff changeset
170 * Creates an instrument that will route execution events to a listener.
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
171 *
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
172 * @param listener a minimal listener for event generated by the instrument.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
173 * @param instrumentInfo optional description of the instrument's role, useful for debugging.
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
174 * @return a new instrument, ready for attachment at a probe
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
175 */
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
176 public static Instrument create(SimpleInstrumentListener listener, String instrumentInfo) {
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
177 return new SimpleInstrument(listener, instrumentInfo);
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
178 }
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
179
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
180 /**
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
181 * Creates an instrument that will route execution events to a listener, along with access to
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
182 * internal execution state.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
183 *
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
184 * @param astListener a listener for event generated by the instrument that provides access to
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
185 * internal execution state
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
186 * @param instrumentInfo optional description of the instrument's role, useful for debugging.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
187 * @return a new instrument, ready for attachment at a probe
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
188 */
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
189 public static Instrument create(ASTInstrumentListener astListener, String instrumentInfo) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
190 return new ASTInstrument(astListener, instrumentInfo);
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
191 }
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
192
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
193 /**
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
194 * Creates an instrument that, when executed the first time in any particular AST location,
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
195 * invites the tool to provide an AST fragment for attachment/adoption into the running AST.
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
196 *
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
197 * @param toolNodeListener a listener for the tool that can request an AST fragment
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
198 * @param instrumentInfo instrumentInfo optional description of the instrument's role, useful
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
199 * for debugging.
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
200 * @return a new instrument, ready for attachment at a probe.
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
201 */
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
202 public static Instrument create(ToolNodeInstrumentListener toolNodeListener, String instrumentInfo) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
203 return new ToolNodeInstrument(toolNodeListener, instrumentInfo);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
204 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
205
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
206 // TODO (mlvdv) experimental
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
207 /**
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
208 * For implementation testing.
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
209 */
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
210 public static Instrument create(TruffleOptListener listener) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
211 return new TruffleOptInstrument(listener, null);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
212 }
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
213
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
214 /**
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
215 * Has this instrument been disposed? stays true once set.
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
216 */
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
217 private boolean isDisposed = false;
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
218
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
219 protected Probe probe = null;
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
220
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
221 /**
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
222 * Optional documentation, mainly for debugging.
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
223 */
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
224 private final String instrumentInfo;
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
225
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
226 private Instrument(String instrumentInfo) {
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
227 this.instrumentInfo = instrumentInfo;
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
228 }
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
229
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
230 /**
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
231 * Removes this instrument (and any clones) from the probe to which it attached and renders the
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
232 * instrument inert.
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
233 *
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
234 * @throws IllegalStateException if this instrument has already been disposed
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
235 */
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
236 public void dispose() throws IllegalStateException {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
237 if (isDisposed) {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
238 throw new IllegalStateException("Attempt to dispose an already disposed Instrumennt");
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
239 }
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
240 if (probe != null) {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
241 // It's attached
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
242 probe.disposeInstrument(this);
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
243 }
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
244 this.isDisposed = true;
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
245 }
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
246
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
247 Probe getProbe() {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
248 return probe;
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
249 }
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
250
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
251 void setAttachedTo(Probe probe) {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
252 this.probe = probe;
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
253 }
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
254
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
255 /**
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
256 * Has this instrument been disposed and rendered unusable?
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
257 */
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
258 boolean isDisposed() {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
259 return isDisposed;
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
260 }
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
261
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
262 abstract AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode);
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
263
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
264 /**
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
265 * An instrument that propagates events to an instance of {@link SimpleInstrumentListener}.
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
266 */
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
267 private static final class SimpleInstrument extends Instrument {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
268
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
269 /**
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
270 * Tool-supplied listener for events.
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
271 */
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
272 private final SimpleInstrumentListener simpleListener;
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
273
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
274 private SimpleInstrument(SimpleInstrumentListener simpleListener, String instrumentInfo) {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
275 super(instrumentInfo);
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
276 this.simpleListener = simpleListener;
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
277 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
278
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
279 @Override
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
280 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) {
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
281 return new SimpleInstrumentNode(nextNode);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
282 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
283
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
284 @Override
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
285 AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode) {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
286 boolean found = false;
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
287 if (instrumentNode != null) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
288 if (instrumentNode.getInstrument() == this) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
289 // Found the match at the head of the chain
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
290 return instrumentNode.nextInstrumentNode;
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
291 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
292 // Match not at the head of the chain; remove it.
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
293 found = instrumentNode.removeFromChain(SimpleInstrument.this);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
294 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
295 if (!found) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
296 throw new IllegalStateException("Couldn't find instrument node to remove: " + this);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
297 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
298 return instrumentNode;
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
299 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
300
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
301 @NodeInfo(cost = NodeCost.NONE)
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
302 private final class SimpleInstrumentNode extends AbstractInstrumentNode {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
303
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
304 private SimpleInstrumentNode(AbstractInstrumentNode nextNode) {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
305 super(nextNode);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
306 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
307
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
308 public void enter(Node node, VirtualFrame vFrame) {
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
309 SimpleInstrument.this.simpleListener.enter(SimpleInstrument.this.probe);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
310 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
311 nextInstrumentNode.enter(node, vFrame);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
312 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
313 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
314
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
315 public void returnVoid(Node node, VirtualFrame vFrame) {
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
316 SimpleInstrument.this.simpleListener.returnVoid(SimpleInstrument.this.probe);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
317 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
318 nextInstrumentNode.returnVoid(node, vFrame);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
319 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
320 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
321
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
322 public void returnValue(Node node, VirtualFrame vFrame, Object result) {
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
323 SimpleInstrument.this.simpleListener.returnValue(SimpleInstrument.this.probe, result);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
324 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
325 nextInstrumentNode.returnValue(node, vFrame, result);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
326 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
327 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
328
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
329 public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) {
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
330 SimpleInstrument.this.simpleListener.returnExceptional(SimpleInstrument.this.probe, exception);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
331 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
332 nextInstrumentNode.returnExceptional(node, vFrame, exception);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
333 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
334 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
335
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
336 public String instrumentationInfo() {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
337 final String info = getInstrumentInfo();
20889
73b1844b5b14 Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20885
diff changeset
338 return info != null ? info : simpleListener.getClass().getSimpleName();
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
339 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
340 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
341 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
342
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
343 /**
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
344 * Removes this instrument from an instrument chain.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
345 */
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
346 abstract AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode);
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
347
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
348 /**
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
349 * An instrument that propagates events to an instance of {@link ASTInstrumentListener}.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
350 */
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
351 private static final class ASTInstrument extends Instrument {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
352
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
353 /**
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
354 * Tool-supplied listener for AST events.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
355 */
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
356 private final ASTInstrumentListener astListener;
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
357
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
358 private ASTInstrument(ASTInstrumentListener astListener, String instrumentInfo) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
359 super(instrumentInfo);
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
360 this.astListener = astListener;
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
361 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
362
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
363 @Override
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
364 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
365 return new ASTInstrumentNode(nextNode);
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
366 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
367
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
368 @Override
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
369 AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
370 boolean found = false;
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
371 if (instrumentNode != null) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
372 if (instrumentNode.getInstrument() == this) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
373 // Found the match at the head of the chain
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
374 return instrumentNode.nextInstrumentNode;
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
375 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
376 // Match not at the head of the chain; remove it.
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
377 found = instrumentNode.removeFromChain(ASTInstrument.this);
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
378 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
379 if (!found) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
380 throw new IllegalStateException("Couldn't find instrument node to remove: " + this);
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
381 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
382 return instrumentNode;
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
383 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
384
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
385 @NodeInfo(cost = NodeCost.NONE)
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
386 private final class ASTInstrumentNode extends AbstractInstrumentNode {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
387
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
388 private ASTInstrumentNode(AbstractInstrumentNode nextNode) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
389 super(nextNode);
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
390 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
391
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
392 public void enter(Node node, VirtualFrame vFrame) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
393 ASTInstrument.this.astListener.enter(ASTInstrument.this.probe, node, vFrame);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
394 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
395 nextInstrumentNode.enter(node, vFrame);
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
396 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
397 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
398
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
399 public void returnVoid(Node node, VirtualFrame vFrame) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
400 ASTInstrument.this.astListener.returnVoid(ASTInstrument.this.probe, node, vFrame);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
401 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
402 nextInstrumentNode.returnVoid(node, vFrame);
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
403 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
404 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
405
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
406 public void returnValue(Node node, VirtualFrame vFrame, Object result) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
407 ASTInstrument.this.astListener.returnValue(ASTInstrument.this.probe, node, vFrame, result);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
408 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
409 nextInstrumentNode.returnValue(node, vFrame, result);
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
410 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
411 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
412
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
413 public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
414 ASTInstrument.this.astListener.returnExceptional(ASTInstrument.this.probe, node, vFrame, exception);
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
415 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
416 nextInstrumentNode.returnExceptional(node, vFrame, exception);
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
417 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
418 }
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
419
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
420 public String instrumentationInfo() {
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
421 final String info = getInstrumentInfo();
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
422 return info != null ? info : astListener.getClass().getSimpleName();
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
423 }
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
424 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
425
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
426 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
427
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
428 /**
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
429 * An instrument that propagates events to an instance of {@link ASTInstrumentListener}.
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
430 */
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
431 private static final class ToolNodeInstrument extends Instrument {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
432
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
433 /**
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
434 * Tool-supplied listener for AST events.
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
435 */
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
436 private final ToolNodeInstrumentListener toolNodeListener;
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
437
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
438 private ToolNodeInstrument(ToolNodeInstrumentListener toolNodeListener, String instrumentInfo) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
439 super(instrumentInfo);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
440 this.toolNodeListener = toolNodeListener;
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
441 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
442
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
443 @Override
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
444 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
445 return new ToolInstrumentNode(nextNode);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
446 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
447
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
448 @Override
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
449 AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
450 boolean found = false;
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
451 if (instrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
452 if (instrumentNode.getInstrument() == this) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
453 // Found the match at the head of the chain
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
454 return instrumentNode.nextInstrumentNode;
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
455 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
456 // Match not at the head of the chain; remove it.
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
457 found = instrumentNode.removeFromChain(ToolNodeInstrument.this);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
458 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
459 if (!found) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
460 throw new IllegalStateException("Couldn't find instrument node to remove: " + this);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
461 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
462 return instrumentNode;
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
463 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
464
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
465 @NodeInfo(cost = NodeCost.NONE)
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
466 private final class ToolInstrumentNode extends AbstractInstrumentNode {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
467
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
468 @Child ToolNode toolNode;
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
469
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
470 private ToolInstrumentNode(AbstractInstrumentNode nextNode) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
471 super(nextNode);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
472 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
473
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
474 public void enter(Node node, VirtualFrame vFrame) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
475 if (toolNode == null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
476 final ToolNode newToolNode = ToolNodeInstrument.this.toolNodeListener.getToolNode(ToolNodeInstrument.this.probe);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
477 if (newToolNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
478 toolNode = newToolNode;
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
479 adoptChildren();
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
480 ToolNodeInstrument.this.probe.invalidateProbeUnchanged();
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
481 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
482 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
483 if (toolNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
484 toolNode.enter(node, vFrame);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
485 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
486 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
487 nextInstrumentNode.enter(node, vFrame);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
488 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
489 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
490
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
491 public void returnVoid(Node node, VirtualFrame vFrame) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
492 if (toolNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
493 toolNode.returnVoid(node, vFrame);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
494 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
495 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
496 nextInstrumentNode.returnVoid(node, vFrame);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
497 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
498 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
499
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
500 public void returnValue(Node node, VirtualFrame vFrame, Object result) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
501 if (toolNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
502 toolNode.returnValue(node, vFrame, result);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
503 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
504 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
505 nextInstrumentNode.returnValue(node, vFrame, result);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
506 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
507 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
508
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
509 public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
510 if (toolNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
511 toolNode.returnExceptional(node, vFrame, exception);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
512 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
513 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
514 nextInstrumentNode.returnExceptional(node, vFrame, exception);
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
515 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
516 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
517
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
518 public String instrumentationInfo() {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
519 final String info = getInstrumentInfo();
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
520 return info != null ? info : toolNodeListener.getClass().getSimpleName();
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
521 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
522 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
523
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
524 }
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
525
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
526 public interface TruffleOptListener {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
527 void notifyIsCompiled(boolean isCompiled);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
528 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
529
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
530 private static final class TruffleOptInstrument extends Instrument {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
531
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
532 private final TruffleOptListener toolOptListener;
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
533
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
534 private TruffleOptInstrument(TruffleOptListener listener, String instrumentInfo) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
535 super(instrumentInfo);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
536 this.toolOptListener = listener;
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
537 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
538
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
539 @Override
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
540 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
541 return new TruffleOptInstrumentNode(nextNode);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
542 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
543
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
544 @Override
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
545 AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode) {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
546 boolean found = false;
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
547 if (instrumentNode != null) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
548 if (instrumentNode.getInstrument() == this) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
549 // Found the match at the head of the chain
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
550 return instrumentNode.nextInstrumentNode;
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
551 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
552 // Match not at the head of the chain; remove it.
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
553 found = instrumentNode.removeFromChain(TruffleOptInstrument.this);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
554 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
555 if (!found) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
556 throw new IllegalStateException("Couldn't find instrument node to remove: " + this);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
557 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
558 return instrumentNode;
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
559 }
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
560
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
561 @NodeInfo(cost = NodeCost.NONE)
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
562 private final class TruffleOptInstrumentNode extends AbstractInstrumentNode {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
563
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
564 private boolean isCompiled;
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
565
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
566 private TruffleOptInstrumentNode(AbstractInstrumentNode nextNode) {
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
567 super(nextNode);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
568 this.isCompiled = CompilerDirectives.inCompiledCode();
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
569 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
570
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
571 public void enter(Node node, VirtualFrame vFrame) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
572 if (this.isCompiled != CompilerDirectives.inCompiledCode()) {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
573 this.isCompiled = CompilerDirectives.inCompiledCode();
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
574 TruffleOptInstrument.this.toolOptListener.notifyIsCompiled(this.isCompiled);
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
575 }
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
576 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
577 nextInstrumentNode.enter(node, vFrame);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
578 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
579 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
580
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
581 public void returnVoid(Node node, VirtualFrame vFrame) {
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
582 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
583 nextInstrumentNode.returnVoid(node, vFrame);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
584 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
585 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
586
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
587 public void returnValue(Node node, VirtualFrame vFrame, Object result) {
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
588 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
589 nextInstrumentNode.returnValue(node, vFrame, result);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
590 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
591 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
592
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
593 public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) {
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
594 if (nextInstrumentNode != null) {
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
595 nextInstrumentNode.returnExceptional(node, vFrame, exception);
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
596 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
597 }
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
598
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
599 public String instrumentationInfo() {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
600 final String info = getInstrumentInfo();
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
601 return info != null ? info : toolOptListener.getClass().getSimpleName();
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
602 }
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
603 }
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
604
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
605 }
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
606
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
607 @NodeInfo(cost = NodeCost.NONE)
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
608 abstract class AbstractInstrumentNode extends Node implements TruffleEvents, InstrumentationNode {
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
609
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
610 @Child protected AbstractInstrumentNode nextInstrumentNode;
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
611
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19645
diff changeset
612 protected AbstractInstrumentNode(AbstractInstrumentNode nextNode) {
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
613 this.nextInstrumentNode = nextNode;
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
614 }
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
615
18985
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
616 @Override
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
617 public boolean isInstrumentable() {
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
618 return false;
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
619 }
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
620
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
621 /**
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
622 * Gets the instrument that created this node.
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
623 */
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
624 private Instrument getInstrument() {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
625 return Instrument.this;
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
626 }
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
627
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
628 /**
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
629 * Removes the node from this chain that was added by a particular instrument, assuming that
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
630 * the head of the chain is not the one to be replaced. This is awkward, but is required
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
631 * because {@link Node#replace(Node)} won't take a {@code null} argument. This doesn't work
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
632 * for the tail of the list, which would be replacing itself with null. So the replacement
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
633 * must be directed the parent of the node being removed.
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
634 */
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
635 private boolean removeFromChain(Instrument instrument) {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
636 assert getInstrument() != instrument;
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
637 if (nextInstrumentNode == null) {
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
638 return false;
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
639 }
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
640 if (nextInstrumentNode.getInstrument() == instrument) {
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
641 // Next is the one to remove
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
642 if (nextInstrumentNode.nextInstrumentNode == null) {
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
643 // Next is at the tail; just forget
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
644 nextInstrumentNode = null;
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
645 } else {
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
646 // Replace next with its successor
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
647 nextInstrumentNode.replace(nextInstrumentNode.nextInstrumentNode);
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
648 }
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
649 return true;
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
650 }
20106
2e3cc2a27711 Truffle/Instrumentation: a new flavor of Instrument that lazily provides an AST fragment to be attached/adopted directly into a running AST, and to which execution event notifications will be routed. Important use cases so far include conditional breakpoints (with optimizeable conditions) and Ruby set_trace_func.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
651 return nextInstrumentNode.removeFromChain(instrument);
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
652 }
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
653
19645
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
654 protected String getInstrumentInfo() {
10a1fc5e3209 Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19518
diff changeset
655 return Instrument.this.instrumentInfo;
18485
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18131
diff changeset
656 }
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
657
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
658 }
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
659
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
660 }