Mercurial > hg > graal-jvmci-8
changeset 15945:57303ce74a21
Merge with 5c73b162eec248fc2d06f59d8f25860871a21be5
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 27 May 2014 21:20:01 -0700 |
parents | eedf6c293639 (diff) 5c73b162eec2 (current diff) |
children | b2c18c498f13 6ee370b4d452 |
files | |
diffstat | 3 files changed, 37 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/ExecutionContext.java Wed May 28 00:50:11 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/ExecutionContext.java Tue May 27 21:20:01 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<SourceListener> 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. *
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java Wed May 28 00:50:11 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java Tue May 27 21:20:01 2014 -0700 @@ -62,7 +62,7 @@ } /** - * @return the instance of {@link Probe} to which this instrument is attached. + * Gets the {@link Probe} to which this instrument is attached; {@code null} if not attached. */ protected Probe getProbe() { final InstrumentationNode parent = (InstrumentationNode) getParent(); @@ -96,13 +96,16 @@ } /** - * Reports to the instance of {@link Probe} holding this instrument that some essential state - * has changed that requires deoptimization. + * Reports to the instance of {@link Probe} holding this instrument, if any, that some essential + * state has changed that requires deoptimization. */ @CompilerDirectives.SlowPath protected void notifyProbeChanged(Instrument instrument) { - final ProbeImpl probe = (ProbeImpl) getProbe(); - probe.notifyProbeChanged(instrument); + Probe probe = getProbe(); + if (probe != null) { + final ProbeImpl probeImpl = (ProbeImpl) probe; + probeImpl.notifyProbeChanged(instrument); + } } protected void internalEnter(Node astNode, VirtualFrame frame) {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/ProbeManager.java Wed May 28 00:50:11 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/ProbeManager.java Tue May 27 21:20:01 2014 -0700 @@ -80,6 +80,15 @@ probeListeners.add(listener); } + public void removeProbeListener(ProbeListener removeListener) { + final List<ProbeListener> listeners = new ArrayList<>(probeListeners); + for (ProbeListener listener : listeners) { + if (listener == removeListener) { + probeListeners.remove(listener); + } + } + } + public Probe getProbe(SourceSection sourceSection) { assert sourceSection != null;