Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java @ 15891:09ac9ac9c4fc
Truffle: SourceManager renamed to SourceFactory
- All methods are static, no longer accessed via ExecutionContext
- Sources are indexed with weak references
- File content caching is now optional; off by default
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Sat, 24 May 2014 10:34:43 -0700 |
parents | 64dcb92ee75a |
children | 915ebb306fcc |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java Wed May 21 21:07:15 2014 -0700 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java Sat May 24 10:34:43 2014 -0700 @@ -27,6 +27,7 @@ import com.oracle.truffle.api.*; import com.oracle.truffle.api.dsl.*; +import com.oracle.truffle.api.instrument.*; import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.api.source.*; import com.oracle.truffle.sl.builtins.*; @@ -117,13 +118,14 @@ * The main entry point. Use the mx command "mx sl" to run it with the correct class path setup. */ public static void main(String[] args) throws IOException { - SourceManager sourceManager = new SourceManager(); + + SLContext context = new SLContext(new BufferedReader(new InputStreamReader(System.in)), System.out); Source source; if (args.length == 0) { - source = sourceManager.get("stdin", System.in); + source = SourceFactory.fromReader(new InputStreamReader(System.in), "stdin"); } else { - source = sourceManager.get(args[0]); + source = SourceFactory.fromFile(args[0]); } int repeats = 1; @@ -131,7 +133,6 @@ repeats = Integer.parseInt(args[1]); } - SLContext context = new SLContext(sourceManager, new BufferedReader(new InputStreamReader(System.in)), System.out); run(context, source, System.out, repeats); } @@ -144,8 +145,16 @@ logOutput.println("== running on " + Truffle.getRuntime().getName()); } + final SourceCallback sourceCallback = context.getSourceCallback(); + /* Parse the SL source file. */ + if (sourceCallback != null) { + sourceCallback.startLoading(source); + } Parser.parseSL(context, source); + if (sourceCallback != null) { + sourceCallback.endLoading(source); + } /* Lookup our main entry point, which is per definition always named "main". */ SLFunction main = context.getFunctionRegistry().lookup("main"); if (main.getCallTarget() == null) {