annotate truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrument.java @ 22548:6b76a24fffbd default tip

Use all variables: a, b, u,v and x, y
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 14 Jan 2016 14:20:57 +0100
parents 145f995cd2fe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
1 /*
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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.
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
4 *
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
10 *
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
15 * accompanied this code).
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
16 *
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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,
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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.
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
20 *
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
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
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
23 * questions.
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
24 */
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
25 package com.oracle.truffle.api.instrument;
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
26
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
27 /**
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
28 * A <em>binding</em> between:
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
29 * <ol>
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
30 * <li>Some source of <em>execution events</em> in an executing Truffle AST, and</li>
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
31 * <li>A <em>listener</em>: a consumer of execution events on behalf of an external client.
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
32 * </ol>
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
33 * <p>
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
34 * Client-oriented documentation for the use of Instruments is available online at <a
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
35 * HREF="https://wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events" >https://
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
36 * wiki.openjdk.java.net/display/Graal/Listening+for+Execution+Events</a>
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
37 *
22262
0df2f06977fa Truffle/Instrumentation: the new Instrument class is now public; minor Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22256
diff changeset
38 * @see Instrumenter
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
39 */
22262
0df2f06977fa Truffle/Instrumentation: the new Instrument class is now public; minor Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22256
diff changeset
40 public abstract class Instrument {
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
41
22293
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
42 /** Optional string for debugging. */
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
43 private final String instrumentInfo;
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
44
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
45 private boolean isDisposed = false;
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
46
22297
145f995cd2fe Truffle/Instrumentation: some minor access cleanups
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
47 Instrument(String instrumentInfo) {
22293
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
48 this.instrumentInfo = instrumentInfo;
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
49 }
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
50
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
51 /**
22293
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
52 * Detaches this from its source of execution events and makes itself unusable.
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
53 *
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
54 * @throws IllegalStateException if this has already been disposed
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
55 */
22293
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
56 public void dispose() throws IllegalStateException {
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
57 if (isDisposed) {
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
58 throw new IllegalStateException("Istruments only dispose once");
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
59 }
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
60 innerDispose();
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
61 this.isDisposed = true;
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
62 }
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
63
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
64 /**
22293
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
65 * Has this been detached from its source of execution events?
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
66 */
22293
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
67 public boolean isDisposed() {
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
68 return isDisposed;
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
69 }
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
70
22297
145f995cd2fe Truffle/Instrumentation: some minor access cleanups
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
71 public final String getInstrumentInfo() {
22293
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
72 return instrumentInfo;
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
73 }
260e3cdf11ec Truffle/Instrumentation: replace (non-functional) AdvancedInstrument kind with new EvalInstrument
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22266
diff changeset
74
22297
145f995cd2fe Truffle/Instrumentation: some minor access cleanups
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
75 abstract void innerDispose();
22256
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
76
75e5db92973a TruffleInstrumentation: fold the "TagTrap" mechanism into the general framework of Instruments, Listeners, and management via Instrumenter.attach() methods.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
77 }