Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrument.java @ 20909:f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Mon, 13 Apr 2015 15:33:45 -0700 |
parents | f166d264af9f |
children | 78a4b44420cf |
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 |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
27 import com.oracle.truffle.api.*; |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
28 import com.oracle.truffle.api.frame.*; |
19825
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:
19652
diff
changeset
|
29 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
|
30 import com.oracle.truffle.api.nodes.*; |
19825
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:
19652
diff
changeset
|
31 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
|
32 |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
33 // TODO (mlvdv) these statics should not be global. Move them to some kind of context. |
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
34 // TODO (mlvdv) migrate factory into .impl (together with Probe)? break out nested classes? |
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
35 |
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
|
36 /** |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
37 * A <em>binding</em> between: |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
38 * <ol> |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
39 * <li>A {@link Probe}: a source of <em>execution events</em> taking place at a program location in |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
40 * an executing Truffle AST, and</li> |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
41 * <li>A <em>listener</em>: a consumer of execution events on behalf of an external client. |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
42 * </ol> |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
43 * <p> |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
44 * Client-oriented documentation for the use of Instruments is available online at <a |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
45 * HREF="https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events" |
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
46 * >https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events</a> |
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
|
47 * <p> |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
48 * The implementation of Instruments is complicated by the requirement that Truffle be able to clone |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
49 * ASTs at any time. In particular, any instrumentation-supporting Nodes that have been attached to |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
50 * an AST must be cloned along with the AST: AST clones are not permitted to share Nodes. |
19825
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:
19652
diff
changeset
|
51 * <p> |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
52 * AST cloning is intended to be as <em>transparent</em> as possible to clients. This is encouraged |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
53 * by providing the {@link SimpleInstrumentListener} for clients that need know nothing more than |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
54 * the properties associated with a Probe: it's {@link SourceSection} and any associated instances |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
55 * of {@link SyntaxTag}. |
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
|
56 * <p> |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
57 * AST cloning is <em>not transparent</em> to clients that use the |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
58 * {@link StandardInstrumentListener}, since those event methods identify the concrete Node instance |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
59 * (and thus the AST instance) where the event takes place. |
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
|
60 * <p> |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
61 * <h4>Implementation Notes: the Life Cycle of an {@link Instrument} at a {@link Probe}</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
|
62 * <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
|
63 * <ul> |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
64 * <li>A new Instrument is created in permanent association with a client-provided |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
65 * <em>listener.</em></li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
66 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
67 * <li>Multiple Instruments may share a single listener.</li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
68 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
69 * <li>An Instrument does nothing until it is {@linkplain Probe#attach(Instrument) attached} to a |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
70 * Probe, at which time the Instrument begins routing execution events from the Probe's AST location |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
71 * to the Instrument's listener.</li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
72 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
73 * <li>Neither Instruments nor Probes are {@link Node}s.</li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
74 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
75 * <li>A Probe has a single source-based location in an AST, but manages a separate |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
76 * <em>instrumentation chain</em> of Nodes at the equivalent location in each clone of the AST.</li> |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
77 * <li>When a probed AST is cloned, the instrumentation chain associated with each Probe is cloned |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
78 * along with the rest of the AST.</li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
79 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
80 * <li>When a new Instrument (for example an instance of {@link SimpleInstrument} is attached to a |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
81 * Probe, the Instrument inserts a new instance of its private Node type, |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
82 * {@link SimpleInstrument.SimpleInstrumentNode}, into <em>each of the instrument chains</em> |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
83 * managed by the Probe, i.e. one node instance per existing clone of the AST.</li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
84 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
85 * <li>If an Instrument is attached to a Probe in an AST that subsequently gets cloned, then the |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
86 * Instrument's private Node type will be cloned along with the rest of the the AST.</li> |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
87 * <li>Each Instrument's private Node type is a dynamic inner class whose only state is in the |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
88 * shared (outer) Instrument instance; that state includes a reference to the Instrument's 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
|
89 * </li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
90 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
91 * <li>When an Instrument that has been attached to a Probe is {@linkplain #dispose() disposed}, the |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
92 * Instrument searches every instrument chain associated with the Probe and removes the instance of |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
93 * its private Node type.</li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
94 * |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
95 * <li>Attaching and disposing an Instrument at a Probe <em>deoptimizes</em> any compilations of the |
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
96 * AST.</li> |
20908
f166d264af9f
Truflfe/Instrumentaion: migrate client-oriented notes on Probes to a newly written documentation page at https://wiki.openjdk.java.net/display/Graal/Finding+Probes. Replace Probe's Javadoc with implementation notes oriented to implementors.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20900
diff
changeset
|
97 * |
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
|
98 * </ul> |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
99 * |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
100 * @see Probe |
19825
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:
19652
diff
changeset
|
101 * @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
|
102 */ |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
103 public abstract class Instrument { |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
104 |
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
|
105 /** |
19247
128586040207
Truffle/Instrumentation: TruffleEventReceiver renamed to TruffleEventListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
18985
diff
changeset
|
106 * 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
|
107 * |
19825
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:
19652
diff
changeset
|
108 * @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:
19652
diff
changeset
|
109 * @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
|
110 * @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
|
111 */ |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
112 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:
20888
diff
changeset
|
113 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
|
114 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
115 |
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
|
116 /** |
19825
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:
19652
diff
changeset
|
117 * 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:
19652
diff
changeset
|
118 * 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:
19652
diff
changeset
|
119 * |
20894
129a09815063
Truffle/Instrumentation: eclipseformat
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20893
diff
changeset
|
120 * @param standardListener a listener for event generated by the instrument that provides access |
129a09815063
Truffle/Instrumentation: eclipseformat
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20893
diff
changeset
|
121 * to internal execution state |
19825
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:
19652
diff
changeset
|
122 * @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:
19652
diff
changeset
|
123 * @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
|
124 */ |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
125 public static Instrument create(StandardInstrumentListener standardListener, String instrumentInfo) { |
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
126 return new StandardInstrument(standardListener, instrumentInfo); |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
127 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
128 |
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:
19825
diff
changeset
|
129 /** |
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:
19825
diff
changeset
|
130 * Creates an instrument that, when executed the first time in any particular AST location, |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
131 * invites the tool to provide an AST fragment for <em>splicing</em> directly into the running |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
132 * AST. |
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:
19825
diff
changeset
|
133 * |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
134 * @param spliceListener a callback to the client that requests an AST node to be splice. |
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:
19825
diff
changeset
|
135 * @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:
19825
diff
changeset
|
136 * 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:
19825
diff
changeset
|
137 * @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:
19825
diff
changeset
|
138 */ |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
139 public static Instrument create(SpliceInstrumentListener spliceListener, String instrumentInfo) { |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
140 return new SpliceInstrument(spliceListener, instrumentInfo); |
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:
19825
diff
changeset
|
141 } |
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:
19825
diff
changeset
|
142 |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
143 // 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
|
144 /** |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
145 * 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
|
146 */ |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
147 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:
19521
diff
changeset
|
148 return new TruffleOptInstrument(listener, null); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
149 } |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
150 |
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
|
151 /** |
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 * 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
|
153 */ |
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
|
154 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
|
155 |
19825
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:
19652
diff
changeset
|
156 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
|
157 |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
158 /** |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
159 * Optional documentation, mainly for debugging. |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
160 */ |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
161 private final String instrumentInfo; |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
162 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
163 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
|
164 this.instrumentInfo = instrumentInfo; |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
165 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
166 |
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
|
167 /** |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
168 * Removes this instrument from the probe to which it attached and renders the instrument inert. |
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 * |
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
|
170 * @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
|
171 */ |
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
|
172 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
|
173 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
|
174 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
|
175 } |
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
|
176 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
|
177 // 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
|
178 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
|
179 } |
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 this.isDisposed = true; |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
181 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
182 |
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
|
183 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
|
184 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
|
185 } |
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
|
186 |
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
|
187 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
|
188 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
|
189 } |
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
|
190 |
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
|
191 /** |
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
|
192 * 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
|
193 */ |
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
|
194 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
|
195 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
|
196 } |
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
|
197 |
19825
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:
19652
diff
changeset
|
198 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
|
199 |
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
|
200 /** |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
201 * Removes this instrument from an instrument chain. |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
202 */ |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
203 abstract AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode); |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
204 |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
205 /** |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
206 * 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
|
207 */ |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
208 private static final class SimpleInstrument extends Instrument { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
209 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
210 /** |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
211 * Tool-supplied listener for events. |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
212 */ |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
213 private final SimpleInstrumentListener simpleListener; |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
214 |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
215 private SimpleInstrument(SimpleInstrumentListener simpleListener, String instrumentInfo) { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
216 super(instrumentInfo); |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
217 this.simpleListener = simpleListener; |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
218 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
219 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
220 @Override |
19825
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:
19652
diff
changeset
|
221 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) { |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
222 return new SimpleInstrumentNode(nextNode); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
223 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
224 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
225 @Override |
19825
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:
19652
diff
changeset
|
226 AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode) { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
227 boolean found = false; |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
228 if (instrumentNode != null) { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
229 if (instrumentNode.getInstrument() == this) { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
230 // 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:
19825
diff
changeset
|
231 return instrumentNode.nextInstrumentNode; |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
232 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
233 // Match not at the head of the chain; remove it. |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
234 found = instrumentNode.removeFromChain(SimpleInstrument.this); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
235 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
236 if (!found) { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
237 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:
19521
diff
changeset
|
238 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
239 return instrumentNode; |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
240 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
241 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
242 @NodeInfo(cost = NodeCost.NONE) |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
243 private final class SimpleInstrumentNode extends AbstractInstrumentNode { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
244 |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
245 private SimpleInstrumentNode(AbstractInstrumentNode nextNode) { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
246 super(nextNode); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
247 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
248 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
249 public void enter(Node node, VirtualFrame vFrame) { |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
250 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:
19825
diff
changeset
|
251 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:
19825
diff
changeset
|
252 nextInstrumentNode.enter(node, vFrame); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
253 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
254 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
255 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
256 public void returnVoid(Node node, VirtualFrame vFrame) { |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
257 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:
19825
diff
changeset
|
258 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:
19825
diff
changeset
|
259 nextInstrumentNode.returnVoid(node, vFrame); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
260 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
261 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
262 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
263 public void returnValue(Node node, VirtualFrame vFrame, Object result) { |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
264 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:
19825
diff
changeset
|
265 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:
19825
diff
changeset
|
266 nextInstrumentNode.returnValue(node, vFrame, result); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
267 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
268 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
269 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
270 public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
271 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:
19825
diff
changeset
|
272 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:
19825
diff
changeset
|
273 nextInstrumentNode.returnExceptional(node, vFrame, exception); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
274 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
275 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
276 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
277 public String instrumentationInfo() { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
278 final String info = getInstrumentInfo(); |
20892
73b1844b5b14
Truffle/Instrumentation: rename InstrumentListener to SimpleInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20888
diff
changeset
|
279 return info != null ? info : simpleListener.getClass().getSimpleName(); |
19825
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:
19652
diff
changeset
|
280 } |
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:
19652
diff
changeset
|
281 } |
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:
19652
diff
changeset
|
282 } |
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:
19652
diff
changeset
|
283 |
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:
19652
diff
changeset
|
284 /** |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
285 * An instrument that propagates events to an instance of {@link StandardInstrumentListener}. |
19825
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:
19652
diff
changeset
|
286 */ |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
287 private static final class StandardInstrument extends Instrument { |
19825
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:
19652
diff
changeset
|
288 |
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:
19652
diff
changeset
|
289 /** |
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:
19652
diff
changeset
|
290 * 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:
19652
diff
changeset
|
291 */ |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
292 private final StandardInstrumentListener standardListener; |
19825
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:
19652
diff
changeset
|
293 |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
294 private StandardInstrument(StandardInstrumentListener standardListener, String instrumentInfo) { |
19825
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:
19652
diff
changeset
|
295 super(instrumentInfo); |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
296 this.standardListener = standardListener; |
19825
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:
19652
diff
changeset
|
297 } |
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:
19652
diff
changeset
|
298 |
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:
19652
diff
changeset
|
299 @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:
19652
diff
changeset
|
300 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) { |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
301 return new StandardInstrumentNode(nextNode); |
19825
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:
19652
diff
changeset
|
302 } |
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:
19652
diff
changeset
|
303 |
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:
19652
diff
changeset
|
304 @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:
19652
diff
changeset
|
305 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:
19652
diff
changeset
|
306 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:
19652
diff
changeset
|
307 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:
19652
diff
changeset
|
308 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:
19652
diff
changeset
|
309 // 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:
19825
diff
changeset
|
310 return instrumentNode.nextInstrumentNode; |
19825
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:
19652
diff
changeset
|
311 } |
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:
19652
diff
changeset
|
312 // Match not at the head of the chain; remove it. |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
313 found = instrumentNode.removeFromChain(StandardInstrument.this); |
19825
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:
19652
diff
changeset
|
314 } |
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:
19652
diff
changeset
|
315 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:
19652
diff
changeset
|
316 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:
19652
diff
changeset
|
317 } |
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:
19652
diff
changeset
|
318 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:
19652
diff
changeset
|
319 } |
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:
19652
diff
changeset
|
320 |
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:
19652
diff
changeset
|
321 @NodeInfo(cost = NodeCost.NONE) |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
322 private final class StandardInstrumentNode extends AbstractInstrumentNode { |
19825
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:
19652
diff
changeset
|
323 |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
324 private StandardInstrumentNode(AbstractInstrumentNode nextNode) { |
19825
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:
19652
diff
changeset
|
325 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:
19652
diff
changeset
|
326 } |
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:
19652
diff
changeset
|
327 |
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:
19652
diff
changeset
|
328 public void enter(Node node, VirtualFrame vFrame) { |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
329 standardListener.enter(StandardInstrument.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:
19825
diff
changeset
|
330 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:
19825
diff
changeset
|
331 nextInstrumentNode.enter(node, vFrame); |
19825
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:
19652
diff
changeset
|
332 } |
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:
19652
diff
changeset
|
333 } |
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:
19652
diff
changeset
|
334 |
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:
19652
diff
changeset
|
335 public void returnVoid(Node node, VirtualFrame vFrame) { |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
336 standardListener.returnVoid(StandardInstrument.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:
19825
diff
changeset
|
337 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:
19825
diff
changeset
|
338 nextInstrumentNode.returnVoid(node, vFrame); |
19825
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:
19652
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:
19652
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:
19652
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:
19652
diff
changeset
|
342 public void returnValue(Node node, VirtualFrame vFrame, Object result) { |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
343 standardListener.returnValue(StandardInstrument.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:
19825
diff
changeset
|
344 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:
19825
diff
changeset
|
345 nextInstrumentNode.returnValue(node, vFrame, result); |
19825
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:
19652
diff
changeset
|
346 } |
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:
19652
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:
19652
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:
19652
diff
changeset
|
349 public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
350 standardListener.returnExceptional(StandardInstrument.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:
19825
diff
changeset
|
351 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:
19825
diff
changeset
|
352 nextInstrumentNode.returnExceptional(node, vFrame, exception); |
19825
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:
19652
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:
19652
diff
changeset
|
354 } |
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:
19652
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:
19652
diff
changeset
|
356 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:
19652
diff
changeset
|
357 final String info = getInstrumentInfo(); |
20893
263ab98b3bf0
Truffle/Instrumentation: rename ASTInstrumentListener to StandardInstrumentListener
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20892
diff
changeset
|
358 return info != null ? info : standardListener.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
|
359 } |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
360 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
361 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
362 |
20900
ca13a009e38b
Truffle/Instrumentation: Javadoc on Instrument now includes more thorough notes describing the implementation; client-oriented notes have been rewritten into a documentation page: https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20894
diff
changeset
|
363 // TODO (mlvdv) EXPERIMENTAL- UNDER DEVELOPMENT |
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:
19825
diff
changeset
|
364 /** |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
365 * An instrument that allows clients to "splice" an AST fragment directly into a Probe's |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
366 * <em>instrumentation chain</em>, and thus directly into the executing Truffle AST. |
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:
19825
diff
changeset
|
367 */ |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
368 private static final class SpliceInstrument extends 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:
19825
diff
changeset
|
369 |
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:
19825
diff
changeset
|
370 /** |
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:
19825
diff
changeset
|
371 * 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:
19825
diff
changeset
|
372 */ |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
373 private final SpliceInstrumentListener spliceListener; |
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:
19825
diff
changeset
|
374 |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
375 private SpliceInstrument(SpliceInstrumentListener spliceListener, String instrumentInfo) { |
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:
19825
diff
changeset
|
376 super(instrumentInfo); |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
377 this.spliceListener = spliceListener; |
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:
19825
diff
changeset
|
378 } |
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:
19825
diff
changeset
|
379 |
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:
19825
diff
changeset
|
380 @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:
19825
diff
changeset
|
381 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) { |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
382 return new SpliceInstrumentNode(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:
19825
diff
changeset
|
383 } |
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:
19825
diff
changeset
|
384 |
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:
19825
diff
changeset
|
385 @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:
19825
diff
changeset
|
386 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:
19825
diff
changeset
|
387 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:
19825
diff
changeset
|
388 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:
19825
diff
changeset
|
389 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:
19825
diff
changeset
|
390 // 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:
19825
diff
changeset
|
391 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:
19825
diff
changeset
|
392 } |
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:
19825
diff
changeset
|
393 // Match not at the head of the chain; remove it. |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
394 found = instrumentNode.removeFromChain(SpliceInstrument.this); |
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:
19825
diff
changeset
|
395 } |
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:
19825
diff
changeset
|
396 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:
19825
diff
changeset
|
397 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:
19825
diff
changeset
|
398 } |
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:
19825
diff
changeset
|
399 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:
19825
diff
changeset
|
400 } |
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:
19825
diff
changeset
|
401 |
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:
19825
diff
changeset
|
402 @NodeInfo(cost = NodeCost.NONE) |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
403 private final class SpliceInstrumentNode extends AbstractInstrumentNode { |
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:
19825
diff
changeset
|
404 |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
405 @Child SplicedNode splicedNode; |
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:
19825
diff
changeset
|
406 |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
407 private SpliceInstrumentNode(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:
19825
diff
changeset
|
408 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:
19825
diff
changeset
|
409 } |
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:
19825
diff
changeset
|
410 |
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:
19825
diff
changeset
|
411 public void enter(Node node, VirtualFrame vFrame) { |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
412 if (splicedNode == null) { |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
413 final SplicedNode newSplicedNode = SpliceInstrument.this.spliceListener.getSpliceNode(SpliceInstrument.this.probe); |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
414 if (newSplicedNode != null) { |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
415 splicedNode = newSplicedNode; |
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:
19825
diff
changeset
|
416 adoptChildren(); |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
417 SpliceInstrument.this.probe.invalidateProbeUnchanged(); |
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:
19825
diff
changeset
|
418 } |
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:
19825
diff
changeset
|
419 } |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
420 if (splicedNode != null) { |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
421 splicedNode.enter(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:
19825
diff
changeset
|
422 } |
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:
19825
diff
changeset
|
423 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:
19825
diff
changeset
|
424 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:
19825
diff
changeset
|
425 } |
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:
19825
diff
changeset
|
426 } |
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:
19825
diff
changeset
|
427 |
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:
19825
diff
changeset
|
428 public void returnVoid(Node node, VirtualFrame vFrame) { |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
429 if (splicedNode != null) { |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
430 splicedNode.returnVoid(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:
19825
diff
changeset
|
431 } |
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:
19825
diff
changeset
|
432 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:
19825
diff
changeset
|
433 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:
19825
diff
changeset
|
434 } |
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:
19825
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:
19825
diff
changeset
|
436 |
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:
19825
diff
changeset
|
437 public void returnValue(Node node, VirtualFrame vFrame, Object result) { |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
438 if (splicedNode != null) { |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
439 splicedNode.returnValue(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:
19825
diff
changeset
|
440 } |
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:
19825
diff
changeset
|
441 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:
19825
diff
changeset
|
442 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:
19825
diff
changeset
|
443 } |
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:
19825
diff
changeset
|
444 } |
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:
19825
diff
changeset
|
445 |
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:
19825
diff
changeset
|
446 public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
447 if (splicedNode != null) { |
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
448 splicedNode.returnExceptional(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:
19825
diff
changeset
|
449 } |
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:
19825
diff
changeset
|
450 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:
19825
diff
changeset
|
451 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:
19825
diff
changeset
|
452 } |
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:
19825
diff
changeset
|
453 } |
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:
19825
diff
changeset
|
454 |
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:
19825
diff
changeset
|
455 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:
19825
diff
changeset
|
456 final String info = getInstrumentInfo(); |
20909
f96165ecb6f1
Truffle/Instrumentation: rename the most recently created kind of Instrument, formerly "ToolNodeblahblah...". It is now defined by SpliceInstrumentListener. This listener allows the client to create an instrument that will *splied* a client-supplied AST fragment directly into a Probe's "instrumentation chain", and this directly into the flow of Truffle execution (with full optimization).
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
20908
diff
changeset
|
457 return info != null ? info : spliceListener.getClass().getSimpleName(); |
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:
19825
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:
19825
diff
changeset
|
459 } |
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:
19825
diff
changeset
|
460 } |
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:
19825
diff
changeset
|
461 |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
462 public interface TruffleOptListener { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
463 void notifyIsCompiled(boolean isCompiled); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
464 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
465 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
466 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:
19521
diff
changeset
|
467 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
468 private final TruffleOptListener toolOptListener; |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
469 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
470 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:
19521
diff
changeset
|
471 super(instrumentInfo); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
472 this.toolOptListener = listener; |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
473 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
474 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
475 @Override |
19825
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:
19652
diff
changeset
|
476 AbstractInstrumentNode addToChain(AbstractInstrumentNode nextNode) { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
477 return new TruffleOptInstrumentNode(nextNode); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
478 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
479 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
480 @Override |
19825
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:
19652
diff
changeset
|
481 AbstractInstrumentNode removeFromChain(AbstractInstrumentNode instrumentNode) { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
482 boolean found = false; |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
483 if (instrumentNode != null) { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
484 if (instrumentNode.getInstrument() == this) { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
485 // 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:
19825
diff
changeset
|
486 return instrumentNode.nextInstrumentNode; |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
487 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
488 // 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:
19521
diff
changeset
|
489 found = instrumentNode.removeFromChain(TruffleOptInstrument.this); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
490 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
491 if (!found) { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
492 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:
19521
diff
changeset
|
493 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
494 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
|
495 } |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
496 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
497 @NodeInfo(cost = NodeCost.NONE) |
19825
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:
19652
diff
changeset
|
498 private final class TruffleOptInstrumentNode extends AbstractInstrumentNode { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
499 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
500 private boolean isCompiled; |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
501 |
19825
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:
19652
diff
changeset
|
502 private TruffleOptInstrumentNode(AbstractInstrumentNode nextNode) { |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
503 super(nextNode); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
504 this.isCompiled = CompilerDirectives.inCompiledCode(); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
505 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
506 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
507 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:
19521
diff
changeset
|
508 if (this.isCompiled != CompilerDirectives.inCompiledCode()) { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
509 this.isCompiled = CompilerDirectives.inCompiledCode(); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
510 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:
19521
diff
changeset
|
511 } |
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:
19825
diff
changeset
|
512 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:
19825
diff
changeset
|
513 nextInstrumentNode.enter(node, vFrame); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
514 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
515 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
516 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
517 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:
19825
diff
changeset
|
518 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:
19825
diff
changeset
|
519 nextInstrumentNode.returnVoid(node, vFrame); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
520 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
521 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
522 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
523 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:
19825
diff
changeset
|
524 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:
19825
diff
changeset
|
525 nextInstrumentNode.returnValue(node, vFrame, result); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
526 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
527 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
528 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
529 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:
19825
diff
changeset
|
530 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:
19825
diff
changeset
|
531 nextInstrumentNode.returnExceptional(node, vFrame, exception); |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
532 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
533 } |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
534 |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
535 public String instrumentationInfo() { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
536 final String info = getInstrumentInfo(); |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
537 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:
19521
diff
changeset
|
538 } |
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
|
539 } |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
540 } |
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
541 |
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
|
542 @NodeInfo(cost = NodeCost.NONE) |
19825
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:
19652
diff
changeset
|
543 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
|
544 |
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:
19825
diff
changeset
|
545 @Child protected AbstractInstrumentNode nextInstrumentNode; |
19825
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:
19652
diff
changeset
|
546 |
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:
19652
diff
changeset
|
547 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:
19825
diff
changeset
|
548 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
|
549 } |
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
|
550 |
18985
867058575979
Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
18485
diff
changeset
|
551 @Override |
867058575979
Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
18485
diff
changeset
|
552 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
|
553 return false; |
867058575979
Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
18485
diff
changeset
|
554 } |
867058575979
Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
18485
diff
changeset
|
555 |
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
|
556 /** |
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
|
557 * 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
|
558 */ |
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 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
|
560 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
|
561 } |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
562 |
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
|
563 /** |
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
|
564 * 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
|
565 * 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
|
566 * 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
|
567 * 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
|
568 * 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
|
569 */ |
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
|
570 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
|
571 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:
19825
diff
changeset
|
572 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
|
573 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
|
574 } |
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:
19825
diff
changeset
|
575 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
|
576 // 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:
19825
diff
changeset
|
577 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
|
578 // 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:
19825
diff
changeset
|
579 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
|
580 } 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
|
581 // 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:
19825
diff
changeset
|
582 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
|
583 } |
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
|
584 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
|
585 } |
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:
19825
diff
changeset
|
586 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
|
587 } |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
588 |
19652
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
589 protected String getInstrumentInfo() { |
10a1fc5e3209
Truffle/Instrumentation: new, experimental kind of Instrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
19521
diff
changeset
|
590 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
|
591 } |
15450
be0c151d912b
Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15279
diff
changeset
|
592 } |
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
|
593 } |