# HG changeset patch # User Michael Van De Vanter # Date 1401250725 25200 # Node ID eedf6c29363921cf798ae4c359da103682db44b3 # Parent 14ac87c56a27231bacc629584140fc1e5a8ffa06 Truffle: additional methods on ExecutionContext diff -r 14ac87c56a27 -r eedf6c293639 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/ExecutionContext.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/ExecutionContext.java Tue May 27 21:18:16 2014 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/ExecutionContext.java Tue May 27 21:18:45 2014 -0700 @@ -71,6 +71,18 @@ } /** + * Unregisters a tool interested in being notified about the loading of {@link Source}s. + */ + public final void removeSourceListener(SourceListener removeListener) { + final List listeners = new ArrayList<>(sourceListeners); + for (SourceListener listener : listeners) { + if (listener == removeListener) { + sourceListeners.remove(listener); + } + } + } + + /** * Registers a tool interested in being notified about the insertion of a newly created * {@link Probe} into a Truffle AST. */ @@ -79,6 +91,14 @@ } /** + * Unregisters a tool interested in being notified about the insertion of a newly created + * {@link Probe} into a Truffle AST. + */ + public final void removeProbeListener(ProbeListener listener) { + probeManager.removeProbeListener(listener); + } + + /** * Return the (possibly newly created) {@link Probe} uniquely associated with a particular * source code location. A newly created probe carries no tags. * diff -r 14ac87c56a27 -r eedf6c293639 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/ProbeManager.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/ProbeManager.java Tue May 27 21:18:16 2014 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/ProbeManager.java Tue May 27 21:18:45 2014 -0700 @@ -80,6 +80,15 @@ probeListeners.add(listener); } + public void removeProbeListener(ProbeListener removeListener) { + final List listeners = new ArrayList<>(probeListeners); + for (ProbeListener listener : listeners) { + if (listener == removeListener) { + probeListeners.remove(listener); + } + } + } + public Probe getProbe(SourceSection sourceSection) { assert sourceSection != null;