annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/ExecutionContext.java @ 15605:bb9473723904

Truffle/Instrumentation: - Merge instrumentation support into the general execution context; remove separate Instrumentation interface and implementation - Generalize the ?tagging? mechanism for extensibility: the enum PhylumTag is now an interface, and the standard tags moved to the new enum StandardTag - A new ?trap? mechanism interrupts program execution at any probed node holding a specified PhylumTag; this replaces some other special-purpose code. - Refine several interface by factoring out callback methods and simplifying collaboration among key implementation classes.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Mon, 12 May 2014 20:17:25 -0700
parents be0c151d912b
children 8c34e2cc4add
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13455
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
1 /*
13563
fb846424299f Truffle/Ruby: extend Instrumentation framework with language-agnostic interfaces for access to AST printing utilities and a Ruby implementation
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13455
diff changeset
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
13455
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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.
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
4 *
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
10 *
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
15 * accompanied this code).
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
16 *
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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,
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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.
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
20 *
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
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
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
23 * questions.
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
24 */
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
25 package com.oracle.truffle.api;
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
26
15605
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
27 import java.util.*;
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
28
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: 14094
diff changeset
29 import com.oracle.truffle.api.instrument.*;
14094
3f27e57439ed Truffle/Instrumentation: significant rearrangement (including moved class) and extension of the Truffle Instrumentation Framework. New interfaces include DebugContext (which can be attached to the ExecutionContext), through which access is provided to possibly language-specific (a) node instrumentation, (b) debug services manager, (c) notification when programs halt, (d) display of language values, and (e) display of variable identifiers.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13732
diff changeset
30 import com.oracle.truffle.api.source.*;
3f27e57439ed Truffle/Instrumentation: significant rearrangement (including moved class) and extension of the Truffle Instrumentation Framework. New interfaces include DebugContext (which can be attached to the ExecutionContext), through which access is provided to possibly language-specific (a) node instrumentation, (b) debug services manager, (c) notification when programs halt, (d) display of language values, and (e) display of variable identifiers.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13732
diff changeset
31
13455
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
32 /**
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: 14094
diff changeset
33 * Access to information and basic services in the runtime context for a Truffle-implemented guest
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: 14094
diff changeset
34 * language.
13563
fb846424299f Truffle/Ruby: extend Instrumentation framework with language-agnostic interfaces for access to AST printing utilities and a Ruby implementation
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13455
diff changeset
35 * <p>
fb846424299f Truffle/Ruby: extend Instrumentation framework with language-agnostic interfaces for access to AST printing utilities and a Ruby implementation
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13455
diff changeset
36 * <strong>Disclaimer:</strong> this interface is under development and will change.
13455
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
37 */
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
38 public interface ExecutionContext {
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
39
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
40 /**
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
41 * Gets the name of the language, possibly with version number. in short enough form that it
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
42 * might be used for an interactive prompt.
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
43 */
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
44 String getLanguageShortName();
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
45
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
46 /**
14094
3f27e57439ed Truffle/Instrumentation: significant rearrangement (including moved class) and extension of the Truffle Instrumentation Framework. New interfaces include DebugContext (which can be attached to the ExecutionContext), through which access is provided to possibly language-specific (a) node instrumentation, (b) debug services manager, (c) notification when programs halt, (d) display of language values, and (e) display of variable identifiers.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13732
diff changeset
47 * Gets access to source management services.
13455
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
48 */
14094
3f27e57439ed Truffle/Instrumentation: significant rearrangement (including moved class) and extension of the Truffle Instrumentation Framework. New interfaces include DebugContext (which can be attached to the ExecutionContext), through which access is provided to possibly language-specific (a) node instrumentation, (b) debug services manager, (c) notification when programs halt, (d) display of language values, and (e) display of variable identifiers.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13732
diff changeset
49 SourceManager getSourceManager();
3f27e57439ed Truffle/Instrumentation: significant rearrangement (including moved class) and extension of the Truffle Instrumentation Framework. New interfaces include DebugContext (which can be attached to the ExecutionContext), through which access is provided to possibly language-specific (a) node instrumentation, (b) debug services manager, (c) notification when programs halt, (d) display of language values, and (e) display of variable identifiers.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13732
diff changeset
50
3f27e57439ed Truffle/Instrumentation: significant rearrangement (including moved class) and extension of the Truffle Instrumentation Framework. New interfaces include DebugContext (which can be attached to the ExecutionContext), through which access is provided to possibly language-specific (a) node instrumentation, (b) debug services manager, (c) notification when programs halt, (d) display of language values, and (e) display of variable identifiers.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13732
diff changeset
51 /**
15605
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
52 * Registers a tool interested in being notified of events related to the loading of sources.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
53 */
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
54 void addSourceListener(SourceListener listener);
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
55
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
56 /**
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
57 * Add instrumentation to subsequently constructed Truffle ASTs for the guest language; every
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
58 * one added will have the opportunity to add instrumentation.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
59 *
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
60 * @throws IllegalStateException if AST instrumentation not enabled
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
61 * @throws IllegalArgumentException if prober not usable for the guest language implementation.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
62 */
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
63 void addNodeProber(ASTNodeProber nodeProber) throws IllegalStateException, IllegalArgumentException;
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
64
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
65 /**
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
66 * Registers a tool interested in being notified about the insertion of a newly created
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
67 * {@link Probe} into a Truffle AST.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
68 */
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
69 void addProbeListener(ProbeListener listener);
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
70
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
71 /**
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
72 * Return the (possibly newly created) {@link Probe} uniquely associated with a particular
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
73 * source code location. A newly created probe carries no tags.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
74 *
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
75 * @return a probe uniquely associated with an extent of guest language source code.
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: 14094
diff changeset
76 */
15605
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
77 Probe getProbe(SourceSection sourceSection);
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
78
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
79 /**
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
80 * Returns all existing probes with specific tag, or all probes if {@code tag = null}; empty
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
81 * collection if no probes found.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
82 */
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
83 Collection<Probe> findProbesTaggedAs(PhylumTag tag);
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
84
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
85 /**
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
86 * Returns all existing probes with first character on a specified line; empty collection if no
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
87 * probes found.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
88 */
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
89 Collection<Probe> findProbesByLine(SourceLineLocation lineLocation);
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
90
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
91 /**
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
92 * Sets a trap that will make a callback at any AST location where a existing probe holds a
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
93 * specified tag; only one trap may be set at a time.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
94 *
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
95 * @throws IllegalStateException if a trap is already set
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
96 */
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
97 void setTrap(PhylumTrap trap) throws IllegalStateException;
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
98
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
99 /**
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
100 * Clears a trap that will halt execution; only one trap may be set at a time.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
101 *
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
102 * @throws IllegalStateException if no trap is set.
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
103 */
bb9473723904 Truffle/Instrumentation:
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15450
diff changeset
104 void clearTrap() throws IllegalStateException;
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: 14094
diff changeset
105
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: 14094
diff changeset
106 /**
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: 14094
diff changeset
107 * Access to information visualization services for the specific language.
14094
3f27e57439ed Truffle/Instrumentation: significant rearrangement (including moved class) and extension of the Truffle Instrumentation Framework. New interfaces include DebugContext (which can be attached to the ExecutionContext), through which access is provided to possibly language-specific (a) node instrumentation, (b) debug services manager, (c) notification when programs halt, (d) display of language values, and (e) display of variable identifiers.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13732
diff changeset
108 */
15450
be0c151d912b Truffle/Instrumentation: API revisions
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 15279
diff changeset
109 Visualizer getVisualizer();
13455
69d2e4baa215 Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
110 }