Mercurial > hg > truffle
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.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 | f675818d9ad0 |
children | abe7128ca473 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Wed May 21 21:07:15 2014 -0700 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLContext.java Sat May 24 10:34:43 2014 -0700 @@ -24,10 +24,11 @@ import java.io.*; +import com.oracle.truffle.api.*; import com.oracle.truffle.api.dsl.*; import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.api.instrument.*; import com.oracle.truffle.api.nodes.*; -import com.oracle.truffle.api.source.*; import com.oracle.truffle.sl.builtins.*; import com.oracle.truffle.sl.nodes.*; import com.oracle.truffle.sl.nodes.local.*; @@ -43,26 +44,27 @@ * However, if two separate scripts run in one Java VM at the same time, they have a different * context. Therefore, the context is not a singleton. */ -public final class SLContext { - private final SourceManager sourceManager; +public final class SLContext extends ExecutionContext { private final BufferedReader input; private final PrintStream output; private final SLFunctionRegistry functionRegistry; + private SourceCallback sourceCallback = null; - public SLContext(SourceManager sourceManager, BufferedReader input, PrintStream output) { - this.sourceManager = sourceManager; + public SLContext(BufferedReader input, PrintStream output) { this.input = input; this.output = output; this.functionRegistry = new SLFunctionRegistry(); - installBuiltins(); } - /** - * Returns the source manger that controls all SL source code that is executed. - */ - public SourceManager getSourceManager() { - return sourceManager; + @Override + public String getLanguageShortName() { + return "Simple"; + } + + @Override + public void setSourceCallback(SourceCallback sourceCallback) { + this.sourceCallback = sourceCallback; } /** @@ -88,6 +90,10 @@ return functionRegistry; } + public SourceCallback getSourceCallback() { + return sourceCallback; + } + /** * Adds all builtin functions to the {@link SLFunctionRegistry}. This method lists all * {@link SLBuiltinNode builtin implementation classes}.