diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java
index 025454ff93fa734c34e557a28831e9277ea022df..03697c9230d1f732c49bc450e890a0164a75b0a3 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java
@@ -398,7 +398,7 @@ final class REngine implements Engine, Engine.Timings {
         MaterializedFrame actualFrame = frame;
         if (actualFrame == null) {
             Frame current = Utils.getActualCurrentFrame();
-            if (current == null) {
+            if (current == null || !RArguments.isRFrame(current)) {
                 // special case, e.g. in parser and an error is thrown
                 actualFrame = REnvironment.globalEnv().getFrame();
             } else {
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java
index 9511869a615e2bd781ec2f88d274e1a373cf203a..7a04b504b11329490bd1dde0ac648031954f2576 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguage.java
@@ -22,18 +22,20 @@
  */
 package com.oracle.truffle.r.engine;
 
-import java.io.Closeable;
-import java.io.IOException;
 import java.util.Locale;
 
 import com.oracle.truffle.api.CallTarget;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
+import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.TruffleLanguage;
+import com.oracle.truffle.api.frame.FrameDescriptor;
 import com.oracle.truffle.api.frame.MaterializedFrame;
+import com.oracle.truffle.api.frame.VirtualFrame;
 import com.oracle.truffle.api.instrumentation.Instrumenter;
 import com.oracle.truffle.api.instrumentation.ProvidedTags;
 import com.oracle.truffle.api.instrumentation.StandardTags;
 import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.api.nodes.RootNode;
 import com.oracle.truffle.api.source.Source;
 import com.oracle.truffle.r.engine.interop.RForeignAccessFactoryImpl;
 import com.oracle.truffle.r.nodes.RASTBuilder;
@@ -49,6 +51,7 @@ import com.oracle.truffle.r.runtime.Utils;
 import com.oracle.truffle.r.runtime.context.Engine.IncompleteSourceException;
 import com.oracle.truffle.r.runtime.context.Engine.ParseException;
 import com.oracle.truffle.r.runtime.context.RContext;
+import com.oracle.truffle.r.runtime.context.RContext.RCloseable;
 import com.oracle.truffle.r.runtime.ffi.Load_RFFIFactory;
 import com.oracle.truffle.r.runtime.ffi.RFFIFactory;
 import com.oracle.truffle.r.runtime.instrument.RPackageSource;
@@ -121,30 +124,30 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> {
     @Override
     @TruffleBoundary
     @SuppressWarnings("try")
-    protected CallTarget parse(Source source, Node context, String... argumentNames) throws IOException {
-        try (Closeable c = RContext.withinContext(findContext(createFindContextNode()))) {
+    protected CallTarget parse(Source source, Node context, String... argumentNames) throws com.oracle.truffle.api.vm.IncompleteSourceException {
+        try (RCloseable c = RContext.withinContext(findContext(createFindContextNode()))) {
             try {
                 return RContext.getEngine().parseToCallTarget(source);
             } catch (IncompleteSourceException e) {
                 throw new com.oracle.truffle.api.vm.IncompleteSourceException(e);
             } catch (ParseException e) {
-                return new CallTarget() {
+                return Truffle.getRuntime().createCallTarget(new RootNode(TruffleRLanguage.class, null, new FrameDescriptor()) {
                     @Override
-                    public Object call(Object... arguments) {
+                    public Object execute(VirtualFrame frame) {
                         try {
                             throw e.throwAsRError();
                         } catch (RError e2) {
                             return null;
                         }
                     }
-                };
+                });
             } catch (RError e) {
-                return new CallTarget() {
+                return Truffle.getRuntime().createCallTarget(new RootNode(TruffleRLanguage.class, null, new FrameDescriptor()) {
                     @Override
-                    public Object call(Object... arguments) {
+                    public Object execute(VirtualFrame frame) {
                         return null;
                     }
-                };
+                });
             }
         }
     }
@@ -170,7 +173,7 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> {
     }
 
     @Override
-    protected Object evalInContext(Source source, Node node, MaterializedFrame frame) throws IOException {
+    protected Object evalInContext(Source source, Node node, MaterializedFrame frame) {
         return RContext.getEngine().parseAndEval(source, frame, false);
     }
 }
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/REnvironmentMR.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/REnvironmentMR.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f9ab7d176f7d28c7f146c6fee1a5ada9946749d
--- /dev/null
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/REnvironmentMR.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.truffle.r.engine.interop;
+
+import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.CanResolve;
+import com.oracle.truffle.api.interop.MessageResolution;
+import com.oracle.truffle.api.interop.Resolve;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.r.engine.TruffleRLanguage;
+import com.oracle.truffle.r.nodes.access.vector.ElementAccessMode;
+import com.oracle.truffle.r.nodes.access.vector.ExtractVectorNode;
+import com.oracle.truffle.r.nodes.access.vector.ReplaceVectorNode;
+import com.oracle.truffle.r.runtime.RRuntime;
+import com.oracle.truffle.r.runtime.context.RContext;
+import com.oracle.truffle.r.runtime.context.RContext.RCloseable;
+import com.oracle.truffle.r.runtime.env.REnvironment;
+
+@MessageResolution(receiverType = REnvironment.class, language = TruffleRLanguage.class)
+public class REnvironmentMR {
+
+    @Resolve(message = "IS_BOXED")
+    public abstract static class REnvironmentIsBoxedNode extends Node {
+        protected Object access(@SuppressWarnings("unused") REnvironment receiver) {
+            return false;
+        }
+    }
+
+    @Resolve(message = "HAS_SIZE")
+    public abstract static class REnvironmentHasSizeNode extends Node {
+        protected Object access(@SuppressWarnings("unused") REnvironment receiver) {
+            return true;
+        }
+    }
+
+    @Resolve(message = "IS_NULL")
+    public abstract static class REnvironmentIsNullNode extends Node {
+        protected Object access(@SuppressWarnings("unused") REnvironment receiver) {
+            return false;
+        }
+    }
+
+    @Resolve(message = "READ")
+    public abstract static class REnvironmentReadNode extends Node {
+        @Child private ExtractVectorNode extract = ExtractVectorNode.create(ElementAccessMode.SUBSCRIPT, true);
+        @Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode();
+
+        @SuppressWarnings("try")
+        protected Object access(VirtualFrame frame, REnvironment receiver, String field) {
+            try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
+                return extract.applyAccessField(frame, receiver, field);
+            }
+        }
+    }
+
+    @Resolve(message = "WRITE")
+    public abstract static class REnvironmentWriteNode extends Node {
+        @Child private ReplaceVectorNode extract = ReplaceVectorNode.create(ElementAccessMode.SUBSCRIPT, true);
+        @Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode();
+
+        @SuppressWarnings("try")
+        protected Object access(VirtualFrame frame, REnvironment receiver, String field, Object valueObj) {
+            try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
+                Object value = valueObj;
+                if (value instanceof Short) {
+                    value = (int) ((Short) value).shortValue();
+                } else if (value instanceof Float) {
+                    float floatValue = ((Float) value).floatValue();
+                    value = new Double(floatValue);
+                } else if (value instanceof Boolean) {
+                    boolean booleanValue = ((Boolean) value).booleanValue();
+                    value = booleanValue ? RRuntime.LOGICAL_TRUE : RRuntime.LOGICAL_FALSE;
+                } else if (value instanceof Character) {
+                    value = (int) ((Character) value).charValue();
+                } else if (value instanceof Byte) {
+                    value = (int) ((Byte) value).byteValue();
+                }
+                Object x = extract.apply(frame, receiver, new Object[]{field}, value);
+                return x;
+            }
+        }
+    }
+
+    @CanResolve
+    public abstract static class REnvironmentCheck extends Node {
+
+        protected static boolean test(TruffleObject receiver) {
+            return receiver instanceof REnvironment;
+        }
+    }
+
+}
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java
index b37357ee1787014d2bcd870e24d5418273f932f5..03f73455c63146019f8c9bb5a4ffdfead920049b 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java
@@ -36,6 +36,7 @@ import com.oracle.truffle.r.runtime.data.RNull;
 import com.oracle.truffle.r.runtime.data.RPairList;
 import com.oracle.truffle.r.runtime.data.RTruffleObject;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
+import com.oracle.truffle.r.runtime.env.REnvironment;
 
 public final class RForeignAccessFactoryImpl implements RForeignAccessFactory {
 
@@ -82,6 +83,8 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory {
             foreignAccess = RNullMRForeign.createAccess();
         } else if (RList.class.isAssignableFrom(clazz)) {
             foreignAccess = RListMRForeign.createAccess();
+        } else if (REnvironment.class.isAssignableFrom(clazz)) {
+            foreignAccess = REnvironmentMRForeign.createAccess();
         } else if (RPairList.class.isAssignableFrom(clazz)) {
             foreignAccess = RPairListMRForeign.createAccess();
         } else if (RFunction.class.isAssignableFrom(clazz)) {
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RFunctionMR.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RFunctionMR.java
index eb7902f3aa4943a2f097733fddb00104afe7efe3..f74aee87f9c372fa61e130bb3f2f357440b30867 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RFunctionMR.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RFunctionMR.java
@@ -22,10 +22,6 @@
  */
 package com.oracle.truffle.r.engine.interop;
 
-import java.io.Closeable;
-import java.io.IOException;
-
-import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.frame.FrameDescriptor;
 import com.oracle.truffle.api.frame.FrameSlot;
@@ -42,6 +38,7 @@ import com.oracle.truffle.r.nodes.function.RCallNode;
 import com.oracle.truffle.r.runtime.ArgumentsSignature;
 import com.oracle.truffle.r.runtime.RArguments;
 import com.oracle.truffle.r.runtime.context.RContext;
+import com.oracle.truffle.r.runtime.context.RContext.RCloseable;
 import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
 import com.oracle.truffle.r.runtime.data.RFunction;
 
@@ -69,16 +66,13 @@ public class RFunctionMR {
             VirtualFrame dummyFrame = Truffle.getRuntime().createVirtualFrame(dummyFrameArgs, emptyFrameDescriptor);
 
             RArgsValuesAndNames actualArgs = new RArgsValuesAndNames(arguments, ArgumentsSignature.empty(arguments.length));
-            try (Closeable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
+            try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
                 try {
                     dummyFrame.setObject(slot, actualArgs);
                     return call.execute(dummyFrame, receiver);
                 } finally {
                     dummyFrame.setObject(slot, null);
                 }
-            } catch (IOException e) {
-                CompilerDirectives.transferToInterpreter();
-                throw new RuntimeException(e);
             }
         }
     }
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RListMR.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RListMR.java
index 66fe5c9da31282deabc8ac4cd4c35bc5cc626921..6205c1242150c6b6f14e438fbee8abe61bed3e87 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RListMR.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RListMR.java
@@ -33,6 +33,8 @@ import com.oracle.truffle.r.nodes.access.vector.ElementAccessMode;
 import com.oracle.truffle.r.nodes.access.vector.ExtractVectorNode;
 import com.oracle.truffle.r.nodes.access.vector.ReplaceVectorNode;
 import com.oracle.truffle.r.runtime.RRuntime;
+import com.oracle.truffle.r.runtime.context.RContext;
+import com.oracle.truffle.r.runtime.context.RContext.RCloseable;
 import com.oracle.truffle.r.runtime.data.RList;
 
 @MessageResolution(receiverType = RList.class, language = TruffleRLanguage.class)
@@ -62,34 +64,41 @@ public class RListMR {
     @Resolve(message = "READ")
     public abstract static class RListReadNode extends Node {
         @Child private ExtractVectorNode extract = ExtractVectorNode.create(ElementAccessMode.SUBSCRIPT, true);
+        @Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode();
 
+        @SuppressWarnings("try")
         protected Object access(VirtualFrame frame, RList receiver, String field) {
-            Object x = extract.applyAccessField(frame, receiver, field);
-            return x;
+            try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
+                return extract.applyAccessField(frame, receiver, field);
+            }
         }
     }
 
     @Resolve(message = "WRITE")
     public abstract static class RListWriteNode extends Node {
         @Child private ReplaceVectorNode extract = ReplaceVectorNode.create(ElementAccessMode.SUBSCRIPT, true);
+        @Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode();
 
+        @SuppressWarnings("try")
         protected Object access(VirtualFrame frame, RList receiver, String field, Object valueObj) {
-            Object value = valueObj;
-            if (value instanceof Short) {
-                value = (int) ((Short) value).shortValue();
-            } else if (value instanceof Float) {
-                float floatValue = ((Float) value).floatValue();
-                value = new Double(floatValue);
-            } else if (value instanceof Boolean) {
-                boolean booleanValue = ((Boolean) value).booleanValue();
-                value = booleanValue ? RRuntime.LOGICAL_TRUE : RRuntime.LOGICAL_FALSE;
-            } else if (value instanceof Character) {
-                value = (int) ((Character) value).charValue();
-            } else if (value instanceof Byte) {
-                value = (int) ((Byte) value).byteValue();
+            try (RCloseable c = RContext.withinContext(TruffleRLanguage.INSTANCE.actuallyFindContext0(findContext))) {
+                Object value = valueObj;
+                if (value instanceof Short) {
+                    value = (int) ((Short) value).shortValue();
+                } else if (value instanceof Float) {
+                    float floatValue = ((Float) value).floatValue();
+                    value = new Double(floatValue);
+                } else if (value instanceof Boolean) {
+                    boolean booleanValue = ((Boolean) value).booleanValue();
+                    value = booleanValue ? RRuntime.LOGICAL_TRUE : RRuntime.LOGICAL_FALSE;
+                } else if (value instanceof Character) {
+                    value = (int) ((Character) value).charValue();
+                } else if (value instanceof Byte) {
+                    value = (int) ((Byte) value).byteValue();
+                }
+                Object x = extract.apply(frame, receiver, new Object[]{field}, value);
+                return x;
             }
-            Object x = extract.apply(frame, receiver, new Object[]{field}, value);
-            return x;
         }
     }
 
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 e57305c05e5ed548594b2045a8d5df358a9f516f..ec04894c62ae6888fbf1788be9dcf572ae7287d0 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
@@ -224,16 +224,18 @@ public class RCommand {
                     StringBuffer sb = new StringBuffer(input);
                     Source source = RSource.fromTextInternal(sb.toString(), RSource.Internal.SHELL_INPUT);
                     while (true) {
-                        /*
-                         * N.B. As of Truffle rev 371045b1312d412bafa29882e6c3f7bfe6c0f8f1, only
-                         * exceptions that are <: Exception are converted to IOException, Error
-                         * subclasses pass through.
-                         */
                         lastStatus = 0;
                         try {
-                            vm.eval(source);
-                            emitIO();
-                        } catch (IncompleteSourceException | com.oracle.truffle.api.vm.IncompleteSourceException e) {
+                            try {
+                                vm.eval(source);
+                                // checked exceptions are wrapped in RuntimeExceptions
+                            } catch (RuntimeException e) {
+                                if (e.getCause() instanceof com.oracle.truffle.api.vm.IncompleteSourceException) {
+                                    throw e.getCause().getCause();
+                                }
+                                throw e;
+                            }
+                        } catch (IncompleteSourceException e) {
                             // read another line of input
                             consoleHandler.setPrompt(doEcho ? continuePrompt : null);
                             String additionalInput = consoleHandler.readLine();
@@ -246,32 +248,27 @@ public class RCommand {
                             continue;
                         } catch (ParseException e) {
                             e.report(consoleHandler);
-                        } catch (IOException e) {
-                            /*
-                             * We have to extract the underlying cause and handle the special cases
-                             * appropriately.
-                             */
                             lastStatus = 1;
-                            Throwable cause = e.getCause();
-                            if (cause instanceof RError) {
-                                // drop through to continue REPL and remember last eval was an error
-                            } else if (cause instanceof JumpToTopLevelException) {
-                                // drop through to continue REPL
-                            } else if (cause instanceof DebugExitException) {
-                                throw (RuntimeException) cause;
-                            } else if (cause instanceof ExitException) {
-                                // usually from quit
-                                int status = ((ExitException) cause).getStatus();
-                                if (contextInfo.getParent() == null) {
-                                    vm.dispose();
-                                    Utils.systemExit(status);
-                                } else {
-                                    return status;
-                                }
+                        } catch (RError e) {
+                            // drop through to continue REPL and remember last eval was an error
+                            lastStatus = 1;
+                        } catch (JumpToTopLevelException e) {
+                            // drop through to continue REPL
+                        } catch (DebugExitException e) {
+                            throw (RuntimeException) e.getCause();
+                        } catch (ExitException e) {
+                            // usually from quit
+                            int status = e.getStatus();
+                            if (contextInfo.getParent() == null) {
+                                vm.dispose();
+                                Utils.systemExit(status);
                             } else {
-                                RInternalError.reportErrorAndConsoleLog(cause, consoleHandler, 0);
-                                // We continue the repl even though the system may be broken
+                                return status;
                             }
+                        } catch (Throwable e) {
+                            RInternalError.reportErrorAndConsoleLog(e, consoleHandler, 0);
+                            // We continue the repl even though the system may be broken
+                            lastStatus = 1;
                         }
                         continue REPL;
                     }
@@ -286,15 +283,14 @@ public class RCommand {
                 vm.eval(QUIT_EOF);
             } catch (JumpToTopLevelException e) {
                 Utils.systemExit(0);
-            } catch (Throwable e) {
-                if (e.getCause() instanceof ExitException) {
-                    // normal quit, but with exit code based on lastStatus
-                    if (contextInfo.getParent() == null) {
-                        Utils.systemExit(lastStatus);
-                    } else {
-                        return lastStatus;
-                    }
+            } catch (ExitException e) {
+                // normal quit, but with exit code based on lastStatus
+                if (contextInfo.getParent() == null) {
+                    Utils.systemExit(lastStatus);
+                } else {
+                    return lastStatus;
                 }
+            } catch (Throwable e) {
                 throw RInternalError.shouldNotReachHere(e);
             }
         } finally {
@@ -304,29 +300,19 @@ public class RCommand {
     }
 
     private static boolean doEcho(PolyglotEngine vm) {
-        PolyglotEngine.Value echoValue;
-        try {
-            echoValue = vm.eval(GET_ECHO);
-            emitIO();
-            Object echo = echoValue.get();
-            if (echo instanceof TruffleObject) {
-                RLogicalVector echoVec = echoValue.as(RLogicalVector.class);
-                return RRuntime.fromLogical(echoVec.getDataAt(0));
-            } else if (echo instanceof Byte) {
-                return RRuntime.fromLogical((Byte) echo);
-            } else {
-                throw RInternalError.shouldNotReachHere();
-            }
-        } catch (IOException e) {
-            throw RInternalError.shouldNotReachHere(e);
+        PolyglotEngine.Value echoValue = vm.eval(GET_ECHO);
+        Object echo = echoValue.get();
+        if (echo instanceof TruffleObject) {
+            RLogicalVector echoVec = echoValue.as(RLogicalVector.class);
+            return RRuntime.fromLogical(echoVec.getDataAt(0));
+        } else if (echo instanceof Byte) {
+            return RRuntime.fromLogical((Byte) echo);
+        } else {
+            throw RInternalError.shouldNotReachHere();
         }
     }
 
     private static String getContinuePrompt() {
         return RRuntime.asString(RRuntime.asAbstractVector(RContext.getInstance().stateROptions.getValue("continue")));
     }
-
-    @SuppressWarnings("unused")
-    private static void emitIO() throws IOException {
-    }
 }
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java
index c9425485e9b253815493b6497c059fe66c4e9622..87bb3136b5a4622e005dd1dac3b237a468f268cc 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java
@@ -69,15 +69,11 @@ public class REmbedded {
         RContext.setEmbedded();
         RCmdOptions options = RCmdOptions.parseArguments(RCmdOptions.Client.R, args, true);
         PolyglotEngine vm = RCommand.createPolyglotEngineFromCommandLine(options, true, true, System.in, System.out);
-        try {
-            vm.eval(INIT);
-        } catch (Exception ex) {
-            Utils.rSuicideDefault("initializeR");
-        }
+        vm.eval(INIT);
         return vm;
     }
 
-    private static final Source INIT = RSource.fromTextInternal("1", RSource.Internal.GET_ECHO);
+    private static final Source INIT = RSource.fromTextInternal("invisible(1)", RSource.Internal.GET_ECHO);
 
     /**
      * GnuR distinguishes {@code setup_Rmainloop} and {@code run_Rmainloop}. Currently we don't have
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java
index 4b958b6752fedded1a7364ead804883088535605..13fcd60a65b5652898cc19acc037f1fe03971c64 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java
@@ -302,7 +302,11 @@ public class BasePackage extends RBuiltinPackage {
         add(FastRInspect.class, FastRInspectNodeGen::create);
         add(FastRInterop.Eval.class, FastRInteropFactory.EvalNodeGen::create);
         add(FastRInterop.Export.class, FastRInteropFactory.ExportNodeGen::create);
+        add(FastRInterop.HasSize.class, FastRInteropFactory.HasSizeNodeGen::create);
         add(FastRInterop.Import.class, FastRInteropFactory.ImportNodeGen::create);
+        add(FastRInterop.IsNull.class, FastRInteropFactory.IsNullNodeGen::create);
+        add(FastRInterop.IsExecutable.class, FastRInteropFactory.IsExecutableNodeGen::create);
+        add(FastRInterop.ToBoolean.class, FastRInteropFactory.ToBooleanNodeGen::create);
         add(FastRRefCountInfo.class, FastRRefCountInfoNodeGen::create);
         add(FastRStackTrace.class, FastRStackTraceNodeGen::create);
         add(FastRProfAttr.class, FastRStatsFactory.FastRProfAttrNodeGen::create);
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ceiling.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ceiling.java
index eb47cff18992fa0e9d830703863286b7bbc11c99..6a608d0284b9f13a080b26d1d164abf49fe9f871 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ceiling.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ceiling.java
@@ -28,13 +28,8 @@ import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE;
 import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE;
 
 import com.oracle.truffle.api.dsl.Specialization;
-import com.oracle.truffle.r.nodes.binary.BoxPrimitiveNode;
-import com.oracle.truffle.r.nodes.binary.BoxPrimitiveNodeGen;
 import com.oracle.truffle.r.nodes.builtin.CastBuilder;
-import com.oracle.truffle.r.nodes.builtin.RBuiltinNode;
 import com.oracle.truffle.r.nodes.unary.UnaryArithmeticBuiltinNode;
-import com.oracle.truffle.r.nodes.unary.UnaryArithmeticNode;
-import com.oracle.truffle.r.nodes.unary.UnaryArithmeticNodeGen;
 import com.oracle.truffle.r.runtime.RError;
 import com.oracle.truffle.r.runtime.RType;
 import com.oracle.truffle.r.runtime.builtins.RBuiltin;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java
index 9d17ab954c923876b3a775662c9e13017684985c..4f519e17009281861e026bdcf577a533414c85e7 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java
@@ -28,7 +28,6 @@ import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.instanceOf;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.lte;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.notEmpty;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.nullValue;
-import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.scalarStringValue;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.singleElement;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.stringValue;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.toBoolean;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java
index 9e3fccdf756e31a2ff4b829490a71aa4de9e75bc..eba631239d2e1986450e733ba9c64c1cbf2950e1 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java
@@ -12,16 +12,17 @@
  */
 package com.oracle.truffle.r.nodes.builtin.base;
 
-import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.*;
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.asDoubleVector;
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.complexValue;
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.gte0;
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.notIntNA;
 import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE;
 import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL;
 
 import com.oracle.truffle.api.CompilerDirectives;
-import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.r.nodes.builtin.CastBuilder;
 import com.oracle.truffle.r.nodes.builtin.RBuiltinNode;
-import com.oracle.truffle.r.nodes.unary.CastDoubleNode;
 import com.oracle.truffle.r.runtime.RError;
 import com.oracle.truffle.r.runtime.RError.Message;
 import com.oracle.truffle.r.runtime.RRuntime;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java
index d0566c15a27fa135ed742987b7967b291f9e1cc9..34a92b26828718e505d2967c5a1c17b2151a093b 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java
@@ -26,8 +26,6 @@ import static com.oracle.truffle.r.runtime.RVisibility.CUSTOM;
 import static com.oracle.truffle.r.runtime.builtins.RBehavior.COMPLEX;
 import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL;
 
-import java.beans.Visibility;
-
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Fallback;
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java
index ab91fd790201412079c90d0337515c93aadebe35..687a77fa628553f5705454f3a6573e923303c4a2 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java
@@ -37,14 +37,12 @@ import com.oracle.truffle.r.nodes.builtin.base.Order.CmpNode;
 import com.oracle.truffle.r.nodes.builtin.base.OrderNodeGen.CmpNodeGen;
 import com.oracle.truffle.r.runtime.RRuntime;
 import com.oracle.truffle.r.runtime.builtins.RBuiltin;
-import com.oracle.truffle.r.runtime.data.RComplex;
 import com.oracle.truffle.r.runtime.data.RRaw;
 import com.oracle.truffle.r.runtime.data.model.RAbstractComplexVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector;
 import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
-import com.oracle.truffle.r.runtime.nodes.RBaseNode;
 import com.oracle.truffle.r.runtime.ops.BinaryCompare;
 
 @RBuiltin(name = "is.unsorted", kind = INTERNAL, parameterNames = {"x", "strictly"}, behavior = PURE)
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java
index 3ca5eeb3d2b32b31e1f47423773d0c7122c6110e..7e2307e2fc886f367d6f4af31002cdbd04849a5d 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java
@@ -190,6 +190,6 @@ public abstract class Lapply extends RBuiltinNode {
     }
 
     static SourceSection createCallSourceSection() {
-        return CALL_SOURCE.createSection("", 0, CALL_SOURCE.getLength());
+        return CALL_SOURCE.createSection(0, CALL_SOURCE.getLength());
     }
 }
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java
index 9dc1f6f364579a32c4f7d3082ef1ba375224036f..0e316e77593a9f388daf0fa95bc7ddec0b274daa 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java
@@ -163,7 +163,7 @@ public class LocaleFunctions {
     @RBuiltin(name = "bindtextdomain", kind = PRIMITIVE, parameterNames = {"domain", "dirname"}, behavior = READS_STATE)
     public abstract static class BindTextDomain extends RBuiltinNode {
         @Override
-        protected void createCasts(@SuppressWarnings("unused") CastBuilder casts) {
+        protected void createCasts(CastBuilder casts) {
             casts.arg("domain").mustBe(stringValue(), INVALID_VALUE, "domain");
         }
 
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Merge.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Merge.java
index 212ce2ff32cde9edef3e2a6c0f0550e3770a3d56..b7319d5468976a3587246381b072d32662a2e882 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Merge.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Merge.java
@@ -46,11 +46,11 @@ public abstract class Merge extends RBuiltinNode {
         addLogicalCast(casts, "all.y");
     }
 
-    private void addIntegerCast(CastBuilder casts, String name) {
+    private static void addIntegerCast(CastBuilder casts, String name) {
         casts.arg(name).mustBe(integerValue()).asIntegerVector().mustBe(notEmpty());
     }
 
-    private void addLogicalCast(CastBuilder casts, String name) {
+    private static void addLogicalCast(CastBuilder casts, String name) {
         casts.arg(name).defaultError(INVALID_LOGICAL, "all.x").notNA().mustBe(numericValue()).asLogicalVector().findFirst().map(toBoolean());
     }
 
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 550f3efb3191bf745599764bd3fc6b9f598b0d80..1cab94e1d91f37633935e68c42b0d75b5adf4428 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
@@ -22,14 +22,15 @@
  */
 package com.oracle.truffle.r.nodes.builtin.fastr;
 
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.logicalValue;
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.notLogicalNA;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.singleElement;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.stringValue;
 import static com.oracle.truffle.r.runtime.RVisibility.OFF;
+import static com.oracle.truffle.r.runtime.RVisibility.ON;
 import static com.oracle.truffle.r.runtime.builtins.RBehavior.COMPLEX;
 import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE;
 
-import java.io.IOException;
-
 import com.oracle.truffle.api.CallTarget;
 import com.oracle.truffle.api.CompilerAsserts;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
@@ -38,12 +39,17 @@ import com.oracle.truffle.api.dsl.Cached;
 import com.oracle.truffle.api.dsl.Fallback;
 import com.oracle.truffle.api.dsl.Specialization;
 import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.ForeignAccess;
+import com.oracle.truffle.api.interop.TruffleObject;
 import com.oracle.truffle.api.nodes.DirectCallNode;
+import com.oracle.truffle.api.nodes.Node;
 import com.oracle.truffle.api.source.Source;
 import com.oracle.truffle.r.nodes.builtin.CastBuilder;
+import com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef;
 import com.oracle.truffle.r.nodes.builtin.RBuiltinNode;
 import com.oracle.truffle.r.runtime.RError;
 import com.oracle.truffle.r.runtime.RError.Message;
+import com.oracle.truffle.r.runtime.RRuntime;
 import com.oracle.truffle.r.runtime.RSource;
 import com.oracle.truffle.r.runtime.builtins.RBuiltin;
 import com.oracle.truffle.r.runtime.context.RContext;
@@ -67,10 +73,9 @@ public class FastRInterop {
 
             Source sourceObject = RSource.fromTextInternal(source, RSource.Internal.EVAL_WRAPPER, mimeType);
             try {
-                emitIO();
                 return RContext.getInstance().getEnv().parse(sourceObject);
-            } catch (IOException e) {
-                throw RError.error(this, Message.GENERIC, "Error while parsing: " + e.getMessage());
+            } catch (Throwable t) {
+                throw RError.error(this, Message.GENERIC, "Error while parsing: " + t.getMessage());
             }
         }
 
@@ -92,10 +97,6 @@ public class FastRInterop {
         protected Object eval(String mimeType, String source) {
             return parse(mimeType, source).call();
         }
-
-        @SuppressWarnings("unused")
-        private void emitIO() throws IOException {
-        }
     }
 
     @RBuiltin(name = ".fastr.interop.export", visibility = OFF, kind = PRIMITIVE, parameterNames = {"name", "value"}, behavior = COMPLEX)
@@ -148,4 +149,51 @@ public class FastRInterop {
             return object;
         }
     }
+
+    @RBuiltin(name = ".fastr.interop.hasSize", visibility = ON, kind = PRIMITIVE, parameterNames = {"value"}, behavior = COMPLEX)
+    public abstract static class HasSize extends RBuiltinNode {
+
+        @Child private Node node = com.oracle.truffle.api.interop.Message.HAS_SIZE.createNode();
+
+        @Specialization
+        public byte hasSize(VirtualFrame frame, TruffleObject obj) {
+            return RRuntime.asLogical(ForeignAccess.sendHasSize(node, frame, obj));
+        }
+    }
+
+    @RBuiltin(name = ".fastr.interop.isNull", visibility = ON, kind = PRIMITIVE, parameterNames = {"value"}, behavior = COMPLEX)
+    public abstract static class IsNull extends RBuiltinNode {
+
+        @Child private Node node = com.oracle.truffle.api.interop.Message.IS_NULL.createNode();
+
+        @Specialization
+        public byte hasSize(VirtualFrame frame, TruffleObject obj) {
+            return RRuntime.asLogical(ForeignAccess.sendIsNull(node, frame, obj));
+        }
+    }
+
+    @RBuiltin(name = ".fastr.interop.isExecutable", visibility = ON, kind = PRIMITIVE, parameterNames = {"value"}, behavior = COMPLEX)
+    public abstract static class IsExecutable extends RBuiltinNode {
+
+        @Child private Node node = com.oracle.truffle.api.interop.Message.IS_EXECUTABLE.createNode();
+
+        @Specialization
+        public byte hasSize(VirtualFrame frame, TruffleObject obj) {
+            return RRuntime.asLogical(ForeignAccess.sendIsExecutable(node, frame, obj));
+        }
+    }
+
+    @RBuiltin(name = ".fastr.interop.toBoolean", visibility = ON, kind = PRIMITIVE, parameterNames = {"value"}, behavior = COMPLEX)
+    public abstract static class ToBoolean extends RBuiltinNode {
+
+        @Override
+        protected void createCasts(CastBuilder casts) {
+            casts.arg("value").mustBe(logicalValue()).asLogicalVector().mustBe(singleElement()).findFirst().mustBe(notLogicalNA()).map(Predef.toBoolean());
+        }
+
+        @Specialization
+        public boolean toBoolean(boolean value) {
+            return value;
+        }
+    }
 }
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/builtin/CastBuilderTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/builtin/CastBuilderTest.java
index d744aeb454f874dd4bb7bc1d7863fd94c3933855..a5fda290761b3ae8f4614e466a4e0bc84757dcb1 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/builtin/CastBuilderTest.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/builtin/CastBuilderTest.java
@@ -22,12 +22,13 @@
  */
 package com.oracle.truffle.r.nodes.builtin;
 
-import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.*;
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.asLogicalVector;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.asStringVector;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.chain;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.complexValue;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.constant;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.defaultValue;
+import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleNA;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleToInt;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.elementAt;
@@ -54,8 +55,8 @@ import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.stringValue;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.toBoolean;
 import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.trueValue;
 import static com.oracle.truffle.r.nodes.casts.CastUtils.samples;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.function.Function;
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/PredefMappersSamplers.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/PredefMappersSamplers.java
index 172f30fa5348957ca63470f4ccd4d8659dad26a8..f69fe0e8fed66d1f304fa673968f7a186cc67ce7 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/PredefMappersSamplers.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/PredefMappersSamplers.java
@@ -27,7 +27,6 @@ import static com.oracle.truffle.r.nodes.casts.CastUtils.samples;
 import java.util.Collections;
 
 import com.oracle.truffle.api.profiles.ConditionProfile;
-import com.oracle.truffle.r.nodes.builtin.ValuePredicateArgumentMapper;
 import com.oracle.truffle.r.nodes.builtin.CastBuilder.PredefMappers;
 import com.oracle.truffle.r.runtime.RRuntime;
 import com.oracle.truffle.r.runtime.data.RNull;
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java
index 8b18fe730b9297c447db7f0e754c47c8ebafc0fc..3c1dd496b88afdae9c2fd84a077a01eb362aa8d5 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java
@@ -308,18 +308,9 @@ class ChimneySweeping extends SingleBuiltinDiagnostics {
     }
 
     private static RList evalValidArgs(String argsExpr, PolyglotEngine vm) {
-        try {
-            Value eval = vm.eval(RSource.fromTextInternal(argsExpr, RSource.Internal.UNIT_TEST));
-            RList args = (RList) eval.get();
-            return args;
-        } catch (Exception e) {
-            if (e instanceof RuntimeException) {
-                throw (RuntimeException) e;
-            }
-            // throw new RuntimeException(e);
-            // todo: warning
-            return null;
-        }
+        Value eval = vm.eval(RSource.fromTextInternal(argsExpr, RSource.Internal.UNIT_TEST));
+        RList args = (RList) eval.get();
+        return args;
     }
 
     private void sweepChimney() throws IOException {
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java
index abd1f3fab05b824fbd86294ccaff489811b72ba1..165d82b54741d68a4aa4cea03fd583bc4c8f9b45 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java
@@ -22,8 +22,6 @@
  */
 package com.oracle.truffle.r.nodes.test;
 
-import java.io.IOException;
-
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
@@ -39,7 +37,7 @@ public class TestBase {
     static RContext testVMContext;
 
     @BeforeClass
-    public static void setupClass() throws IOException {
+    public static void setupClass() {
         testVM = FastRSession.create().createTestContext(null);
         testVMContext = testVM.eval(FastRSession.GET_CONTEXT).as(RContext.class);
     }
@@ -48,7 +46,7 @@ public class TestBase {
     private static final Source CLEAR_WARNINGS = RSource.fromTextInternal("assign('last.warning', NULL, envir = baseenv())", RSource.Internal.CLEAR_WARNINGS);
 
     @AfterClass
-    public static void finishClass() throws IOException {
+    public static void finishClass() {
         testVM.eval(CLEAR_WARNINGS);
         testVM.dispose();
     }
diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java
index 06517db953cda1e7de5b47a578c606539a8a7a41..80bf53c93e4ed277799a2abe8485b1a1ca59694e 100644
--- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java
+++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestUtilities.java
@@ -22,10 +22,6 @@
  */
 package com.oracle.truffle.r.nodes.test;
 
-import java.io.Closeable;
-import java.io.IOException;
-
-import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.RootCallTarget;
 import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.api.TruffleLanguage;
@@ -37,6 +33,7 @@ import com.oracle.truffle.r.runtime.RRuntime;
 import com.oracle.truffle.r.runtime.RType;
 import com.oracle.truffle.r.runtime.ReturnException;
 import com.oracle.truffle.r.runtime.context.RContext;
+import com.oracle.truffle.r.runtime.context.RContext.RCloseable;
 import com.oracle.truffle.r.runtime.data.RComplex;
 import com.oracle.truffle.r.runtime.data.RDataFactory;
 import com.oracle.truffle.r.runtime.data.RNull;
@@ -184,11 +181,8 @@ public class TestUtilities {
 
         @SuppressWarnings("try")
         public Object call(Object... args) {
-            try (Closeable c = RContext.withinContext(TestBase.testVMContext)) {
+            try (RCloseable c = RContext.withinContext(TestBase.testVMContext)) {
                 return target.call(RArguments.createUnitialized((Object) args));
-            } catch (IOException e) {
-                CompilerDirectives.transferToInterpreter();
-                throw new RuntimeException(e);
             }
         }
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java
index d9d3c1c69ac25b7d6d66ef876a35b4a37152f71c..d742b9e346509b831e108119b8b66a3c8e106e87 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.nodes.access;
 
 import com.oracle.truffle.api.CompilerAsserts;
 import com.oracle.truffle.api.frame.VirtualFrame;
+import com.oracle.truffle.api.interop.TruffleObject;
 import com.oracle.truffle.api.source.SourceSection;
 import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode;
 import com.oracle.truffle.r.runtime.RRuntime;
@@ -96,7 +97,7 @@ public abstract class ConstantNode extends RSourceSectionNode implements RSyntax
             // this can be created during argument matching and "call"
             return new ConstantObjectNode(sourceSection, value);
         } else {
-            assert value instanceof RTypedValue && !(value instanceof RPromise) : value;
+            assert value instanceof TruffleObject || value instanceof RTypedValue && !(value instanceof RPromise) : value;
             return new ConstantObjectNode(sourceSection, value);
         }
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java
index d8702da5ed28f7c372df37b4deae5bf59fd615fe..a5b0e8b09d146cce00b291d4f37cd2462d34a758 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java
@@ -33,7 +33,6 @@ import com.oracle.truffle.r.runtime.RError;
 import com.oracle.truffle.r.runtime.RSerialize.State;
 import com.oracle.truffle.r.runtime.RType;
 import com.oracle.truffle.r.runtime.Utils;
-import com.oracle.truffle.r.runtime.context.RContext;
 import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
 import com.oracle.truffle.r.runtime.data.RMissing;
 import com.oracle.truffle.r.runtime.nodes.RNode;
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java
index 22812156efd82ae05301d1810c8419664093ae27..fc91a9d69277994c0b9e909950283645ce98bd14 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java
@@ -135,13 +135,13 @@ public abstract class ExtractVectorNode extends Node {
     }
 
     @Specialization(guards = {"cached != null", "cached.isSupported(vector, positions)"})
-    protected Object doReplaceSameDimensions(VirtualFrame frame, RAbstractVector vector, Object[] positions, Object exact, Object dropDimensions,  //
+    protected Object doExtractSameDimensions(VirtualFrame frame, RAbstractVector vector, Object[] positions, Object exact, Object dropDimensions,  //
                     @Cached("createRecursiveCache(vector, positions)") RecursiveExtractSubscriptNode cached) {
         return cached.apply(frame, vector, positions, exact, dropDimensions);
     }
 
     @Specialization(guards = {"cached != null", "cached.isSupported(vector, positions)"})
-    protected Object doReplaceRecursive(VirtualFrame frame, RAbstractListVector vector, Object[] positions, Object exact, Object dropDimensions,  //
+    protected Object doExtractRecursive(VirtualFrame frame, RAbstractListVector vector, Object[] positions, Object exact, Object dropDimensions,  //
                     @Cached("createRecursiveCache(vector, positions)") RecursiveExtractSubscriptNode cached) {
         return cached.apply(frame, vector, positions, exact, dropDimensions);
     }
@@ -158,7 +158,7 @@ public abstract class ExtractVectorNode extends Node {
     }
 
     @Specialization(limit = "CACHE_LIMIT", guards = {"cached != null", "cached.isSupported(vector, positions, exact, dropDimensions)"})
-    protected Object doReplaceDefaultCached(Object vector, Object[] positions, Object exact, Object dropDimensions,  //
+    protected Object doExtractDefaultCached(Object vector, Object[] positions, Object exact, Object dropDimensions,  //
                     @Cached("createDefaultCache(getThis(), vector, positions, exact, dropDimensions)") CachedExtractVectorNode cached) {
         assert !isRecursiveSubscript(vector, positions);
         return cached.apply(vector, positions, null, exact, dropDimensions);
@@ -168,9 +168,9 @@ public abstract class ExtractVectorNode extends Node {
         return new CachedExtractVectorNode(node.getMode(), (RTypedValue) vector, positions, (RTypedValue) exact, (RTypedValue) dropDimensions, node.recursive);
     }
 
-    @Specialization(contains = "doReplaceDefaultCached")
+    @Specialization(contains = "doExtractDefaultCached")
     @TruffleBoundary
-    protected Object doReplaceDefaultGeneric(Object vector, Object[] positions, Object exact, Object dropDimensions,  //
+    protected Object doExtractDefaultGeneric(Object vector, Object[] positions, Object exact, Object dropDimensions,  //
                     @Cached("new(createDefaultCache(getThis(), vector, positions, exact, dropDimensions))") GenericVectorExtractNode generic) {
         return generic.get(this, vector, positions, exact, dropDimensions).apply(vector, positions, null, exact, dropDimensions);
     }
diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java
index f8957c71776a168ff2b5d7c94bf001b80d086989..5fc03e937e0d3d1a82a0ed368d9f92bec13c6bcf 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ReplaceVectorNode.java
@@ -110,15 +110,19 @@ public abstract class ReplaceVectorNode extends Node {
         }
         Object position = positions[0];
         try {
-            if (position instanceof String || position instanceof Double || position instanceof Integer) {
+            if (position instanceof Integer) {
+                return ForeignAccess.send(foreignRead, frame, object, new Object[]{((Integer) position) - 1, writtenValue});
+            } else if (position instanceof Double) {
+                return ForeignAccess.send(foreignRead, frame, object, new Object[]{((Double) position) - 1, writtenValue});
+            } else if (position instanceof String) {
                 return ForeignAccess.send(foreignRead, frame, object, new Object[]{position, writtenValue});
             } else if (position instanceof RAbstractStringVector) {
                 String string = firstString.executeString(castNode.execute(position));
                 return ForeignAccess.send(foreignRead, frame, object, new Object[]{string, writtenValue});
             } else if (position instanceof RAbstractDoubleVector) {
-                return ForeignAccess.send(foreignRead, frame, object, new Object[]{((RAbstractDoubleVector) position).getDataAt(0), writtenValue});
+                return ForeignAccess.send(foreignRead, frame, object, new Object[]{((RAbstractDoubleVector) position).getDataAt(0) - 1, writtenValue});
             } else if (position instanceof RAbstractIntVector) {
-                return ForeignAccess.send(foreignRead, frame, object, new Object[]{((RAbstractIntVector) position).getDataAt(0), writtenValue});
+                return ForeignAccess.send(foreignRead, frame, object, new Object[]{((RAbstractIntVector) position).getDataAt(0) - 1, writtenValue});
             } else {
                 throw RError.error(this, RError.Message.GENERIC, "invalid index during foreign access");
             }
diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
index cc9aa1d5be5ec95f4d7f494dfcb86d592f2c67ee..10f29d6e52e460c9dddc810fe394abe84264f7c1 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ParserGeneration.java
@@ -81,6 +81,7 @@ public class ParserGeneration {
         "transform parser to a generic class via the annotation processor",
         "use RComplex.createNA()",
         "inlined ParseUtils",
-        "properly throw errors in lexer"
+        "properly throw errors in lexer",
+        "remove deprecated calls to SourceSection functions"
     };
 }
diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
index df8ab94e9a4bd4b75dc52cc178dffb4c2c0f856e..f68e5c59501e9b2913c6fd1934bedc53969ceb59 100644
--- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
+++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g
@@ -90,7 +90,7 @@ package com.oracle.truffle.r.parser;
     private SourceSection src(Token t) {
         CommonToken token = (CommonToken) t;
         int startIndex = token.getStartIndex();
-        return source.createSection(null, token.getLine(), token.getCharPositionInLine() + 1, startIndex, token.getStopIndex() - startIndex + 1);
+        return source.createSection(token.getLine(), token.getCharPositionInLine() + 1, startIndex, token.getStopIndex() - startIndex + 1);
     }
     
     /**
@@ -102,7 +102,7 @@ package com.oracle.truffle.r.parser;
         int startIndex = cstart.getStartIndex();
         int stopIndex = cstop.getStopIndex();
         int length = stopIndex - startIndex + (cstop.getType() == Token.EOF ? 0 : 1);
-        return source.createSection(null, cstart.getLine(), cstart.getCharPositionInLine() + 1, startIndex, length);
+        return source.createSection(cstart.getLine(), cstart.getCharPositionInLine() + 1, startIndex, length);
     }
 
 	// without this override, the parser will not throw exceptions if it can recover    
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java
index 50a18c02504f470cbfb08d67dc5d3fba23b240de..065806b2fccacffc006817fc0a33d1f2d6b0e08c 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java
@@ -21,6 +21,7 @@ import java.util.Map;
 
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
+import com.oracle.truffle.api.interop.TruffleObject;
 import com.oracle.truffle.api.source.Source;
 import com.oracle.truffle.api.source.SourceSection;
 import com.oracle.truffle.r.runtime.context.RContext;
@@ -343,7 +344,7 @@ public class RDeparse {
         public void fixupSources() {
             Source source = RSource.fromTextInternal(sb.toString(), RSource.Internal.DEPARSE);
             for (SourceSectionElement s : sources) {
-                s.element.setSourceSection(source.createSection(null, s.start, s.length));
+                s.element.setSourceSection(source.createSection(s.start, s.length));
             }
         }
 
@@ -636,6 +637,8 @@ public class RDeparse {
                     append("<pointer: 0x").append(Long.toHexString(((RExternalPtr) value).getAddr())).append('>');
                 } else if (value instanceof REnvironment) {
                     append("<environment>");
+                } else if (value instanceof TruffleObject) {
+                    append("<truffle object>");
                 } else {
                     throw RInternalError.shouldNotReachHere("unexpected: " + value);
                 }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java
index 26ada32c6060df9adc60f7772ce416e6014c8ce5..810c2b1c7df64a367de57067ce04417090c05786 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/ContextInfo.java
@@ -28,7 +28,6 @@ import java.util.concurrent.atomic.AtomicInteger;
 import com.oracle.truffle.api.interop.ForeignAccess;
 import com.oracle.truffle.api.interop.TruffleObject;
 import com.oracle.truffle.api.vm.PolyglotEngine;
-import com.oracle.truffle.r.runtime.RInternalError;
 import com.oracle.truffle.r.runtime.RStartParams;
 import com.oracle.truffle.r.runtime.context.RContext.ContextKind;
 
@@ -91,11 +90,7 @@ public final class ContextInfo implements TruffleObject {
     }
 
     public static ContextInfo getContextInfo(PolyglotEngine vm) {
-        try {
-            return (ContextInfo) vm.findGlobalSymbol(ContextInfo.GLOBAL_SYMBOL).get();
-        } catch (Exception ex) {
-            throw RInternalError.shouldNotReachHere();
-        }
+        return (ContextInfo) vm.findGlobalSymbol(ContextInfo.GLOBAL_SYMBOL).get();
     }
 
     public RStartParams getStartParams() {
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java
index 65a1276ab338a630623ea85fb64d14236bad21ab..330f46c849ec03ab2e440a41f1ca7cba95e70e8c 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java
@@ -22,7 +22,6 @@
  */
 package com.oracle.truffle.r.runtime.context;
 
-import java.io.IOException;
 import java.util.Map;
 
 import com.oracle.truffle.api.CallTarget;
@@ -42,7 +41,7 @@ import com.oracle.truffle.r.runtime.nodes.RNode;
 
 public interface Engine {
 
-    class ParseException extends IOException {
+    class ParseException extends RuntimeException {
         private static final long serialVersionUID = 1L;
 
         private final Source source;
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 1184323bbc096d7d44bf14011f5f44f38d0b75f3..80111d53d511755e0c67b05f74c6dbaf75a8d96f 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
@@ -23,7 +23,6 @@
 package com.oracle.truffle.r.runtime.context;
 
 import java.io.Closeable;
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.TimeZone;
@@ -194,8 +193,8 @@ public final class RContext extends ExecutionContext implements TruffleObject {
             PolyglotEngine vm = info.createVM();
             try {
                 setContext(vm.eval(GET_CONTEXT).as(RContext.class));
-            } catch (Exception e1) {
-                throw new RInternalError(e1, "error while initializing eval thread");
+            } catch (Throwable t) {
+                throw new RInternalError(t, "error while initializing eval thread");
             }
             try {
                 evalResult = run(vm, info, source);
@@ -216,17 +215,13 @@ public final class RContext extends ExecutionContext implements TruffleObject {
             } catch (ParseException e) {
                 e.report(info.getConsoleHandler());
                 evalResult = createErrorResult(e.getMessage());
-            } catch (IOException e) {
-                Throwable cause = e.getCause();
-                if (cause instanceof ExitException) {
-                    // termination, treat this as "success"
-                    ExitException exitException = (ExitException) cause;
-                    evalResult = RDataFactory.createList(new Object[]{exitException.getStatus()});
-                } else {
-                    // some internal error
-                    RInternalError.reportErrorAndConsoleLog(cause, info.getConsoleHandler(), info.getId());
-                    evalResult = createErrorResult(cause.getClass().getSimpleName());
-                }
+            } catch (ExitException e) {
+                // termination, treat this as "success"
+                evalResult = RDataFactory.createList(new Object[]{e.getStatus()});
+            } catch (Throwable t) {
+                // some internal error
+                RInternalError.reportErrorAndConsoleLog(t, info.getConsoleHandler(), info.getId());
+                evalResult = createErrorResult(t.getClass().getSimpleName());
             }
             return evalResult;
         }
@@ -235,7 +230,7 @@ public final class RContext extends ExecutionContext implements TruffleObject {
          * The result is an {@link RList} contain the value, plus an "error" attribute if the
          * evaluation resulted in an error.
          */
-        private static RList createEvalResult(PolyglotEngine.Value resultValue) throws IOException {
+        private static RList createEvalResult(PolyglotEngine.Value resultValue) {
             Object result = resultValue.get();
             Object listResult = result;
             String error = null;
@@ -773,11 +768,16 @@ public final class RContext extends ExecutionContext implements TruffleObject {
         throw new IllegalStateException("cannot access " + RContext.class.getSimpleName() + " via Truffle");
     }
 
+    public interface RCloseable extends Closeable {
+        @Override
+        void close();
+    }
+
     @TruffleBoundary
-    public static Closeable withinContext(RContext context) {
+    public static RCloseable withinContext(RContext context) {
         RContext oldContext = RContext.threadLocalContext.get();
         RContext.threadLocalContext.set(context);
-        return new Closeable() {
+        return new RCloseable() {
             @Override
             public void close() {
                 RContext.threadLocalContext.set(oldContext);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/MemoryCopyTracer.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/MemoryCopyTracer.java
index f6e7cabae776ea3598ae3034f6ee4da2ee799ca1..ecba6aeb9d75ef8362287e2d6d3da379319ec767 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/MemoryCopyTracer.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/MemoryCopyTracer.java
@@ -26,8 +26,8 @@ package com.oracle.truffle.r.runtime.data;
 import java.util.Deque;
 import java.util.concurrent.ConcurrentLinkedDeque;
 
-import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
-import com.oracle.truffle.api.utilities.CyclicAssumption;
+import com.oracle.truffle.api.Assumption;
+import com.oracle.truffle.api.Truffle;
 import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
 
 /**
@@ -38,9 +38,9 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
  */
 public final class MemoryCopyTracer {
     private static Deque<Listener> listeners = new ConcurrentLinkedDeque<>();
-    @CompilationFinal private static boolean enabled;
+    private static boolean enabled;
 
-    private static final CyclicAssumption noMemoryCopyTracingAssumption = new CyclicAssumption("data copying");
+    private static final Assumption noMemoryCopyTracingAssumption = Truffle.getRuntime().createAssumption("data copy tracing");
 
     private MemoryCopyTracer() {
         // only static methods
@@ -59,7 +59,9 @@ public final class MemoryCopyTracer {
      */
     public static void setTracingState(boolean newState) {
         if (enabled != newState) {
-            noMemoryCopyTracingAssumption.invalidate();
+            if (newState) {
+                noMemoryCopyTracingAssumption.invalidate();
+            }
             enabled = newState;
         }
     }
@@ -69,7 +71,7 @@ public final class MemoryCopyTracer {
      * no-op.
      */
     public static void reportCopying(RAbstractVector source, RAbstractVector dest) {
-        if (enabled) {
+        if (!noMemoryCopyTracingAssumption.isValid() && enabled) {
             for (Listener listener : listeners) {
                 listener.reportCopying(source, dest);
             }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java
index ac2cfe029130c6db14079f91223bc1a623d59354..78d14bfe190f6d1ef96df7765e8648099643c250 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java
@@ -42,7 +42,7 @@ public interface RSyntaxLookup extends RSyntaxElement {
      * section.
      */
     static RSyntaxLookup createDummyLookup(SourceSection originalSource, String identifier, boolean isFunctionLookup) {
-        SourceSection source = originalSource == null || originalSource.getSource() == null ? null : originalSource.getSource().createSection(null, originalSource.getCharIndex(), 1);
+        SourceSection source = originalSource == null || originalSource.getSource() == null ? null : originalSource.getSource().createSection(originalSource.getCharIndex(), 1);
         return new RSyntaxLookup() {
             @Override
             public SourceSection getSourceSection() {
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 7a2e66057d0a81aba32d486120cc75937c8537f1..42be7487ee7588a5bab9c9392b18c2512e3d3cb2 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
@@ -22,7 +22,6 @@
  */
 package com.oracle.truffle.r.test.generate;
 
-import java.io.IOException;
 import java.util.ArrayDeque;
 import java.util.Arrays;
 import java.util.Deque;
@@ -38,8 +37,8 @@ import com.oracle.truffle.r.runtime.RCmdOptions;
 import com.oracle.truffle.r.runtime.RCmdOptions.Client;
 import com.oracle.truffle.r.runtime.RError;
 import com.oracle.truffle.r.runtime.RInternalError;
-import com.oracle.truffle.r.runtime.RStartParams;
 import com.oracle.truffle.r.runtime.RSource;
+import com.oracle.truffle.r.runtime.RStartParams;
 import com.oracle.truffle.r.runtime.context.ConsoleHandler;
 import com.oracle.truffle.r.runtime.context.ContextInfo;
 import com.oracle.truffle.r.runtime.context.Engine.IncompleteSourceException;
@@ -161,12 +160,7 @@ public final class FastRSession implements RSession {
             RStartParams params = new RStartParams(RCmdOptions.parseArguments(Client.RSCRIPT, new String[]{"--no-restore"}, false), false);
             ContextInfo info = ContextInfo.create(params, ContextKind.SHARE_NOTHING, null, consoleHandler);
             main = info.createVM();
-            try {
-                mainContext = main.eval(GET_CONTEXT).as(RContext.class);
-                emitIO();
-            } catch (IOException e) {
-                throw new RuntimeException("error while retrieving test context", e);
-            }
+            mainContext = main.eval(GET_CONTEXT).as(RContext.class);
         } finally {
             System.out.print(consoleHandler.buffer.toString());
         }
@@ -242,10 +236,18 @@ public final class FastRSession implements RSession {
                         while (input != null) {
                             Source source = RSource.fromTextInternal(input, RSource.Internal.UNIT_TEST);
                             try {
-                                vm.eval(source);
+                                try {
+                                    vm.eval(source);
+                                    // checked exceptions are wrapped in RuntimeExceptions
+                                } catch (RuntimeException e) {
+                                    if (e.getCause() instanceof com.oracle.truffle.api.vm.IncompleteSourceException) {
+                                        throw e.getCause().getCause();
+                                    } else {
+                                        throw e;
+                                    }
+                                }
                                 input = consoleHandler.readLine();
-                                emitIO();
-                            } catch (IncompleteSourceException | com.oracle.truffle.api.vm.IncompleteSourceException e) {
+                            } catch (IncompleteSourceException e) {
                                 String additionalInput = consoleHandler.readLine();
                                 if (additionalInput == null) {
                                     throw e;
@@ -258,23 +260,16 @@ public final class FastRSession implements RSession {
                     }
                 } catch (ParseException e) {
                     e.report(consoleHandler);
+                } catch (RError e) {
+                    // nothing to do
                 } catch (Throwable t) {
-                    if (t instanceof IOException) {
-                        if (t.getCause() instanceof RError || t.getCause() instanceof RInternalError) {
-                            t = t.getCause();
+                    if (!TestBase.ProcessFailedTests) {
+                        if (t instanceof RInternalError) {
+                            RInternalError.reportError(t);
                         }
+                        t.printStackTrace();
                     }
-                    if (t instanceof RError) {
-                        // nothing to do
-                    } else {
-                        if (!TestBase.ProcessFailedTests) {
-                            if (t instanceof RInternalError) {
-                                RInternalError.reportError(t);
-                            }
-                            t.printStackTrace();
-                        }
-                        killedByException = t;
-                    }
+                    killedByException = t;
                 } finally {
                     exit.release();
                 }
@@ -286,8 +281,4 @@ public final class FastRSession implements RSession {
     public String name() {
         return "FastR";
     }
-
-    @SuppressWarnings("unused")
-    static void emitIO() throws IOException {
-    }
 }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java
index e86035f0b5d6a2565caa9adb7120f1fd45cae09a..e0abfe258f94291554d929f9d179709c3cca2a23 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java
@@ -37,24 +37,23 @@ import org.junit.Before;
 import org.junit.Test;
 
 import com.oracle.truffle.api.debug.Debugger;
-import com.oracle.truffle.api.debug.ExecutionEvent;
 import com.oracle.truffle.api.debug.SuspendedEvent;
 import com.oracle.truffle.api.frame.FrameSlot;
 import com.oracle.truffle.api.frame.MaterializedFrame;
 import com.oracle.truffle.api.source.LineLocation;
 import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.vm.EventConsumer;
 import com.oracle.truffle.api.vm.PolyglotEngine;
 import com.oracle.truffle.api.vm.PolyglotEngine.Value;
 import com.oracle.truffle.r.runtime.RSource;
 import com.oracle.truffle.r.runtime.data.RPromise.EagerPromiseBase;
 
+@SuppressWarnings("deprecation")
 public class FastRDebugTest {
     private Debugger debugger;
     private final LinkedList<Runnable> run = new LinkedList<>();
     private SuspendedEvent suspendedEvent;
     private Throwable ex;
-    private ExecutionEvent executionEvent;
+    private com.oracle.truffle.api.debug.ExecutionEvent executionEvent;
     protected PolyglotEngine engine;
     protected final ByteArrayOutputStream out = new ByteArrayOutputStream();
     protected final ByteArrayOutputStream err = new ByteArrayOutputStream();
@@ -63,22 +62,23 @@ public class FastRDebugTest {
     public void before() {
         suspendedEvent = null;
         executionEvent = null;
-        engine = PolyglotEngine.newBuilder().setOut(out).setErr(err).onEvent(new EventConsumer<ExecutionEvent>(ExecutionEvent.class) {
-            @Override
-            protected void on(ExecutionEvent event) {
-                executionEvent = event;
-                debugger = executionEvent.getDebugger();
-                performWork();
-                executionEvent = null;
-            }
-        }).onEvent(new EventConsumer<SuspendedEvent>(SuspendedEvent.class) {
-            @Override
-            protected void on(SuspendedEvent event) {
-                suspendedEvent = event;
-                performWork();
-                suspendedEvent = null;
-            }
-        }).build();
+        engine = PolyglotEngine.newBuilder().setOut(out).setErr(err).onEvent(
+                        new com.oracle.truffle.api.vm.EventConsumer<com.oracle.truffle.api.debug.ExecutionEvent>(com.oracle.truffle.api.debug.ExecutionEvent.class) {
+                            @Override
+                            protected void on(com.oracle.truffle.api.debug.ExecutionEvent event) {
+                                executionEvent = event;
+                                debugger = executionEvent.getDebugger();
+                                performWork();
+                                executionEvent = null;
+                            }
+                        }).onEvent(new com.oracle.truffle.api.vm.EventConsumer<SuspendedEvent>(SuspendedEvent.class) {
+                            @Override
+                            protected void on(SuspendedEvent event) {
+                                suspendedEvent = event;
+                                performWork();
+                                suspendedEvent = null;
+                            }
+                        }).build();
         run.clear();
     }
 
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRTckTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRTckTest.java
index 052bb9952ff78faedf34362eadf9de5d9464a11f..e8b14d8fe62005c4714bd2b54f68223ae82c5797 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRTckTest.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRTckTest.java
@@ -44,33 +44,26 @@ public class FastRTckTest extends TruffleTCK {
         "fourtyTwo <- function() {\n" +
         "  42L\n" +
         "}\n" +
-        ".fastr.interop.export('fourtyTwo', fourtyTwo)\n" +
         "plus <- function(a, b) {\n" +
         "  a + b\n" +
         "}\n" +
-        ".fastr.interop.export('plus', plus)\n" +
         "identity <- function(a) {\n" +
         "  a\n" +
         "}\n" +
-        ".fastr.interop.export('identity', identity)\n" +
         "apply <- function(f) {\n" +
         "  f(18L, 32L) + 10L\n" +
         "}\n" +
-        ".fastr.interop.export('apply', apply)\n" +
         "null <- function() {\n" +
         "  NULL\n" +
         "}\n" +
-        ".fastr.interop.export('null', null)\n" +
         "counter <- 0L\n" +
         "count <- function() {\n" +
         "  counter <<- counter + 1L\n" +
         "}\n" +
-        ".fastr.interop.export('count', count)\n" +
         "complexAdd <- function(a, b) {\n" +
         " a$imaginary <- a$imaginary + b$imaginary\n" +
         " a$real <- a$real + b$real\n" +
         "}\n" +
-        ".fastr.interop.export('complexAdd', complexAdd)\n" +
         "countUpWhile <- function(fn) {\n" +
         " counter <- 0\n" +
         " while (T) {\n" +
@@ -80,7 +73,6 @@ public class FastRTckTest extends TruffleTCK {
         "  counter <- counter + 1\n" +
         " }\n" +
         "}\n" +
-        ".fastr.interop.export('countUpWhile', countUpWhile)\n" +
         "complexSumReal <- function(a) {\n" +
         " sum <- 0\n" +
         " for (i in 1:length(a)) {\n" +
@@ -88,18 +80,61 @@ public class FastRTckTest extends TruffleTCK {
         " }\n" +
         " return(sum)\n" +
         "}\n" +
-        ".fastr.interop.export('complexSumReal', complexSumReal)\n" +
         "complexCopy <- function(a, b) {\n" +
         " for (i in 0:(length(b)-1)) {\n" +
         "   a[i]$real <- b[i]$real\n" +
         "   a[i]$imaginary <- b[i]$imaginary\n" +
         " }\n" +
         "}\n" +
-        ".fastr.interop.export('complexCopy', complexCopy)\n" +
         "valuesObject <- function() {\n" +
         "  list('byteValue'=0L, 'shortValue'=0L, 'intValue'=0L, 'longValue'=0L, 'floatValue'=0, 'doubleValue'=0, 'charValue'=48L, 'stringValue'='', 'booleanValue'=FALSE)\n" +
         "}\n" +
-        ".fastr.interop.export('valuesObject', valuesObject)\n",
+        "addNumbersFunction <- function() {\n" +
+        "  function(a, b) a + b\n" +
+        "}\n" +
+        "objectWithValueProperty <- function() {\n" +
+        "  list(value = 42L)\n" +
+        "}\n" +
+        "callFunction <- function(f) {\n" +
+        "  f(41L, 42L)\n" +
+        "}\n" +
+        "objectWithElement <- function(f) {\n" +
+        "  c(0L, 0L, 42L, 0L)\n" +
+        "}\n" +
+        "objectWithValueAndAddProperty <- function(f) {\n" +
+        "  e <- new.env()\n" +
+        "  e$value <- 0L\n" +
+        "  e$add <- function(inc) { e$value <- e$value + inc; e$value }\n" +
+        "  e\n" +
+        "}\n" +
+        "callMethod <- function(f) {\n" +
+        "  f(41L, 42L)\n" +
+        "}\n" +
+        "readElementFromForeign <- function(f) {\n" +
+        "  f[[3L]]\n" +
+        "}\n" +
+        "writeElementToForeign <- function(f) {\n" +
+        "  f[[3L]] <- 42L\n" +
+        "}\n" +
+        "readValueFromForeign <- function(o) {\n" +
+        "  o$value\n" +
+        "}\n" +
+        "writeValueToForeign <- function(o) {\n" +
+        "  o$value <- 42L\n" +
+        "}\n" +
+        "getSizeOfForeign <- function(o) {\n" +
+        "  length(o)\n" +
+        "}\n" +
+        "isNullOfForeign <- function(o) {\n" +
+        "  .fastr.interop.toBoolean(.fastr.interop.isNull(o))\n" +
+        "}\n" +
+        "hasSizeOfForeign <- function(o) {\n" +
+        "  .fastr.interop.toBoolean(.fastr.interop.hasSize(o))\n" +
+        "}\n" +
+        "isExecutableOfForeign <- function(o) {\n" +
+        "  .fastr.interop.toBoolean(.fastr.interop.isExecutable(o))\n" +
+        "}\n" +
+        "for (name in ls()) .fastr.interop.export(name, get(name))\n",
         RSource.Internal.TCK_INIT
     );
     // @formatter:on
@@ -186,32 +221,92 @@ public class FastRTckTest extends TruffleTCK {
     }
 
     @Override
-    public void readWriteBooleanValue() throws Exception {
-        // TODO not yet supported
+    protected String getSizeOfForeign() {
+        return "getSizeOfForeign";
     }
 
     @Override
-    public void readWriteDoubleValue() throws Exception {
-        // TODO not yet supported
+    protected String isNullForeign() {
+        return "isNullOfForeign";
     }
 
     @Override
-    public void readWriteCharValue() throws Exception {
+    protected String hasSizeOfForeign() {
+        return "hasSizeOfForeign";
+    }
+
+    @Override
+    protected String isExecutableOfForeign() {
+        return "isExecutableOfForeign";
+    }
+
+    @Override
+    protected String readValueFromForeign() {
+        return "readValueFromForeign";
+    }
+
+    @Override
+    protected String writeValueToForeign() {
+        return "writeValueToForeign";
+    }
+
+    @Override
+    protected String callFunction() {
+        return "callFunction";
+    }
+
+    @Override
+    protected String objectWithElement() {
+        return "objectWithElement";
+    }
+
+    @Override
+    protected String objectWithValueAndAddProperty() {
+        return "objectWithValueAndAddProperty";
+    }
+
+    @Override
+    protected String callMethod() {
+        return "callMethod";
+    }
+
+    @Override
+    protected String readElementFromForeign() {
+        return "readElementFromForeign";
+    }
+
+    @Override
+    protected String writeElementToForeign() {
+        return "writeElementToForeign";
+    }
+
+    @Override
+    protected String objectWithValueProperty() {
+        return "objectWithValueProperty";
+    }
+
+    @Override
+    protected String functionAddNumbers() {
+        return "addNumbersFunction";
+    }
+
+    @Override
+    public void readWriteBooleanValue() throws Exception {
         // TODO not yet supported
     }
 
     @Override
-    public void readWriteShortValue() throws Exception {
+    public void readWriteCharValue() throws Exception {
         // TODO not yet supported
     }
 
     @Override
-    public void readWriteByteValue() throws Exception {
+    public void readWriteShortValue() throws Exception {
         // TODO not yet supported
     }
 
     @Override
-    public void readWriteIntValue() throws Exception {
+    public void readWriteByteValue() throws Exception {
         // TODO not yet supported
     }
 
@@ -356,6 +451,21 @@ public class FastRTckTest extends TruffleTCK {
         // TODO determine the semantics of assignments to a[i]$b
     }
 
+    @Override
+    public void testWriteToObjectWithElement() throws Exception {
+        // TODO mismatch between mutable and immutable data types
+    }
+
+    @Override
+    public void testObjectWithValueAndAddProperty() throws Exception {
+        // TODO mismatch between mutable and immutable data types
+    }
+
+    @Override
+    public void testCallMethod() throws Exception {
+        // R does not have method calls
+    }
+
     @Override
     public String multiplyCode(String firstName, String secondName) {
         return firstName + '*' + secondName;
diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py
index dbe721a506b23a2fad6ca35af146a483d0e7014c..cf642078d3a7856e753a28b1bd0f116b95ad035d 100644
--- a/mx.fastr/suite.py
+++ b/mx.fastr/suite.py
@@ -28,7 +28,7 @@ suite = {
     "suites" : [
             {
                "name" : "truffle",
-               "version" : "bd163128ec958b97ebc68b33ac5b4fae376a37b5",
+               "version" : "1f58e18213f81758f48b04a08a098780e438b432",
                "urls" : [
                     {"url" : "https://github.com/graalvm/truffle", "kind" : "git"},
                     {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},