diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java
index 8b13bea09c8759b769fee775a7ce6218f1e5b0d3..13a04235fc97a49935226cdae711577978f93e94 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java
@@ -96,7 +96,7 @@ public final class RBuiltinPackages implements RBuiltinLookup {
         Path basePathbase = baseDirPath.resolve("R").resolve("base");
         Source baseSource = null;
         try {
-            baseSource = RSource.fromFileName(basePathbase.toString());
+            baseSource = RSource.fromFileName(basePathbase.toString(), true);
         } catch (IOException ex) {
             Utils.rSuicide(String.format("unable to open the base package %s", basePathbase));
         }
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 064c0481a1080807faa0493ff5f780460191d021..333055b1fb03ab4daf7c57182cd0935444466624 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
@@ -263,7 +263,7 @@ public abstract class ConnectionFunctions {
                 }
             }
             try {
-                return new FileRConnection(description, path, open, blocking, encoding, raw).asVector();
+                return new FileRConnection(description, path, open, blocking, encoding, raw, true).asVector();
             } catch (IOException ex) {
                 warning(RError.Message.CANNOT_OPEN_FILE, description, ex.getMessage());
                 throw error(RError.Message.CANNOT_OPEN_CONNECTION);
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java
index 8ecb53980eed30f4a22f6c88504949e42a09968e..78f3f3d6cd5b719e3cca7f55dba6e7df0dc21777 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java
@@ -193,7 +193,7 @@ public abstract class Parse extends RBuiltinNode {
                 } else {
                     path = fileName;
                 }
-                Source result = createFileSource(path, coalescedLines);
+                Source result = createFileSource(path, coalescedLines, false);
                 assert result != null : "Source created from environment should not be null";
                 return result;
             } else {
@@ -204,23 +204,28 @@ public abstract class Parse extends RBuiltinNode {
             if (srcFileText.equals("<text>")) {
                 return Source.newBuilder(coalescedLines).name("<parse>").mimeType(RRuntime.R_APP_MIME).build();
             } else {
-                return createFileSource(ConnectionSupport.removeFileURLPrefix(srcFileText), coalescedLines);
+                return createFileSource(ConnectionSupport.removeFileURLPrefix(srcFileText), coalescedLines, false);
             }
         }
     }
 
     private static Source createSource(RConnection conn, String coalescedLines) {
         // TODO check if file
-        String path = ConnectionSupport.getBaseConnection(conn).getSummaryDescription();
-        return createFileSource(path, coalescedLines);
+        ConnectionSupport.BaseRConnection bconn = ConnectionSupport.getBaseConnection(conn);
+        String path = bconn.getSummaryDescription();
+        return createFileSource(path, coalescedLines, bconn.isInternal());
     }
 
-    private static Source createFileSource(String path, String chars) {
+    private static Source createFileSource(String path, String chars, boolean internal) {
         try {
-            return RSource.fromFileName(chars, path);
+            return RSource.fromFileName(chars, path, internal);
         } catch (URISyntaxException e) {
             // Note: to be compatible with GnuR we construct Source even with a malformed path
-            return Source.newBuilder(chars).name(path).mimeType(RRuntime.R_APP_MIME).build();
+            Source.Builder<RuntimeException, RuntimeException, RuntimeException> builder = Source.newBuilder(chars).name(path).mimeType(RRuntime.R_APP_MIME);
+            if (internal) {
+                builder.internal();
+            }
+            return builder.build();
         }
     }
 
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RProfile.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RProfile.java
index acd5193d5732cb56b231ee7a303c9bd8e5df8726..50d4e6c01a35aaf5dd2f24ba593c314e70a87fe0 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RProfile.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RProfile.java
@@ -60,7 +60,7 @@ public final class RProfile implements RContext.ContextState {
             }
             File siteProfileFile = new File(siteProfilePath);
             if (siteProfileFile.exists()) {
-                newSiteProfile = getProfile(siteProfilePath);
+                newSiteProfile = getProfile(siteProfilePath, false);
             }
         }
 
@@ -78,7 +78,7 @@ public final class RProfile implements RContext.ContextState {
             if (userProfilePath != null) {
                 File userProfileFile = new File(userProfilePath);
                 if (userProfileFile.exists()) {
-                    newUserProfile = getProfile(userProfilePath);
+                    newUserProfile = getProfile(userProfilePath, false);
                 }
             }
         }
@@ -92,7 +92,7 @@ public final class RProfile implements RContext.ContextState {
 
     public static Source systemProfile() {
         Path path = FileSystems.getDefault().getPath(REnvVars.rHome(), "library", "base", "R", "Rprofile");
-        Source source = getProfile(path.toString());
+        Source source = getProfile(path.toString(), true);
         if (source == null) {
             Utils.rSuicide("can't find system profile");
         }
@@ -107,9 +107,9 @@ public final class RProfile implements RContext.ContextState {
         return userProfile;
     }
 
-    private static Source getProfile(String path) {
+    private static Source getProfile(String path, boolean internal) {
         try {
-            return RSource.fromFileName(path);
+            return RSource.fromFileName(path, internal);
         } catch (IOException ex) {
             // GnuR does not report an error, just ignores
             return null;
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java
index 31938c37b52c0ee0b9047c16445fbaa20d0d594d..5f6462db6d8b31943883d61dea6676c84a973d53 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSource.java
@@ -90,10 +90,14 @@ public class RSource {
      * Create an (external) source from the {@code text} that is known to originate from the file
      * system path {@code path}. The simulates the behavior of {@link #fromFile}.
      */
-    public static Source fromFileName(String text, String path) throws URISyntaxException {
+    public static Source fromFileName(String text, String path, boolean internal) throws URISyntaxException {
         File file = new File(path).getAbsoluteFile();
         URI uri = new URI("file://" + file.getAbsolutePath());
-        return Source.newBuilder(text).name(file.getName()).uri(uri).mimeType(RRuntime.R_APP_MIME).build();
+        Source.Builder<RuntimeException, RuntimeException, RuntimeException> builder = Source.newBuilder(text).name(file.getName()).uri(uri).mimeType(RRuntime.R_APP_MIME);
+        if (internal) {
+            builder.internal();
+        }
+        return builder.build();
     }
 
     /**
@@ -137,8 +141,12 @@ public class RSource {
     /**
      * Create an (external) source from the file system path {@code path}.
      */
-    public static Source fromFileName(String path) throws IOException {
-        return Source.newBuilder(new File(path)).name(path).mimeType(RRuntime.R_APP_MIME).build();
+    public static Source fromFileName(String path, boolean internal) throws IOException {
+        Source.Builder<IOException, RuntimeException, RuntimeException> builder = Source.newBuilder(new File(path)).name(path).mimeType(RRuntime.R_APP_MIME);
+        if (internal) {
+            builder.internal();
+        }
+        return builder.build();
     }
 
     /**
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java
index 356a823105a1dde2af1203c9fc5cecfe3e60bbe5..46a93b40dc428e285640caf6a4996fd498fc585c 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java
@@ -881,6 +881,13 @@ public class ConnectionSupport {
             return descriptor;
         }
 
+        /**
+         * Determines if the sources created by this connection are marked as internal.
+         */
+        public boolean isInternal() {
+            return false;
+        }
+
         public OpenMode getOpenMode() {
             return openMode;
         }
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java
index 1f009cd7a92008c6921c855867e791d3dab22540..7aa052f92001c6f9bd2e2f64fa322bd8dbb91600 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java
@@ -64,10 +64,12 @@ public class FileConnections {
      */
     public static class FileRConnection extends BasePathRConnection {
         private final boolean raw;
+        private final boolean internal;
 
-        public FileRConnection(String description, String path, String modeString, boolean blocking, String encoding, boolean raw) throws IOException {
+        public FileRConnection(String description, String path, String modeString, boolean blocking, String encoding, boolean raw, boolean internal) throws IOException {
             super(description, checkTemp(path), ConnectionClass.File, modeString, blocking, encoding);
             this.raw = raw;
+            this.internal = internal;
             openNonLazyConnection();
         }
 
@@ -79,6 +81,11 @@ public class FileConnections {
             }
         }
 
+        @Override
+        public boolean isInternal() {
+            return internal;
+        }
+
         @Override
         protected void createDelegateConnection() throws IOException {