Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java @ 21469:286aef83a9a7
Replacing PrintStream with PrintWriter in the simple language
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Fri, 22 May 2015 18:12:01 +0200 |
parents | 99942eac9c6d |
children | bb51b9a142b3 3b8bbf51d320 |
comparison
equal
deleted
inserted
replaced
21468:99942eac9c6d | 21469:286aef83a9a7 |
---|---|
133 @TruffleLanguage.Registration(name = "sl", mimeType = "application/x-sl") | 133 @TruffleLanguage.Registration(name = "sl", mimeType = "application/x-sl") |
134 public class SLMain extends TruffleLanguage { | 134 public class SLMain extends TruffleLanguage { |
135 private final SLContext context; | 135 private final SLContext context; |
136 | 136 |
137 public SLMain() { | 137 public SLMain() { |
138 this.context = SLContextFactory.create(new BufferedReader(new InputStreamReader(System.in)), System.out); | 138 this.context = SLContextFactory.create(new BufferedReader(new InputStreamReader(System.in)), new PrintWriter(System.out)); |
139 } | 139 } |
140 | 140 |
141 /* Demonstrate per-type tabulation of node execution counts */ | 141 /* Demonstrate per-type tabulation of node execution counts */ |
142 private static boolean nodeExecCounts = false; | 142 private static boolean nodeExecCounts = false; |
143 /* Demonstrate per-line tabulation of STATEMENT node execution counts */ | 143 /* Demonstrate per-line tabulation of STATEMENT node execution counts */ |
168 | 168 |
169 /** | 169 /** |
170 * Parse and run the specified SL source. Factored out in a separate method so that it can also | 170 * Parse and run the specified SL source. Factored out in a separate method so that it can also |
171 * be used by the unit test harness. | 171 * be used by the unit test harness. |
172 */ | 172 */ |
173 public static long run(SLContext context, Source source, PrintStream logOutput, int repeats) { | 173 public static long run(SLContext context, Source source, PrintWriter logOutput, int repeats) { |
174 if (logOutput != null) { | 174 if (logOutput != null) { |
175 logOutput.println("== running on " + Truffle.getRuntime().getName()); | 175 logOutput.println("== running on " + Truffle.getRuntime().getName()); |
176 // logOutput.println("Source = " + source.getCode()); | 176 // logOutput.println("Source = " + source.getCode()); |
177 } | 177 } |
178 | 178 |
258 * When dumpASTToIGV is true: dumps the AST of all functions to the IGV visualizer, via a socket | 258 * When dumpASTToIGV is true: dumps the AST of all functions to the IGV visualizer, via a socket |
259 * connection. IGV can be started with the mx command "mx igv". | 259 * connection. IGV can be started with the mx command "mx igv". |
260 * <p> | 260 * <p> |
261 * When printASTToLog is true: prints the ASTs to the console. | 261 * When printASTToLog is true: prints the ASTs to the console. |
262 */ | 262 */ |
263 private static void printScript(String groupName, SLContext context, PrintStream logOutput, boolean printASTToLog, boolean printSourceAttributionToLog, boolean dumpASTToIGV) { | 263 private static void printScript(String groupName, SLContext context, PrintWriter logOutput, boolean printASTToLog, boolean printSourceAttributionToLog, boolean dumpASTToIGV) { |
264 if (dumpASTToIGV) { | 264 if (dumpASTToIGV) { |
265 GraphPrintVisitor graphPrinter = new GraphPrintVisitor(); | 265 GraphPrintVisitor graphPrinter = new GraphPrintVisitor(); |
266 graphPrinter.beginGroup(groupName); | 266 graphPrinter.beginGroup(groupName); |
267 for (SLFunction function : context.getFunctionRegistry().getFunctions()) { | 267 for (SLFunction function : context.getFunctionRegistry().getFunctions()) { |
268 RootCallTarget callTarget = function.getCallTarget(); | 268 RootCallTarget callTarget = function.getCallTarget(); |