diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/RCommand.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/RCommand.java index b24fec0e8947498607dbce9f2772d26759f96878..27777dfb394fd490e960b2c544ce75e4f5b2df58 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/RCommand.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/RCommand.java @@ -216,6 +216,7 @@ public class RCommand { */ try { vm.eval(source); + emitIO(); } catch (IncompleteSourceException | com.oracle.truffle.api.vm.IncompleteSourceException e) { // read another line of input consoleHandler.setPrompt(doEcho ? continuePrompt : null); @@ -279,6 +280,7 @@ public class RCommand { PolyglotEngine.Value echoValue; try { echoValue = vm.eval(GET_ECHO); + emitIO(); Object echo = echoValue.get(); if (echo instanceof TruffleObject) { RLogicalVector echoVec = echoValue.as(RLogicalVector.class); @@ -296,4 +298,7 @@ public class RCommand { private static String getContinuePrompt() { return RRuntime.asString(RRuntime.asAbstractVector(RContext.getInstance().stateROptions.getValue("continue"))); } + + private static void emitIO() throws IOException { + } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java index 764398485bbec8b59f6bcccd163cd921dcc0ffaa..eeef97bcb13706bf75d89bccb84b14cdba4bf08c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java @@ -53,12 +53,16 @@ public class FastRInterop { try { callTarget = RContext.getInstance().getEnv().parse(sourceObject); + emitIO(); } catch (IOException e) { throw new RuntimeException(e); } return callTarget.call(); } + + private void emitIO() throws IOException { + } } @RBuiltin(name = ".fastr.interop.export", visibility = RVisibility.OFF, kind = RBuiltinKind.PRIMITIVE, parameterNames = {"name", "value"}) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java index f75406ba198bd660dd4f1a39c4b1121373fa6ce3..505500c15023012ef3ec1ef4a8153d06602bc17c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java @@ -192,7 +192,7 @@ public final class RContext extends ExecutionContext implements TruffleObject { PolyglotEngine vm = info.apply(PolyglotEngine.newBuilder()).build(); try { setContext(vm.eval(GET_CONTEXT).as(RContext.class)); - } catch (IOException e1) { + } catch (Exception e1) { throw new RInternalError(e1, "error while initializing eval thread"); } try { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java index 033198c1d947ea1ecb104d496d2adef7d94eaf43..6283211fda43bf3476a20052e8c92303b8d49e8d 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java @@ -168,6 +168,7 @@ public final class FastRSession implements RSession { main = info.apply(PolyglotEngine.newBuilder()).build(); try { mainContext = main.eval(GET_CONTEXT).as(RContext.class); + emitIO(); } catch (IOException e) { throw new RuntimeException("error while retrieving test context", e); } @@ -248,6 +249,7 @@ public final class FastRSession implements RSession { try { vm.eval(source); input = consoleHandler.readLine(); + emitIO(); } catch (IncompleteSourceException | com.oracle.truffle.api.vm.IncompleteSourceException e) { String additionalInput = consoleHandler.readLine(); if (additionalInput == null) { @@ -289,4 +291,7 @@ public final class FastRSession implements RSession { public String name() { return "FastR"; } + + static void emitIO() throws IOException { + } }