comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ProbeNode.java @ 22219:1c0f490984d5

Merge with f47b601edbc626dcfe8b3636933b4834c89f7779
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Wed, 16 Sep 2015 15:36:22 -0700
parents dc83cc1f94f2 3aad794eec0e
children 20380d1d41f2
comparison
equal deleted inserted replaced
22160:0599e2df6a9f 22219:1c0f490984d5
24 */ 24 */
25 package com.oracle.truffle.api.instrument; 25 package com.oracle.truffle.api.instrument;
26 26
27 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; 27 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
28 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; 28 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
29 import com.oracle.truffle.api.TruffleLanguage;
30 import com.oracle.truffle.api.frame.VirtualFrame; 29 import com.oracle.truffle.api.frame.VirtualFrame;
31 import com.oracle.truffle.api.instrument.Instrument.AbstractInstrumentNode; 30 import com.oracle.truffle.api.instrument.Instrument.AbstractInstrumentNode;
32 import com.oracle.truffle.api.instrument.InstrumentationNode.TruffleEvents; 31 import com.oracle.truffle.api.instrument.InstrumentationNode.TruffleEvents;
33 import com.oracle.truffle.api.nodes.Node; 32 import com.oracle.truffle.api.nodes.Node;
34 import com.oracle.truffle.api.nodes.NodeCost; 33 import com.oracle.truffle.api.nodes.NodeCost;
35 import com.oracle.truffle.api.nodes.NodeInfo; 34 import com.oracle.truffle.api.nodes.NodeInfo;
36 import com.oracle.truffle.api.source.SourceSection;
37 35
38 /** 36 /**
39 * Implementation class & interface for enabling the attachment of {@linkplain Probe Probes} to 37 * Implementation class & interface for enabling the attachment of {@linkplain Probe Probes} to
40 * Truffle ASTs. 38 * Truffle ASTs.
41 * <p> 39 * <p>
114 * Implementation support for completing a newly created wrapper node. 112 * Implementation support for completing a newly created wrapper node.
115 */ 113 */
116 void insertProbe(ProbeNode probeNode); 114 void insertProbe(ProbeNode probeNode);
117 } 115 }
118 116
119 /**
120 * Create a new {@link Probe} associated with, and attached to, a Guest Language specific
121 * instance of {@link WrapperNode}.
122 */
123 @SuppressWarnings("rawtypes")
124 public static Probe insertProbe(WrapperNode wrapper) {
125 final SourceSection sourceSection = wrapper.getChild().getSourceSection();
126 final ProbeNode probeNode = new ProbeNode(); // private constructor
127 Class<? extends TruffleLanguage> l = Probe.ACCESSOR.findLanguage(wrapper.getChild().getRootNode());
128 probeNode.probe = new Probe(l, probeNode, sourceSection); // package private access
129 wrapper.insertProbe(probeNode);
130 return probeNode.probe;
131 }
132
133 // Never changed once set. 117 // Never changed once set.
134 @CompilationFinal Probe probe = null; 118 @CompilationFinal Probe probe = null;
135 /** 119 /**
136 * First {@link AbstractInstrumentNode} node in chain; {@code null} of no instruments in chain. 120 * First {@link AbstractInstrumentNode} node in chain; {@code null} of no instruments in chain.
137 */ 121 */