comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrumentable.java @ 16961:a1427e40deaf

Truffle/Instrumentation: some Javadoc revistions; minor code cleanups; remove one redundant operation; add tracing to the LineLocation maps.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 26 Aug 2014 13:54:53 -0700
parents 7661cc464239
children f0c3de09f12a
comparison
equal deleted inserted replaced
16955:7ef0a2355540 16961:a1427e40deaf
24 */ 24 */
25 package com.oracle.truffle.api.instrument; 25 package com.oracle.truffle.api.instrument;
26 26
27 import com.oracle.truffle.api.*; 27 import com.oracle.truffle.api.*;
28 28
29 /**
30 * Any Truffle node implementing this interface can be "instrumented" by installing a {@link Probe}
31 * that intercepts {@link ExecutionEvents} at the node and routes them to any {@link Instrument}s
32 * that have been attached to the {@link Probe}. Only one {@link Probe} may be installed at each
33 * node; subsequent calls return the one already installed.
34 */
29 public interface Instrumentable { 35 public interface Instrumentable {
30 36
31 /** 37 /**
32 * Optionally applies <em>instrumentation</em> at a Truffle AST node, depending on guest 38 * Enables "instrumentation" of this Truffle node by tools, where this node is presumed to be
33 * language characteristics and use-case policy. Ideally, the parent node of the guest language 39 * part (and not the root of) of a well-formed Truffle AST that is not being executed. The AST
34 * implements this interface. 40 * may be modified.
35 * <ul>
36 * <li>if no instrumentation is to be applied, returns the AST node unmodified;</li>
37 * <li>if an AST node is to be instrumented, then creates a new Wrapper that <em>decorates</em>
38 * the AST node. Additionally, this creates a probe on the wrapper that is to be used for
39 * attaching instruments. This {@link Probe} is notified of all {@link ExecutionEvents} at the
40 * wrapped AST node.</li>
41 * </ul>
42 * 41 *
43 * @param context The {@link ExecutionContext} of the guest language used to create probes on 42 * @param context access to language implementation context
44 * the wrapper. 43 * @return a {@link Probe} to which tools may attach {@link Instrument}s that will receive
45 * @return The probe that was created. 44 * {@link ExecutionEvents}
46 */ 45 */
47 public Probe probe(ExecutionContext context); 46 public Probe probe(ExecutionContext context);
48 } 47 }