# HG changeset patch # User Michael Van De Vanter # Date 1401250696 25200 # Node ID 14ac87c56a27231bacc629584140fc1e5a8ffa06 # Parent 079229f002a32bf2f77ecd27937d13adad3dc44b Truffle: NPE guard in InstrumentationNode diff -r 079229f002a3 -r 14ac87c56a27 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java Sat May 24 10:48:18 2014 -0700 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java Tue May 27 21:18:16 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) {