comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 18485:e3c95cbbb50c

Truffle Instrumentation: major API revision, based around the Probe and Instrument classes; add Instrumentable API for language implementors, with most details automated; reimplemented to handle AST splitting automatically; more JUnit tests.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Sun, 23 Nov 2014 16:07:23 -0800
parents 656331a61829
children f57d86eb036f
comparison
equal deleted inserted replaced
18484:e97e1f07a3d6 18485:e3c95cbbb50c
22 * or visit www.oracle.com if you need additional information or have any 22 * or visit www.oracle.com if you need additional information or have any
23 * questions. 23 * questions.
24 */ 24 */
25 package com.oracle.truffle.api.nodes; 25 package com.oracle.truffle.api.nodes;
26 26
27 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
27 import com.oracle.truffle.api.*; 28 import com.oracle.truffle.api.*;
28 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
29 import com.oracle.truffle.api.frame.*; 29 import com.oracle.truffle.api.frame.*;
30 import com.oracle.truffle.api.impl.*; 30 import com.oracle.truffle.api.impl.*;
31 import com.oracle.truffle.api.instrument.*;
31 import com.oracle.truffle.api.source.*; 32 import com.oracle.truffle.api.source.*;
32 33
33 /** 34 /**
34 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a 35 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a
35 * root node can be used to create a call target using 36 * root node can be used to create a call target using
113 * the correct <code>ExecutionContext</code> to be determined for a <code>RootNode</code> (and 114 * the correct <code>ExecutionContext</code> to be determined for a <code>RootNode</code> (and
114 * so also for a {@link RootCallTarget} and a {@link FrameInstance} obtained from the call 115 * so also for a {@link RootCallTarget} and a {@link FrameInstance} obtained from the call
115 * stack) without prior knowledge of the language it has come from. 116 * stack) without prior knowledge of the language it has come from.
116 * 117 *
117 * Used for instance to determine the language of a <code>RootNode<code>: 118 * Used for instance to determine the language of a <code>RootNode<code>:
118 * 119 *
119 * <pre> 120 * <pre>
120 * <code> 121 * <code>
121 * rootNode.getExecutionContext().getLanguageShortName(); 122 * rootNode.getExecutionContext().getLanguageShortName();
122 * </code> </pre> 123 * </code> </pre>
123 * 124 *
138 } else { 139 } else {
139 return context.getCompilerOptions(); 140 return context.getCompilerOptions();
140 } 141 }
141 } 142 }
142 143
144 /**
145 * Apply all registered instances of {@link ASTProber} to the AST, if any, held by this root
146 * node. This can only be done once the AST is complete, notably once all parent pointers are
147 * correctly assigned. But it also must be done before any AST cloning or execution.
148 * <p>
149 * If this is not done, then the AST will not be subject to debugging or any other
150 * instrumentation-supported tooling.
151 * <p>
152 * Implementations should ensure that instrumentation is never applied more than once to an AST,
153 * as this is not guaranteed to be error-free.
154 *
155 * @see Probe#registerASTProber(com.oracle.truffle.api.instrument.ASTProber)
156 */
157 public void applyInstrumentation() {
158 }
143 } 159 }