Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/ProbeManager.java @ 17078:c4b1cf38002b
Truffle: TruffleCompilationExceptionsAreThrown option to get OptimizationFailedException on compiler error.
author | Chris Seaton <chris.seaton@oracle.com> |
---|---|
date | Tue, 09 Sep 2014 20:19:23 +0100 |
parents | 3ad18f453679 |
children | c88ab4f1f04a |
rev | line source |
---|---|
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:
diff
changeset
|
1 /* |
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:
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
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:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
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:
diff
changeset
|
4 * |
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:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
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:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
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:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
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:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
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:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
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:
diff
changeset
|
10 * |
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:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
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:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
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:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
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:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
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:
diff
changeset
|
15 * accompanied this code). |
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:
diff
changeset
|
16 * |
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:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
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:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
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:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
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:
diff
changeset
|
20 * |
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:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
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:
diff
changeset
|
23 * questions. |
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:
diff
changeset
|
24 */ |
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:
diff
changeset
|
25 package com.oracle.truffle.api.instrument.impl; |
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:
diff
changeset
|
26 |
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:
diff
changeset
|
27 import java.util.*; |
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:
diff
changeset
|
28 |
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:
diff
changeset
|
29 import com.oracle.truffle.api.instrument.*; |
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:
diff
changeset
|
30 import com.oracle.truffle.api.instrument.impl.InstrumentationNode.ProbeCallback; |
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:
diff
changeset
|
31 import com.oracle.truffle.api.instrument.impl.InstrumentationNode.ProbeImpl; |
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:
diff
changeset
|
32 import com.oracle.truffle.api.source.*; |
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:
diff
changeset
|
33 |
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:
diff
changeset
|
34 /** |
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:
diff
changeset
|
35 * Factory and services for AST {@link Probe}s |
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:
diff
changeset
|
36 */ |
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:
diff
changeset
|
37 public final class ProbeManager { |
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:
diff
changeset
|
38 |
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:
diff
changeset
|
39 private final List<ProbeListener> probeListeners = new ArrayList<>(); |
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:
diff
changeset
|
40 |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
41 private final List<ProbeImpl> allProbes = new ArrayList<>(); |
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
42 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
43 /** |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
44 * Called when a {@link #tagTrap} is activated in a Probe. |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
45 */ |
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:
diff
changeset
|
46 private final ProbeCallback probeCallback; |
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:
diff
changeset
|
47 |
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:
diff
changeset
|
48 /** |
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:
diff
changeset
|
49 * When non-null, "enter" events with matching tags will trigger a callback. |
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:
diff
changeset
|
50 */ |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
51 private SyntaxTagTrap tagTrap = null; |
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:
diff
changeset
|
52 |
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:
diff
changeset
|
53 public ProbeManager() { |
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:
diff
changeset
|
54 this.probeCallback = new ProbeCallback() { |
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:
diff
changeset
|
55 /** |
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:
diff
changeset
|
56 * Receives (from the {@link Probe} implementation) and distributes notification that a |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
57 * {@link Probe} has acquired a new {@linkplain SyntaxTag tag}. |
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:
diff
changeset
|
58 */ |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
59 public void newTagAdded(ProbeImpl probe, SyntaxTag tag) { |
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:
diff
changeset
|
60 for (ProbeListener listener : probeListeners) { |
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:
diff
changeset
|
61 listener.probeTaggedAs(probe, tag); |
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:
diff
changeset
|
62 } |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
63 if (tagTrap != null && tag == tagTrap.getTag()) { |
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
64 probe.setTrap(tagTrap); |
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:
diff
changeset
|
65 } |
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:
diff
changeset
|
66 } |
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:
diff
changeset
|
67 }; |
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:
diff
changeset
|
68 } |
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:
diff
changeset
|
69 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
70 /** |
16873
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
71 * Adds a {@link ProbeListener} to receive events. |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
72 */ |
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:
diff
changeset
|
73 public void addProbeListener(ProbeListener listener) { |
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:
diff
changeset
|
74 assert listener != null; |
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:
diff
changeset
|
75 probeListeners.add(listener); |
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:
diff
changeset
|
76 } |
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:
diff
changeset
|
77 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
78 /** |
16873
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
79 * Removes a {@link ProbeListener}. Ignored if listener not found. |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
80 */ |
15944
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
81 public void removeProbeListener(ProbeListener removeListener) { |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
82 final List<ProbeListener> listeners = new ArrayList<>(probeListeners); |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
83 for (ProbeListener listener : listeners) { |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
84 if (listener == removeListener) { |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
85 probeListeners.remove(listener); |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
86 } |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
87 } |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
88 } |
eedf6c293639
Truffle: additional methods on ExecutionContext
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
15779
diff
changeset
|
89 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
90 /** |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
91 * Creates a new {@link Probe} associated with a {@link SourceSection} of code corresponding to |
16873
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
92 * a Truffle AST node. |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
93 */ |
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
94 public Probe createProbe(SourceSection source) { |
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
95 assert source != null; |
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:
diff
changeset
|
96 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
97 ProbeImpl probe = InstrumentationNode.createProbe(source, probeCallback); |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
98 allProbes.add(probe); |
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:
diff
changeset
|
99 |
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:
diff
changeset
|
100 for (ProbeListener listener : probeListeners) { |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
101 listener.newProbeInserted(source, probe); |
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:
diff
changeset
|
102 } |
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:
diff
changeset
|
103 |
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:
diff
changeset
|
104 return probe; |
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:
diff
changeset
|
105 } |
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:
diff
changeset
|
106 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
107 /** |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
108 * Returns the subset of all {@link Probe}s holding a particular {@link SyntaxTag}, or the whole |
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
109 * collection if the specified tag is {@code null}. |
16859
1051d6e4b61b
truffle api: update comments
Bernhard Urban <bernhard.urban@jku.at>
parents:
16857
diff
changeset
|
110 * |
16873
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
111 * @return A collection of probes containing the given tag. |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
112 */ |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
113 public Collection<Probe> findProbesTaggedAs(SyntaxTag tag) { |
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:
diff
changeset
|
114 final List<Probe> probes = new ArrayList<>(); |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
115 for (Probe probe : allProbes) { |
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:
diff
changeset
|
116 if (tag == null || probe.isTaggedAs(tag)) { |
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:
diff
changeset
|
117 probes.add(probe); |
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:
diff
changeset
|
118 } |
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:
diff
changeset
|
119 } |
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:
diff
changeset
|
120 return probes; |
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:
diff
changeset
|
121 } |
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:
diff
changeset
|
122 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
123 /** |
16873
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
124 * Sets the current "tag trap", which will cause a callback to be triggered whenever execution |
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
125 * reaches a Probe (existing or subsequently created) with the specified tag. There can only be |
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
126 * one tag trap set at a time. |
3ad18f453679
Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16859
diff
changeset
|
127 * <p> |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
128 * |
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
129 * @param tagTrap The {@link SyntaxTagTrap} to set. |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
130 * @throws IllegalStateException if a trap is currently set. |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
131 */ |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
132 public void setTagTrap(SyntaxTagTrap tagTrap) throws IllegalStateException { |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
133 assert tagTrap != null; |
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
134 if (this.tagTrap != null) { |
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:
diff
changeset
|
135 throw new IllegalStateException("trap already set"); |
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:
diff
changeset
|
136 } |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
137 this.tagTrap = tagTrap; |
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:
diff
changeset
|
138 |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
139 SyntaxTag tag = tagTrap.getTag(); |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
140 for (ProbeImpl probe : allProbes) { |
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:
diff
changeset
|
141 if (probe.isTaggedAs(tag)) { |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
142 probe.setTrap(tagTrap); |
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:
diff
changeset
|
143 } |
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:
diff
changeset
|
144 } |
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:
diff
changeset
|
145 } |
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:
diff
changeset
|
146 |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
147 /** |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
148 * Clears the current {@link SyntaxTagTrap}. |
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
149 * |
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
150 * @throws IllegalStateException if no trap is currently set. |
16856
7833417c8172
Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents:
16391
diff
changeset
|
151 */ |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
152 public void clearTagTrap() { |
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
153 if (this.tagTrap == null) { |
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:
diff
changeset
|
154 throw new IllegalStateException("no trap set"); |
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:
diff
changeset
|
155 } |
16857
7bfbad29d331
Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16856
diff
changeset
|
156 for (ProbeImpl probe : allProbes) { |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
157 if (probe.isTaggedAs(tagTrap.getTag())) { |
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:
diff
changeset
|
158 probe.setTrap(null); |
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:
diff
changeset
|
159 } |
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:
diff
changeset
|
160 } |
16391
50d79ad439f1
Truffle/Instrumentation: rename PhylumTag to SyntaxTag (along with related classes/methods)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
16181
diff
changeset
|
161 tagTrap = null; |
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:
diff
changeset
|
162 } |
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:
diff
changeset
|
163 |
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:
diff
changeset
|
164 } |