Mercurial > hg > truffle
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/AdvancedInstrumentRootFactory.java @ 21355:442b57a7f208
Truffle/Instrumentation: change the signature for creation of Advanced instruments, refactor how the callback listener is managed.
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 12 May 2015 16:06:00 -0700 |
parents | 575032310b2c |
children | e34bc00733d1 |
comparison
equal
deleted
inserted
replaced
21354:575032310b2c | 21355:442b57a7f208 |
---|---|
27 import com.oracle.truffle.api.nodes.*; | 27 import com.oracle.truffle.api.nodes.*; |
28 | 28 |
29 /** | 29 /** |
30 * Creator of {@linkplain AdvancedInstrumentRoot AST fragments} suitable for efficient execution, | 30 * Creator of {@linkplain AdvancedInstrumentRoot AST fragments} suitable for efficient execution, |
31 * subject to full Truffle optimization, by an | 31 * subject to full Truffle optimization, by an |
32 * {@linkplain Instrument#create(AdvancedInstrumentRootFactory, String) Advanced Instrument}. | 32 * {@linkplain Instrument#create(AdvancedInstrumentResultListener, AdvancedInstrumentRootFactory, String) |
33 * Advanced Instrument}. | |
33 * | 34 * |
34 * @see Instrument | 35 * @see Instrument |
35 * @see AdvancedInstrumentRoot | 36 * @see AdvancedInstrumentRoot |
36 */ | 37 */ |
37 public abstract class AdvancedInstrumentRootFactory { | 38 public interface AdvancedInstrumentRootFactory { |
38 | |
39 private final AdvancedInstrumentResultListener resultListener; | |
40 | 39 |
41 /** | 40 /** |
42 * Provider of {@linkplain AdvancedInstrumentRoot AST fragment} instances for efficient | 41 * Provider of {@linkplain AdvancedInstrumentRoot AST fragment} instances for efficient |
43 * execution via instrumentation, subject to full Truffle optimization, at a {@linkplain Probe | 42 * execution via instrumentation, subject to full Truffle optimization, at a {@linkplain Probe |
44 * Probed} site in a guest-language AST. | 43 * Probed} site in a guest-language AST. |
47 * @param node the guest-language AST location that is the context in which the requesting | 46 * @param node the guest-language AST location that is the context in which the requesting |
48 * Instrument must execute the AST fragment. | 47 * Instrument must execute the AST fragment. |
49 * @return a newly created AST fragment suitable for execution, via instrumentation, in the | 48 * @return a newly created AST fragment suitable for execution, via instrumentation, in the |
50 * execution context of the specified guest-language AST site. | 49 * execution context of the specified guest-language AST site. |
51 */ | 50 */ |
52 public abstract AdvancedInstrumentRoot createInstrumentRoot(Probe probe, Node node); | 51 AdvancedInstrumentRoot createInstrumentRoot(Probe probe, Node node); |
53 | |
54 /** | |
55 * Gets the listener, if one was specified, to notify with the result of executing every | |
56 * {@link AdvancedInstrumentRoot} created by this factory. | |
57 */ | |
58 public final AdvancedInstrumentResultListener resultListener() { | |
59 return resultListener; | |
60 } | |
61 | |
62 protected AdvancedInstrumentRootFactory(AdvancedInstrumentResultListener resultListener) { | |
63 this.resultListener = resultListener; | |
64 } | |
65 } | 52 } |