Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTProber.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 | 0c6d8a08e31b |
children | e3c95cbbb50c |
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.instrument; | 25 package com.oracle.truffle.api.instrument; |
26 | 26 |
27 import com.oracle.truffle.api.nodes.*; | |
28 | |
27 /** | 29 /** |
28 * Implementation of a policy for <em>instrumenting</em> Truffle ASTs with {@link Probe}s at | 30 * Implementation of a policy for <em>instrumenting</em> Truffle ASTs with {@link Probe}s at |
29 * particular nodes by inserting node {@link Wrapper}s. | 31 * particular nodes by inserting node {@link Wrapper}s. |
32 * <p> | |
33 * Multiple "node probers" can be added, typically by different tools; the "combined prober" will | |
34 * apply all of them. | |
35 * <p> | |
36 * The current implementation is provisional and does not completely encapsulate everything that | |
37 * needs to be implemented for a particular use-case or set of use-cases. In particular, the AST | |
38 * building code for each language implementation must have hand-coded applications of node probing | |
39 * methods at the desired locations. For the duration of this approach, this must be done for any | |
40 * node that any client tool wishes to probe. | |
41 * <p> | |
42 * A better approach will be to implement such policies as a Truffle {@link NodeVisitor}, but that | |
43 * is not possible at this time. | |
30 * <p> | 44 * <p> |
31 * <strong>Disclaimer:</strong> experimental interface under development. | 45 * <strong>Disclaimer:</strong> experimental interface under development. |
32 */ | 46 */ |
33 public interface ASTProber { | 47 public interface ASTProber { |
34 | 48 |
35 // TODO (mlvdv) This is a provisional interface, more of a marker really | 49 // TODO (mlvdv) This is a provisional interface, more of a marker really |
36 // TODO (mlvdv) AST probing should eventually be done with visitors. | 50 // TODO (mlvdv) AST probing should eventually be done with visitors. |
37 | 51 |
38 void addNodeProber(ASTNodeProber nodeProber); | 52 /** |
53 * Adds a specification for adding probes at particular kinds of nodes. | |
54 * | |
55 * @param nodeProber | |
56 * @throws IllegalArgumentException if the prober is not applicable to the guest language | |
57 * implementation. | |
58 */ | |
59 void addNodeProber(ASTNodeProber nodeProber) throws IllegalArgumentException; | |
39 | 60 |
40 /** | 61 /** |
41 * Gets a prober that applies all added {@link ASTNodeProber}s. | 62 * Gets a (possibly guest language-specific) {@link ASTNodeProber} that will apply all that have |
63 * been added; {@code null} if no instrumentation in AST. | |
42 */ | 64 */ |
43 ASTNodeProber getCombinedNodeProber(); | 65 ASTNodeProber getCombinedNodeProber(); |
44 } | 66 } |