comparison 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
comparison
equal deleted inserted replaced
15486:8f09b84f325f 15605:bb9473723904
22 * or visit www.oracle.com if you need additional information or have any 22 * or visit www.oracle.com if you need additional information or have any
23 * questions. 23 * questions.
24 */ 24 */
25 package com.oracle.truffle.api; 25 package com.oracle.truffle.api;
26 26
27 import java.util.*;
28
27 import com.oracle.truffle.api.instrument.*; 29 import com.oracle.truffle.api.instrument.*;
28 import com.oracle.truffle.api.source.*; 30 import com.oracle.truffle.api.source.*;
29 31
30 /** 32 /**
31 * Access to information and basic services in the runtime context for a Truffle-implemented guest 33 * Access to information and basic services in the runtime context for a Truffle-implemented guest
45 * Gets access to source management services. 47 * Gets access to source management services.
46 */ 48 */
47 SourceManager getSourceManager(); 49 SourceManager getSourceManager();
48 50
49 /** 51 /**
50 * Gets access to AST instrumentation services. 52 * Registers a tool interested in being notified of events related to the loading of sources.
51 */ 53 */
52 Instrumentation getInstrumentation(); 54 void addSourceListener(SourceListener listener);
55
56 /**
57 * Add instrumentation to subsequently constructed Truffle ASTs for the guest language; every
58 * one added will have the opportunity to add instrumentation.
59 *
60 * @throws IllegalStateException if AST instrumentation not enabled
61 * @throws IllegalArgumentException if prober not usable for the guest language implementation.
62 */
63 void addNodeProber(ASTNodeProber nodeProber) throws IllegalStateException, IllegalArgumentException;
64
65 /**
66 * Registers a tool interested in being notified about the insertion of a newly created
67 * {@link Probe} into a Truffle AST.
68 */
69 void addProbeListener(ProbeListener listener);
70
71 /**
72 * Return the (possibly newly created) {@link Probe} uniquely associated with a particular
73 * source code location. A newly created probe carries no tags.
74 *
75 * @return a probe uniquely associated with an extent of guest language source code.
76 */
77 Probe getProbe(SourceSection sourceSection);
78
79 /**
80 * Returns all existing probes with specific tag, or all probes if {@code tag = null}; empty
81 * collection if no probes found.
82 */
83 Collection<Probe> findProbesTaggedAs(PhylumTag tag);
84
85 /**
86 * Returns all existing probes with first character on a specified line; empty collection if no
87 * probes found.
88 */
89 Collection<Probe> findProbesByLine(SourceLineLocation lineLocation);
90
91 /**
92 * Sets a trap that will make a callback at any AST location where a existing probe holds a
93 * specified tag; only one trap may be set at a time.
94 *
95 * @throws IllegalStateException if a trap is already set
96 */
97 void setTrap(PhylumTrap trap) throws IllegalStateException;
98
99 /**
100 * Clears a trap that will halt execution; only one trap may be set at a time.
101 *
102 * @throws IllegalStateException if no trap is set.
103 */
104 void clearTrap() throws IllegalStateException;
53 105
54 /** 106 /**
55 * Access to information visualization services for the specific language. 107 * Access to information visualization services for the specific language.
56 */ 108 */
57 Visualizer getVisualizer(); 109 Visualizer getVisualizer();
58
59 /**
60 * Add instrumentation to subsequently constructed Truffle ASTs for the guest language; every
61 * one added will have the opportunity to add instrumentation.
62 *
63 * @throws IllegalArgumentException if prober not usable for the guest language.
64 */
65 void addNodeProber(ASTNodeProber nodeProber);
66 } 110 }