comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java @ 16702:2a5ec181dad4

SL: Added instrumentation testing
author David Piorkowski <david.piorkowski@oracle.com>
date Tue, 05 Aug 2014 16:34:08 -0700
parents 618d92152d3c
children 7661cc464239
comparison
equal deleted inserted replaced
16696:bd6b44b04143 16702:2a5ec181dad4
136 136
137 /* Register the builtin function in our function registry. */ 137 /* Register the builtin function in our function registry. */
138 getFunctionRegistry().register(name, rootNode); 138 getFunctionRegistry().register(name, rootNode);
139 } 139 }
140 140
141 /**
142 * This function will parse the given source code, parse the code using the {@link Parser}, and
143 * then execute the function named main. To use this method with instrumentation,
144 * setASTNodeProber must have been already called. There is currently no guard to check if this
145 * is the case. <br/>
146 * Due to the experimental nature of the instrumentation framework, the parse that happens in
147 * this method will remove any previously added instrumentation.
148 *
149 * @param source The {@link Source} to execute.
150 */
141 public void executeMain(Source source) { 151 public void executeMain(Source source) {
142 152
143 if (sourceCallback != null) { 153 if (sourceCallback != null) {
144 sourceCallback.startLoading(source); 154 sourceCallback.startLoading(source);
145 } 155 }
155 throw new SLException("No function main() defined in SL source file."); 165 throw new SLException("No function main() defined in SL source file.");
156 } 166 }
157 main.getCallTarget().call(); 167 main.getCallTarget().call();
158 } 168 }
159 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 */
160 public void setASTNodeProber(SLASTProber astProber) { 175 public void setASTNodeProber(SLASTProber astProber) {
161 // TODO Auto-generated method stub
162 this.astProber = astProber; 176 this.astProber = astProber;
163 } 177 }
164 } 178 }