Mercurial > hg > truffle
changeset 22171:41c5f430ce37
Using buildNew as that more directly indicates the use of Builder pattern
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/AccessorTest.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/AccessorTest.java Mon Sep 21 10:44:18 2015 +0200 @@ -48,7 +48,7 @@ @Test public void canGetAccessToOwnLanguageInstance() throws Exception { - PolyglotEngine vm = PolyglotEngine.createNew().executor(Executors.newSingleThreadExecutor()).build(); + PolyglotEngine vm = PolyglotEngine.buildNew().executor(Executors.newSingleThreadExecutor()).build(); PolyglotEngine.Language language = vm.getLanguages().get(L1); assertNotNull("L1 language is defined", language);
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ExceptionDuringParsingTest.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ExceptionDuringParsingTest.java Mon Sep 21 10:44:18 2015 +0200 @@ -35,7 +35,7 @@ @Test public void canGetAccessToOwnLanguageInstance() throws Exception { - PolyglotEngine vm = PolyglotEngine.createNew().build(); + PolyglotEngine vm = PolyglotEngine.buildNew().build(); PolyglotEngine.Language language = vm.getLanguages().get(L1); assertNotNull("L1 language is defined", language);
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/GlobalSymbolTest.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/GlobalSymbolTest.java Mon Sep 21 10:44:18 2015 +0200 @@ -33,7 +33,7 @@ public class GlobalSymbolTest { @Test public void globalSymbolFoundByLanguage() throws IOException { - PolyglotEngine vm = PolyglotEngine.createNew().globalSymbol("ahoj", "42").executor(Executors.newSingleThreadExecutor()).build(); + PolyglotEngine vm = PolyglotEngine.buildNew().globalSymbol("ahoj", "42").executor(Executors.newSingleThreadExecutor()).build(); // @formatter:off Object ret = vm.eval( Source.fromText("return=ahoj", "Return").withMimeType(L3) @@ -44,7 +44,7 @@ @Test public void globalSymbolFoundByVMUser() throws IOException { - PolyglotEngine vm = PolyglotEngine.createNew().globalSymbol("ahoj", "42").build(); + PolyglotEngine vm = PolyglotEngine.buildNew().globalSymbol("ahoj", "42").build(); PolyglotEngine.Value ret = vm.findGlobalSymbol("ahoj"); assertNotNull("Symbol found", ret); assertEquals("42", ret.get());
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ImplicitExplicitExportTest.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ImplicitExplicitExportTest.java Mon Sep 21 10:44:18 2015 +0200 @@ -43,7 +43,7 @@ @Before public void initializeVM() { mainThread = Thread.currentThread(); - vm = PolyglotEngine.createNew().executor(Executors.newSingleThreadExecutor()).build(); + vm = PolyglotEngine.buildNew().executor(Executors.newSingleThreadExecutor()).build(); assertTrue("Found " + L1 + " language", vm.getLanguages().containsKey(L1)); assertTrue("Found " + L2 + " language", vm.getLanguages().containsKey(L2)); assertTrue("Found " + L3 + " language", vm.getLanguages().containsKey(L3));
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/InitializationTest.java Mon Sep 21 10:44:18 2015 +0200 @@ -56,7 +56,7 @@ @Test public void accessProbeForAbstractLanguage() throws IOException { final Debugger[] arr = {null}; - PolyglotEngine vm = PolyglotEngine.createNew().onEvent(new EventConsumer<ExecutionEvent>(ExecutionEvent.class) { + PolyglotEngine vm = PolyglotEngine.buildNew().onEvent(new EventConsumer<ExecutionEvent>(ExecutionEvent.class) { @Override protected void on(ExecutionEvent event) { arr[0] = event.getDebugger();
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleVMSingleThreadedTest.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleVMSingleThreadedTest.java Mon Sep 21 10:44:18 2015 +0200 @@ -35,7 +35,7 @@ @Before public void initInDifferentThread() throws InterruptedException { - final PolyglotEngine.Builder b = PolyglotEngine.createNew(); + final PolyglotEngine.Builder b = PolyglotEngine.buildNew(); Thread t = new Thread("Initializer") { @Override public void run() {
--- a/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java Mon Sep 21 10:44:18 2015 +0200 @@ -42,7 +42,7 @@ import java.util.logging.*; /** - * Gate way into the world of {@link TruffleLanguage Truffle languages}. {@link #createNew() + * Gate way into the world of {@link TruffleLanguage Truffle languages}. {@link #buildNew() * Instantiate} your own portal into the isolated, multi language system with all the registered * languages ready for your use. A {@link PolyglotEngine} runs inside of a <em>JVM</em>, there can however * be multiple instances (some would say tenants) of {@link PolyglotEngine} running next to each other in a @@ -58,9 +58,9 @@ * inter-operability between all Truffle languages. There is 1:N mapping between {@link PolyglotEngine} and * {@link TruffleLanguage Truffle language implementations}. * <p> - * Use {@link #createNew()} to create new isolated portal ready for execution of various languages. + * Use {@link #buildNew()} to create new isolated portal ready for execution of various languages. * All the languages in a single portal see each other exported global symbols and can cooperate. - * Use {@link #createNew()} multiple times to create different, isolated portal environment + * Use {@link #buildNew()} multiple times to create different, isolated portal environment * completely separated from each other. * <p> * Once instantiated use {@link #eval(java.net.URI)} with a reference to a file or URL or directly @@ -125,7 +125,7 @@ * virtual machine and then create one using {@link Builder#build()}: * * <pre> - * {@link PolyglotEngine} vm = {@link PolyglotEngine}.{@link PolyglotEngine#createNew() createNew()} + * {@link PolyglotEngine} vm = {@link PolyglotEngine}.{@link PolyglotEngine#buildNew() buildNew()} * .{@link Builder#stdOut(java.io.Writer) stdOut}({@link Writer yourWriter}) * .{@link Builder#stdErr(java.io.Writer) stdErr}({@link Writer yourWriter}) * .{@link Builder#stdIn(java.io.Reader) stdIn}({@link Reader yourReader}) @@ -138,7 +138,7 @@ * * @return new, isolated virtual machine with pre-registered languages */ - public static PolyglotEngine.Builder createNew() { + public static PolyglotEngine.Builder buildNew() { // making Builder non-static inner class is a // nasty trick to avoid the Builder class to appear // in Javadoc next to TruffleVM class @@ -151,7 +151,7 @@ * end create new {@link PolyglotEngine virtual machine}: * * <pre> - * {@link PolyglotEngine} vm = {@link PolyglotEngine}.{@link PolyglotEngine#createNew() createNew()} + * {@link PolyglotEngine} vm = {@link PolyglotEngine}.{@link PolyglotEngine#buildNew() buildNew()} * .{@link Builder#stdOut(java.io.Writer) stdOut}({@link Writer yourWriter}) * .{@link Builder#stdErr(java.io.Writer) stdErr}({@link Writer yourWriter}) * .{@link Builder#stdIn(java.io.Reader) stdIn}({@link Reader yourReader})
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.java Mon Sep 21 10:44:18 2015 +0200 @@ -53,13 +53,13 @@ public class SLTckTest extends TruffleTCK { @Test public void testVerifyPresence() { - PolyglotEngine vm = PolyglotEngine.createNew().build(); + PolyglotEngine vm = PolyglotEngine.buildNew().build(); assertTrue("Our language is present", vm.getLanguages().containsKey("application/x-sl")); } @Override protected PolyglotEngine prepareVM() throws Exception { - PolyglotEngine vm = PolyglotEngine.createNew().build(); + PolyglotEngine vm = PolyglotEngine.buildNew().build(); // @formatter:off vm.eval( Source.fromText(
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java Mon Sep 21 10:44:18 2015 +0200 @@ -218,7 +218,7 @@ ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintWriter printer = new PrintWriter(out); try { - PolyglotEngine vm = PolyglotEngine.createNew().stdIn(new BufferedReader(new StringReader(repeat(testCase.testInput, repeats)))).stdOut(printer).build(); + PolyglotEngine vm = PolyglotEngine.buildNew().stdIn(new BufferedReader(new StringReader(repeat(testCase.testInput, repeats)))).stdOut(printer).build(); String script = readAllLines(testCase.path); SLLanguage.run(vm, testCase.path, null, printer, repeats, builtins);
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java Mon Sep 21 10:44:18 2015 +0200 @@ -227,7 +227,7 @@ // We use the name of the file to determine what visitor to attach to it. if (testCase.baseName.endsWith(ASSIGNMENT_VALUE_SUFFIX)) { // Set up the execution context for Simple and register our two listeners - PolyglotEngine vm = PolyglotEngine.createNew().stdIn(new BufferedReader(new StringReader(testCase.testInput))).stdOut(printer).build(); + PolyglotEngine vm = PolyglotEngine.buildNew().stdIn(new BufferedReader(new StringReader(testCase.testInput))).stdOut(printer).build(); final String src = readAllLines(testCase.path); vm.eval(Source.fromText(src, testCase.path.toString()).withMimeType("application/x-sl"));
--- a/truffle/com.oracle.truffle.sl.tools/src/com/oracle/truffle/sl/tools/debug/SLREPLServer.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.sl.tools/src/com/oracle/truffle/sl/tools/debug/SLREPLServer.java Mon Sep 21 10:44:18 2015 +0200 @@ -135,7 +135,7 @@ } }; - PolyglotEngine newVM = PolyglotEngine.createNew().onEvent(onHalted).onEvent(onExec).build(); + PolyglotEngine newVM = PolyglotEngine.buildNew().onEvent(onHalted).onEvent(onExec).build(); this.language = newVM.getLanguages().get("application/x-sl"); assert language != null;
--- a/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java Mon Sep 21 10:34:30 2015 +0200 +++ b/truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLLanguage.java Mon Sep 21 10:44:18 2015 +0200 @@ -180,7 +180,7 @@ * 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 { - PolyglotEngine vm = PolyglotEngine.createNew().build(); + PolyglotEngine vm = PolyglotEngine.buildNew().build(); assert vm.getLanguages().containsKey("application/x-sl"); setupToolDemos(); @@ -211,7 +211,7 @@ * Temporary method during API evolution, supports debugger integration. */ public static void run(Source source) throws IOException { - PolyglotEngine vm = PolyglotEngine.createNew().build(); + PolyglotEngine vm = PolyglotEngine.buildNew().build(); assert vm.getLanguages().containsKey("application/x-sl"); vm.eval(source); Value main = vm.findGlobalSymbol("main");