comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/InstrumentationNode.java @ 15943:14ac87c56a27

Truffle: NPE guard in InstrumentationNode
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 27 May 2014 21:18:16 -0700
parents 8c34e2cc4add
children 915ebb306fcc
comparison
equal deleted inserted replaced
15892:079229f002a3 15943:14ac87c56a27
60 60
61 protected InstrumentationNode() { 61 protected InstrumentationNode() {
62 } 62 }
63 63
64 /** 64 /**
65 * @return the instance of {@link Probe} to which this instrument is attached. 65 * Gets the {@link Probe} to which this instrument is attached; {@code null} if not attached.
66 */ 66 */
67 protected Probe getProbe() { 67 protected Probe getProbe() {
68 final InstrumentationNode parent = (InstrumentationNode) getParent(); 68 final InstrumentationNode parent = (InstrumentationNode) getParent();
69 return parent == null ? null : parent.getProbe(); 69 return parent == null ? null : parent.getProbe();
70 } 70 }
94 next.internalRemoveInstrument(oldInstrument); 94 next.internalRemoveInstrument(oldInstrument);
95 } 95 }
96 } 96 }
97 97
98 /** 98 /**
99 * Reports to the instance of {@link Probe} holding this instrument that some essential state 99 * Reports to the instance of {@link Probe} holding this instrument, if any, that some essential
100 * has changed that requires deoptimization. 100 * state has changed that requires deoptimization.
101 */ 101 */
102 @CompilerDirectives.SlowPath 102 @CompilerDirectives.SlowPath
103 protected void notifyProbeChanged(Instrument instrument) { 103 protected void notifyProbeChanged(Instrument instrument) {
104 final ProbeImpl probe = (ProbeImpl) getProbe(); 104 Probe probe = getProbe();
105 probe.notifyProbeChanged(instrument); 105 if (probe != null) {
106 final ProbeImpl probeImpl = (ProbeImpl) probe;
107 probeImpl.notifyProbeChanged(instrument);
108 }
106 } 109 }
107 110
108 protected void internalEnter(Node astNode, VirtualFrame frame) { 111 protected void internalEnter(Node astNode, VirtualFrame frame) {
109 enter(astNode, frame); 112 enter(astNode, frame);
110 if (next != null) { 113 if (next != null) {