diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
index dafc8d29b3ab341bbeeab16bf9973de187d6b2a6..0285d35f34700fa00ce3a283364c88533e5a42a2 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
@@ -57,7 +57,7 @@ public enum FastROptions {
     SharedContexts("Whether all child contexts are to be shared contexts", true),
     SearchPathForcePromises("Whether all promises for frames on shared path are forced in presence of shared contexts", false),
     LoadPackagesNativeCode("Load native code of packages, including builtin packages.", !FastRConfig.ManagedMode),
-    EmitTmpSource("Write deparsed source code to temporary files for better debugging.", true),
+    EmitTmpSource("Write deparsed source code to temporary files for better debugging.", false),
     EmitTmpDir("The directory where to allocate temporary files with deparsed source code.", null, true),
     EmitTmpHashed("Use an SHA-256 hash as file name to reduce temporary file creation.", true),
     SynchronizeNativeCode("allow only one thread to enter packages' native code", false),
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 a7860653075d8897e8378464797924b158d3d477..3b74920c86137021bfc26201ea47fd478b68b21a 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
@@ -392,12 +392,20 @@ public class RDeparse {
             if (FastROptions.EmitTmpSource.getBooleanValue() && deparsePath != null) {
                 fixupSourcesTempFile(deparsePath);
             } else {
-                fixupSourcesTextInternal();
+                fixupSourcesText();
             }
         }
 
-        private void fixupSourcesTextInternal() {
-            Source source = RSource.fromTextInternal(sb.toString(), RSource.Internal.DEPARSE);
+        private void fixupSourcesText() {
+            RootNode rootNode = getRootNode();
+            String name = rootNode != null ? rootNode.getName() : null;
+            String text = sb.toString();
+            if (name != null && !name.isEmpty() && !name.equals("<no source>")) {
+                name = name.replace(File.separatorChar, '_') + ".r";
+            } else {
+                name = "unknown.r";
+            }
+            Source source = RSource.fromText(text, name);
             for (SourceSectionElement s : sources) {
                 s.element.setSourceSection(source.createSection(s.start, s.length));
             }
@@ -416,10 +424,10 @@ public class RDeparse {
                 }
             } catch (AccessDeniedException | FileAlreadyExistsException | IllegalArgumentException e) {
                 // do not report because these exceptions are legitimate
-                fixupSourcesTextInternal();
+                fixupSourcesText();
             } catch (Throwable e) {
                 RInternalError.reportError(e);
-                fixupSourcesTextInternal();
+                fixupSourcesText();
             }
         }
 
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 33c82ab20dfd7961265d3bd24233c79ba9a05f71..fd85152c2c3d80a4331f2c71f7d9041150774339 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
@@ -117,6 +117,13 @@ public class RSource {
         return builder.build();
     }
 
+    /**
+     * Create a cached source from {@code text} and {@code name}.
+     */
+    public static Source fromText(String text, String name) {
+        return getCachedByOrigin(text, origin -> Source.newBuilder(text).name(name).language(RRuntime.R_LANGUAGE_ID).build());
+    }
+
     /**
      * Create an {@code internal} source from {@code text} and {@code description}.
      */
@@ -294,7 +301,7 @@ public class RSource {
         }
     }
 
-    private static <T> Source getCachedByOrigin(T origin, SourceGenerator<T> generator) throws IOException {
+    private static <T, E extends Exception> Source getCachedByOrigin(T origin, SourceGenerator<T, E> generator) throws E {
         CompilerAsserts.neverPartOfCompilation();
         Source src;
         synchronized (deserializedSources) {
@@ -309,7 +316,7 @@ public class RSource {
     }
 
     @FunctionalInterface
-    private interface SourceGenerator<T> {
-        Source apply(T origin) throws IOException;
+    private interface SourceGenerator<T, E extends Exception> {
+        Source apply(T origin) throws E;
     }
 }