annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Probe.java @ 21685:fd8a92655fbd

Truffle/Instrumentation: improve Probe trace output for builtins
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 02 Jun 2015 17:11:48 -0700
parents c072fbce5756
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
1 /*
18985
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
4 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
10 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
11 * This code is distributed in the hope that it will be useful, but WITHOUT
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
14 * version 2 for more details (a copy is included in the LICENSE file that
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
15 * accompanied this code).
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
16 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License version
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
18 * 2 along with this work; if not, write to the Free Software Foundation,
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
20 *
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
22 * or visit www.oracle.com if you need additional information or have any
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
23 * questions.
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
24 */
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
25 package com.oracle.truffle.api.instrument;
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
26
21684
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
27 import java.io.*;
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: 18338
diff changeset
28 import java.lang.ref.*;
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: 18338
diff changeset
29 import java.util.*;
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: 18338
diff changeset
30
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: 18338
diff changeset
31 import com.oracle.truffle.api.*;
19488
2f676c3ca430 Truffle/Instrumentation: fix some optimization bugs; instrumentation PE tests now succeed after recent compiler work
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19247
diff changeset
32 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
19818
907128d02b31 Truffle/Instrumentation: For clients of Instrumentation, replace the TruffleEventListener interface with two: InstrumentListener, and ASTInstrumentListener. The former is simple, completely Truffle-safe (can't affect Truffle execution), and designed for simple tools. The latter is similar to the previous interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19696
diff changeset
33 import com.oracle.truffle.api.instrument.InstrumentationNode.TruffleEvents;
18338
c4f374adce13 Probe interface should extend NodeInterface
Andreas Woess <andreas.woess@jku.at>
parents: 16857
diff changeset
34 import com.oracle.truffle.api.nodes.*;
16067
915ebb306fcc Truffle/Source: major API revision
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15779
diff changeset
35 import com.oracle.truffle.api.source.*;
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: 18338
diff changeset
36 import com.oracle.truffle.api.utilities.*;
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
37
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: 20105
diff changeset
38 //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: 20105
diff changeset
39
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
40 /**
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: 20105
diff changeset
41 * A <em>binding</em> between:
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: 20105
diff changeset
42 * <ol>
21130
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
43 * <li>A program location in an executing Truffle AST (corresponding to a {@link SourceSection}),
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
44 * and</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: 20105
diff changeset
45 * <li>A dynamically managed collection of "attached" {@linkplain Instrument Instruments} that
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: 20105
diff changeset
46 * receive event notifications on behalf of external clients.</li>
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: 20105
diff changeset
47 * </ol>
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
48 * <p>
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: 20105
diff changeset
49 * Client-oriented documentation for the use of Probes is available online at <a
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: 20105
diff changeset
50 * HREF="https://wiki.openjdk.java.net/display/Graal/Finding+Probes"
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: 20105
diff changeset
51 * >https://wiki.openjdk.java.net/display/Graal/Finding+Probes</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: 18338
diff changeset
52 * <p>
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: 20105
diff changeset
53 * <h4>Implementation notes:</h4>
15279
0c6d8a08e31b Truffle: Major cleanup and extension of the Truffle Instrumentation framework in com.oracle.truffle.api
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
54 * <p>
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: 20105
diff changeset
55 * <ul>
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: 20105
diff changeset
56 * <li>A Probe must be permanently associated with a <em>program location</em>, defined by a
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: 20105
diff changeset
57 * particular {@link SourceSection}, even though:
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: 20105
diff changeset
58 * <ul>
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: 20105
diff changeset
59 * <li>that location is represented in an AST as a {@link Node}, which might be replaced through
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: 20105
diff changeset
60 * optimizations such as specialization, and</li>
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: 20105
diff changeset
61 * <li>Truffle may <em>clone</em> the AST so that the location is actually represented by multiple
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: 20105
diff changeset
62 * Nodes in multiple ASTs.</li>
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: 20105
diff changeset
63 * </ul>
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: 20105
diff changeset
64 * </li>
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: 20105
diff changeset
65 *
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: 20105
diff changeset
66 * <li>The effect of the binding is to intercept {@linkplain TruffleEvents execution events}
20961
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
67 * arriving at the "probed" AST Node and notify each attached {@link Instrument} before execution is
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: 20105
diff changeset
68 * allowed to proceed to the child and again after execution completes.</li>
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: 20105
diff changeset
69 *
20961
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
70 * <li>The method {@link Node#probe()} creates a Probe on an AST Node; redundant calls return the
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
71 * same Probe.</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: 20105
diff changeset
72 *
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: 20105
diff changeset
73 * <li>The "probing" of a Truffle AST must be done after the AST is complete (i.e. parent pointers
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: 20105
diff changeset
74 * correctly assigned), but before any cloning or executions. This is done by creating an instance
20961
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
75 * of {@link ASTProber} and registering it via {@link #registerASTProber(ASTProber)}. Once
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
76 * registered, it will be applied automatically to every newly created 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: 20105
diff changeset
77 *
20961
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
78 * <li>The "probing" of an AST Node is implemented by insertion of a {@link ProbeNode.WrapperNode}
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
79 * into the AST (as new parent of the Node being probed), together with an associated
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
80 * {@link ProbeNode} that routes execution events at the probed Node to all the
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
81 * {@linkplain Instrument Instruments} attached to the Probe's <em>instrument chain</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: 20105
diff changeset
82 *
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: 20105
diff changeset
83 * <li>When Truffle clones an AST, any attached WrapperNodes and ProbeNodes are cloned as well,
20961
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
84 * together with their attached instrument chains. Each Probe instance intercepts cloning events and
21298b90a6bf Truffle/Instrumentation: Javadoc cleanup
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20908
diff changeset
85 * keeps track of all AST copies.</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: 20105
diff changeset
86 *
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: 20105
diff changeset
87 * <li>All attached {@link InstrumentationNode}s effectively become part of the running program:
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: 20105
diff changeset
88 * <ul>
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: 20105
diff changeset
89 * <li>Good News: instrumentation code implicitly benefits from every kind of Truffle optimization.</li>
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: 20105
diff changeset
90 * <li>Bad News: instrumentation code must be implemented carefully to avoid interfering with any
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: 20105
diff changeset
91 * Truffle optimizations.</li>
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: 20105
diff changeset
92 * </ul>
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: 20105
diff changeset
93 * </li>
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: 20105
diff changeset
94 *
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: 20105
diff changeset
95 * </ul>
15605
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
96 *
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
97 * @see 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: 18338
diff changeset
98 * @see ASTProber
18985
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
99 * @see ProbeListener
19696
27fe86a6fb49 Truffle/Instrumentation: Javadoc
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19517
diff changeset
100 * @see SyntaxTag
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
101 */
21130
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
102 public final class 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: 18338
diff changeset
103
21684
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
104 private static final boolean TRACE = false;
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
105 private static final String TRACE_PREFIX = "PROBE: ";
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
106 private static final PrintStream OUT = System.out;
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
107
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
108 private static void trace(String format, Object... args) {
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
109 if (TRACE) {
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
110 OUT.println(TRACE_PREFIX + String.format(format, args));
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
111 }
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
112 }
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
113
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: 18338
diff changeset
114 private static final List<ASTProber> astProbers = new ArrayList<>();
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: 18338
diff changeset
115
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: 18338
diff changeset
116 private static final List<ProbeListener> probeListeners = new ArrayList<>();
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: 18338
diff changeset
117
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: 18338
diff changeset
118 /**
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: 18338
diff changeset
119 * All Probes that have been created.
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: 18338
diff changeset
120 */
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: 18338
diff changeset
121 private static final List<WeakReference<Probe>> probes = new ArrayList<>();
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: 18338
diff changeset
122
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
123 /**
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
124 * A global trap that triggers notification just before executing any Node that is Probed with a
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
125 * matching tag.
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
126 */
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
127 @CompilationFinal private static SyntaxTagTrap beforeTagTrap = null;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
128
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
129 /**
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
130 * A global trap that triggers notification just after executing any Node that is Probed with a
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
131 * matching tag.
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
132 */
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
133 @CompilationFinal private static SyntaxTagTrap afterTagTrap = null;
19491
4d66c000d253 Truffle/Instrumentation: more cleanup in Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19490
diff changeset
134
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: 18338
diff changeset
135 private static final class FindSourceVisitor implements NodeVisitor {
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: 18338
diff changeset
136
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: 18338
diff changeset
137 Source source = 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: 18338
diff changeset
138
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: 18338
diff changeset
139 public boolean visit(Node 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: 18338
diff changeset
140 final SourceSection sourceSection = node.getSourceSection();
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: 18338
diff changeset
141 if (sourceSection != 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: 18338
diff changeset
142 source = sourceSection.getSource();
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: 18338
diff changeset
143 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: 18338
diff changeset
144 }
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: 18338
diff changeset
145 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: 18338
diff changeset
146 }
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: 18338
diff changeset
147 }
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: 18338
diff changeset
148
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: 18338
diff changeset
149 /**
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: 18338
diff changeset
150 * Walks an AST, looking for the first node with an assigned {@link SourceSection} and returning
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: 18338
diff changeset
151 * the {@link Source}.
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: 18338
diff changeset
152 */
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: 18338
diff changeset
153 private static Source findSource(Node 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: 18338
diff changeset
154 final FindSourceVisitor visitor = new FindSourceVisitor();
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: 18338
diff changeset
155 node.accept(visitor);
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: 18338
diff changeset
156 return visitor.source;
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: 18338
diff changeset
157 }
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: 18338
diff changeset
158
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: 18338
diff changeset
159 /**
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: 18338
diff changeset
160 * Enables instrumentation at selected nodes in all subsequently constructed ASTs.
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: 18338
diff changeset
161 */
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: 18338
diff changeset
162 public static void registerASTProber(ASTProber prober) {
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: 18338
diff changeset
163 astProbers.add(prober);
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: 18338
diff changeset
164 }
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: 18338
diff changeset
165
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: 18338
diff changeset
166 public static void unregisterASTProber(ASTProber prober) {
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: 18338
diff changeset
167 astProbers.remove(prober);
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: 18338
diff changeset
168 }
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: 18338
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: 18338
diff changeset
170 /**
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: 18338
diff changeset
171 * Enables instrumentation in a newly created AST by applying all registered instances of
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: 18338
diff changeset
172 * {@link ASTProber}.
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: 18338
diff changeset
173 */
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: 18338
diff changeset
174 public static void applyASTProbers(Node 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: 18338
diff changeset
175
21685
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
176 String name = "<?>";
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: 18338
diff changeset
177 final Source source = findSource(node);
21685
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
178 if (source != null) {
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
179 name = source.getShortName();
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
180 } else {
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
181 final SourceSection sourceSection = node.getEncapsulatingSourceSection();
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
182 if (sourceSection != null) {
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
183 name = sourceSection.getShortDescription();
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
184 }
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
185 }
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
186 trace("START %s", name);
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: 18338
diff changeset
187 for (ProbeListener listener : probeListeners) {
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: 18338
diff changeset
188 listener.startASTProbing(source);
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: 18338
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: 18338
diff changeset
190 for (ASTProber prober : astProbers) {
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: 18338
diff changeset
191 prober.probeAST(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: 18338
diff changeset
192 }
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: 18338
diff changeset
193 for (ProbeListener listener : probeListeners) {
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: 18338
diff changeset
194 listener.endASTProbing(source);
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: 18338
diff changeset
195 }
21685
fd8a92655fbd Truffle/Instrumentation: improve Probe trace output for builtins
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21684
diff changeset
196 trace("FINISHED %s", name);
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: 18338
diff changeset
197 }
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: 18338
diff changeset
198
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: 18338
diff changeset
199 /**
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: 18338
diff changeset
200 * Adds a {@link ProbeListener} to receive events.
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: 18338
diff changeset
201 */
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: 18338
diff changeset
202 public static void addProbeListener(ProbeListener listener) {
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: 18338
diff changeset
203 assert listener != 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: 18338
diff changeset
204 probeListeners.add(listener);
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: 18338
diff changeset
205 }
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: 18338
diff changeset
206
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: 18338
diff changeset
207 /**
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: 18338
diff changeset
208 * Removes a {@link ProbeListener}. Ignored if listener not found.
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: 18338
diff changeset
209 */
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: 18338
diff changeset
210 public static void removeProbeListener(ProbeListener listener) {
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: 18338
diff changeset
211 probeListeners.remove(listener);
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: 18338
diff changeset
212 }
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
213
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
214 /**
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
215 * Returns all {@link Probe}s holding a particular {@link SyntaxTag}, or the whole collection of
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
216 * probes if the specified tag is {@code null}.
16856
7833417c8172 Changes to Instrumentation
David Piorkowski <david.piorkowski@oracle.com>
parents: 16391
diff changeset
217 *
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: 18338
diff changeset
218 * @return A collection of probes containing the given tag.
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
219 */
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: 18338
diff changeset
220 public static Collection<Probe> findProbesTaggedAs(SyntaxTag tag) {
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: 18338
diff changeset
221 final List<Probe> taggedProbes = new ArrayList<>();
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: 18338
diff changeset
222 for (WeakReference<Probe> ref : probes) {
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: 18338
diff changeset
223 Probe probe = ref.get();
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: 18338
diff changeset
224 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: 18338
diff changeset
225 if (tag == null || probe.isTaggedAs(tag)) {
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: 18338
diff changeset
226 taggedProbes.add(ref.get());
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: 18338
diff changeset
227 }
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: 18338
diff changeset
228 }
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: 18338
diff changeset
229 }
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: 18338
diff changeset
230 return taggedProbes;
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: 18338
diff changeset
231 }
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: 18338
diff changeset
232
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
233 // TODO (mlvdv) generalize to permit multiple "before traps" without a performance hit?
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: 18338
diff changeset
234 /**
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
235 * Sets the current "<em>before</em> tag trap"; there can be no more than one in effect.
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
236 * <ul>
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
237 * <li>The before-trap triggers a callback just <strong><em>before</em></strong> execution
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
238 * reaches <strong><em>any</em></strong> {@link Probe} (either existing or subsequently created)
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
239 * with the specified {@link SyntaxTag}.</li>
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
240 * <li>Setting the before-trap to {@code null} clears an existing before-trap.</li>
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
241 * <li>Setting a non{@code -null} before-trap when one is already set clears the previously set
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
242 * before-trap.</li>
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
243 * </ul>
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: 18338
diff changeset
244 *
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
245 * @param newBeforeTagTrap The new "before" {@link SyntaxTagTrap} to set.
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: 18338
diff changeset
246 */
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
247 public static void setBeforeTagTrap(SyntaxTagTrap newBeforeTagTrap) {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
248 beforeTagTrap = newBeforeTagTrap;
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: 18338
diff changeset
249 for (WeakReference<Probe> ref : probes) {
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: 18338
diff changeset
250 final Probe probe = ref.get();
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
251 if (probe != null) {
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
252 probe.notifyTrapsChanged();
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
253 }
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
254 }
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
255 }
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
256
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
257 // TODO (mlvdv) generalize to permit multiple "after traps" without a performance hit?
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
258 /**
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
259 * Sets the current "<em>after</em> tag trap"; there can be no more than one in effect.
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
260 * <ul>
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
261 * <li>The after-trap triggers a callback just <strong><em>after</em></strong> execution leaves
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
262 * <strong><em>any</em></strong> {@link Probe} (either existing or subsequently created) with
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
263 * the specified {@link SyntaxTag}.</li>
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
264 * <li>Setting the after-trap to {@code null} clears an existing after-trap.</li>
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
265 * <li>Setting a non{@code -null} after-trap when one is already set clears the previously set
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
266 * after-trap.</li>
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
267 * </ul>
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
268 *
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
269 * @param newAfterTagTrap The new "after" {@link SyntaxTagTrap} to set.
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
270 */
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
271 public static void setAfterTagTrap(SyntaxTagTrap newAfterTagTrap) {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
272 afterTagTrap = newAfterTagTrap;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
273 for (WeakReference<Probe> ref : probes) {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
274 final Probe probe = ref.get();
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
275 if (probe != null) {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
276 probe.notifyTrapsChanged();
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: 18338
diff changeset
277 }
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: 18338
diff changeset
278 }
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: 18338
diff changeset
279 }
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: 18338
diff changeset
280
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: 18338
diff changeset
281 private final SourceSection sourceSection;
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: 18338
diff changeset
282 private final ArrayList<SyntaxTag> tags = new ArrayList<>();
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: 18338
diff changeset
283 private final List<WeakReference<ProbeNode>> probeNodeClones = new ArrayList<>();
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
284
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
285 /*
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
286 * Invalidated whenever something changes in the Probe and its Instrument chain, so need deopt
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
287 */
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
288 private final CyclicAssumption probeStateUnchangedCyclic = new CyclicAssumption("Probe state unchanged");
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: 18338
diff changeset
289
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
290 /*
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
291 * The assumption that nothing had changed in this probe, the last time anybody checked (when
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
292 * there may have been a deopt). Every time a check fails, gets replaced by a new unchanged
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
293 * assumption.
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: 18338
diff changeset
294 */
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
295 @CompilationFinal private Assumption probeStateUnchangedAssumption = probeStateUnchangedCyclic.getAssumption();
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
296
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
297 // Must invalidate whenever changed
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
298 @CompilationFinal private boolean isBeforeTrapActive = false;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
299
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
300 // Must invalidate whenever changed
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
301 @CompilationFinal private boolean isAfterTrapActive = false;
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: 18338
diff changeset
302
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: 18338
diff changeset
303 /**
18985
867058575979 Truffle: Improved support for "probing" AST nodes:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18485
diff changeset
304 * Intended for use only by {@link ProbeNode}.
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: 18338
diff changeset
305 */
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: 18338
diff changeset
306 Probe(ProbeNode probeNode, SourceSection sourceSection) {
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: 18338
diff changeset
307 this.sourceSection = sourceSection;
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: 18338
diff changeset
308 probes.add(new WeakReference<>(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: 18338
diff changeset
309 registerProbeNodeClone(probeNode);
21684
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
310 if (TRACE) {
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
311 final String location = this.sourceSection == null ? "<unknown>" : sourceSection.getShortDescription();
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
312 trace("ADDED %s %s %s", "Probe@", location, getTagsDescription());
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
313 }
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: 18338
diff changeset
314 for (ProbeListener listener : probeListeners) {
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: 18338
diff changeset
315 listener.newProbeInserted(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: 18338
diff changeset
316 }
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: 18338
diff changeset
317 }
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: 18338
diff changeset
318
21130
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
319 /**
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
320 * Is this node tagged as belonging to a particular human-sensible category of language
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
321 * constructs?
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
322 */
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: 18338
diff changeset
323 public boolean isTaggedAs(SyntaxTag tag) {
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: 18338
diff changeset
324 assert tag != 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: 18338
diff changeset
325 return tags.contains(tag);
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: 18338
diff changeset
326 }
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: 18338
diff changeset
327
21130
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
328 /**
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
329 * In which user-sensible categories has this node been tagged (<em>empty set</em> if none).
7d21cdb15e54 Truffle/Instrumentation: remove an interface that no longer adds value
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 20961
diff changeset
330 */
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: 18338
diff changeset
331 public Collection<SyntaxTag> getSyntaxTags() {
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: 18338
diff changeset
332 return Collections.unmodifiableCollection(tags);
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: 18338
diff changeset
333 }
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
334
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
335 /**
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: 18338
diff changeset
336 * Adds a {@linkplain SyntaxTag tag} to the set of tags associated with this {@link 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: 18338
diff changeset
337 * {@code no-op} if already in the 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: 18338
diff changeset
338 */
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: 18338
diff changeset
339 public void tagAs(SyntaxTag tag, Object tagValue) {
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: 18338
diff changeset
340 assert tag != 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: 18338
diff changeset
341 if (!tags.contains(tag)) {
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: 18338
diff changeset
342 tags.add(tag);
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: 18338
diff changeset
343 for (ProbeListener listener : probeListeners) {
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: 18338
diff changeset
344 listener.probeTaggedAs(this, tag, tagValue);
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: 18338
diff changeset
345 }
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
346
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
347 // Update the status of this Probe with respect to global tag traps
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
348 boolean tagTrapsChanged = false;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
349 if (beforeTagTrap != null && tag == beforeTagTrap.getTag()) {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
350 this.isBeforeTrapActive = true;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
351 tagTrapsChanged = true;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
352 }
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
353 if (afterTagTrap != null && tag == afterTagTrap.getTag()) {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
354 this.isAfterTrapActive = true;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
355 tagTrapsChanged = true;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
356 }
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
357 if (tagTrapsChanged) {
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
358 invalidateProbeUnchanged();
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: 18338
diff changeset
359 }
21684
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
360 if (TRACE) {
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
361 trace("TAGGED as %s: %s", tag, getShortDescription());
c072fbce5756 Truffle/Instrumentation: move Probe tracing out of DebugEngine and into Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21131
diff changeset
362 }
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: 18338
diff changeset
363 }
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: 18338
diff changeset
364 }
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: 18338
diff changeset
365
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: 18338
diff changeset
366 /**
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: 18338
diff changeset
367 * Adds instrumentation at this Probe.
16857
7bfbad29d331 Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 16856
diff changeset
368 *
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: 18338
diff changeset
369 * @param instrument an instrument not yet attached to 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: 18338
diff changeset
370 * @throws IllegalStateException if the instrument has ever been attached before
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
371 */
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: 18338
diff changeset
372 public void attach(Instrument instrument) 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: 18338
diff changeset
373 if (instrument.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: 18338
diff changeset
374 throw new IllegalStateException("Attempt to attach disposed 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: 18338
diff changeset
375 }
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: 18338
diff changeset
376 if (instrument.getProbe() != 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: 18338
diff changeset
377 throw new IllegalStateException("Attampt to attach an already attached 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: 18338
diff changeset
378 }
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: 18338
diff changeset
379 instrument.setAttachedTo(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: 18338
diff changeset
380 for (WeakReference<ProbeNode> ref : probeNodeClones) {
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: 18338
diff changeset
381 final ProbeNode probeNode = ref.get();
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: 18338
diff changeset
382 if (probeNode != 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: 18338
diff changeset
383 probeNode.addInstrument(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: 18338
diff changeset
384 }
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: 18338
diff changeset
385 }
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
386 invalidateProbeUnchanged();
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: 18338
diff changeset
387 }
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: 18338
diff changeset
388
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: 18338
diff changeset
389 /**
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: 18338
diff changeset
390 * Gets the {@link SourceSection} associated with the Guest Language AST node being
e3c95cbbb50c Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 18338
diff changeset
391 * instrumented, possibly {@code 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: 18338
diff changeset
392 */
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: 18338
diff changeset
393 public SourceSection getProbedSourceSection() {
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: 18338
diff changeset
394 return sourceSection;
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: 18338
diff changeset
395 }
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: 18338
diff changeset
396
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: 18338
diff changeset
397 public String getShortDescription() {
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: 18338
diff changeset
398 final String location = sourceSection == null ? "<unknown>" : sourceSection.getShortDescription();
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: 18338
diff changeset
399 return "Probe@" + location + getTagsDescription();
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: 18338
diff changeset
400 }
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
401
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
402 /**
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: 18338
diff changeset
403 * Internal method for removing and rendering inert a specific instrument previously attached at
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: 18338
diff changeset
404 * this Probe.
16857
7bfbad29d331 Truffle/Instrumentation: Javadoc cleanups and minor corrections.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 16856
diff changeset
405 *
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: 18338
diff changeset
406 * @param instrument an instrument already 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: 18338
diff changeset
407 * @throws IllegalStateException if instrument not attached at this 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: 18338
diff changeset
408 * @see Instrument#dispose()
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
409 */
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: 18338
diff changeset
410 void disposeInstrument(Instrument instrument) 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: 18338
diff changeset
411 for (WeakReference<ProbeNode> ref : probeNodeClones) {
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: 18338
diff changeset
412 final ProbeNode probeNode = ref.get();
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: 18338
diff changeset
413 if (probeNode != 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: 18338
diff changeset
414 probeNode.removeInstrument(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: 18338
diff changeset
415 }
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: 18338
diff changeset
416 }
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
417 invalidateProbeUnchanged();
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
418 }
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
419
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
420 /**
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
421 * Receives notification that a new clone of the instrument chain associated with this
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
422 * {@link Probe} has been created as a side-effect of AST cloning.
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
423 */
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
424 void registerProbeNodeClone(ProbeNode probeNode) {
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
425 probeNodeClones.add(new WeakReference<>(probeNode));
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
426 }
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
427
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
428 /**
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
429 * Gets the currently active <strong><em>before</em></strong> {@linkplain SyntaxTagTrap Tag
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
430 * Trap} at this Probe. Non{@code -null} if the global
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
431 * {@linkplain Probe#setBeforeTagTrap(SyntaxTagTrap) Before Tag Trap} is set and if this Probe
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
432 * holds the {@link SyntaxTag} specified in the trap.
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
433 */
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
434 SyntaxTagTrap getBeforeTrap() {
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
435 checkProbeUnchanged();
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
436 return isBeforeTrapActive ? beforeTagTrap : null;
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
437 }
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
438
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
439 /**
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
440 * Gets the currently active <strong><em>after</em></strong> {@linkplain SyntaxTagTrap Tag Trap}
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
441 * at this Probe. Non{@code -null} if the global
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
442 * {@linkplain Probe#setAfterTagTrap(SyntaxTagTrap) After Tag Trap} is set and if this Probe
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
443 * holds the {@link SyntaxTag} specified in the trap.
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
444 */
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
445 SyntaxTagTrap getAfterTrap() {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
446 checkProbeUnchanged();
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
447 return isAfterTrapActive ? afterTagTrap : null;
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
448 }
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
449
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
450 /**
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
451 * To be called wherever in the Probe/Instrument chain there are dependencies on the probe
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
452 * state's @CompilatonFinal fields.
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
453 */
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
454 void checkProbeUnchanged() {
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
455 try {
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
456 probeStateUnchangedAssumption.check();
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
457 } catch (InvalidAssumptionException ex) {
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
458 // Failure creates an implicit deoptimization
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
459 // Get the assumption associated with the new probe state
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
460 this.probeStateUnchangedAssumption = probeStateUnchangedCyclic.getAssumption();
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
461 }
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
462 }
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
463
20105
e73096245a4c Truffle/Instrumentation: the Instrument code now has access to Probe.invalidateProbeUnchanged, needed for attaching AST instrumentation.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19818
diff changeset
464 void invalidateProbeUnchanged() {
19490
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
465 probeStateUnchangedCyclic.invalidate();
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
466 }
745ecef4c9cd Truffle/Instrumentation: clean up the use of Assumptions in the Probe (and attached Instruments)
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19488
diff changeset
467
21131
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
468 private void notifyTrapsChanged() {
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
469 this.isBeforeTrapActive = beforeTagTrap != null && this.isTaggedAs(beforeTagTrap.getTag());
d6d9631eb057 TruffleInstrumentation: rename Probe.setTagTrap() to Probe.setBeforeTagTrap() and add Probe.setAfterTagTrap()
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21130
diff changeset
470 this.isAfterTrapActive = afterTagTrap != null && this.isTaggedAs(afterTagTrap.getTag());
19491
4d66c000d253 Truffle/Instrumentation: more cleanup in Probe
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 19490
diff changeset
471 invalidateProbeUnchanged();
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: 18338
diff changeset
472 }
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
473
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: 18338
diff changeset
474 private String getTagsDescription() {
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: 18338
diff changeset
475 final StringBuilder sb = new StringBuilder();
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: 18338
diff changeset
476 sb.append("[");
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: 18338
diff changeset
477 String prefix = "";
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: 18338
diff changeset
478 for (SyntaxTag tag : tags) {
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: 18338
diff changeset
479 sb.append(prefix);
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: 18338
diff changeset
480 prefix = ",";
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: 18338
diff changeset
481 sb.append(tag.toString());
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: 18338
diff changeset
482 }
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: 18338
diff changeset
483 sb.append("]");
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: 18338
diff changeset
484 return sb.toString();
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: 18338
diff changeset
485 }
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
486 }