Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java @ 16880:7661cc464239
Truffle/Instrumentation: Added Instrumentable interface and LineLocationToSourceSections map
SL: Updated implementation to use new Instrumentable interface
author | David Piorkowski <david.piorkowski@oracle.com> |
---|---|
date | Thu, 21 Aug 2014 13:28:22 -0700 |
parents | 2a5ec181dad4 |
children | 997899955e72 |
comparison
equal
deleted
inserted
replaced
16867:7af9301efe6b | 16880:7661cc464239 |
---|---|
31 import com.oracle.truffle.api.nodes.*; | 31 import com.oracle.truffle.api.nodes.*; |
32 import com.oracle.truffle.api.source.*; | 32 import com.oracle.truffle.api.source.*; |
33 import com.oracle.truffle.sl.*; | 33 import com.oracle.truffle.sl.*; |
34 import com.oracle.truffle.sl.builtins.*; | 34 import com.oracle.truffle.sl.builtins.*; |
35 import com.oracle.truffle.sl.nodes.*; | 35 import com.oracle.truffle.sl.nodes.*; |
36 import com.oracle.truffle.sl.nodes.instrument.*; | |
37 import com.oracle.truffle.sl.nodes.local.*; | 36 import com.oracle.truffle.sl.nodes.local.*; |
38 import com.oracle.truffle.sl.parser.*; | 37 import com.oracle.truffle.sl.parser.*; |
39 | 38 |
40 /** | 39 /** |
41 * The run-time state of SL during execution. One context is instantiated before any source code is | 40 * The run-time state of SL during execution. One context is instantiated before any source code is |
50 public final class SLContext extends ExecutionContext { | 49 public final class SLContext extends ExecutionContext { |
51 private final BufferedReader input; | 50 private final BufferedReader input; |
52 private final PrintStream output; | 51 private final PrintStream output; |
53 private final SLFunctionRegistry functionRegistry; | 52 private final SLFunctionRegistry functionRegistry; |
54 private SourceCallback sourceCallback = null; | 53 private SourceCallback sourceCallback = null; |
55 private SLASTProber astProber; | |
56 | 54 |
57 public SLContext(BufferedReader input, PrintStream output) { | 55 public SLContext(BufferedReader input, PrintStream output) { |
58 this.input = input; | 56 this.input = input; |
59 this.output = output; | 57 this.output = output; |
60 this.functionRegistry = new SLFunctionRegistry(); | 58 this.functionRegistry = new SLFunctionRegistry(); |
152 | 150 |
153 if (sourceCallback != null) { | 151 if (sourceCallback != null) { |
154 sourceCallback.startLoading(source); | 152 sourceCallback.startLoading(source); |
155 } | 153 } |
156 | 154 |
157 Parser.parseSL(this, source, astProber); | 155 Parser.parseSL(this, source); |
158 | 156 |
159 if (sourceCallback != null) { | 157 if (sourceCallback != null) { |
160 sourceCallback.endLoading(source); | 158 sourceCallback.endLoading(source); |
161 } | 159 } |
162 | 160 |
164 if (main.getCallTarget() == null) { | 162 if (main.getCallTarget() == null) { |
165 throw new SLException("No function main() defined in SL source file."); | 163 throw new SLException("No function main() defined in SL source file."); |
166 } | 164 } |
167 main.getCallTarget().call(); | 165 main.getCallTarget().call(); |
168 } | 166 } |
169 | |
170 /** | |
171 * Sets the {@link SLASTProber} for the executeMain method. | |
172 * | |
173 * @param astProber The prober to use for adding instrumentation for this context. | |
174 */ | |
175 public void setASTNodeProber(SLASTProber astProber) { | |
176 this.astProber = astProber; | |
177 } | |
178 } | 167 } |