From 5fb6d43d35f31278e6e19d187ebe6467b519a0ed Mon Sep 17 00:00:00 2001
From: Florian Angerer <florian.angerer@oracle.com>
Date: Fri, 22 Sep 2017 09:41:35 +0200
Subject: [PATCH] Added missing TruffleBoundary.

---
 .../r/nodes/builtin/base/EnvFunctions.java    |  1 +
 .../r/runtime/data/NativeDataAccess.java      | 21 ++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java
index 14cc631717..9c105a0af6 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java
@@ -168,6 +168,7 @@ public class EnvFunctions {
         }
 
         @Specialization
+        @TruffleBoundary
         protected REnvironment asEnvironment(RList list,
                         @Cached("new()") RList2EnvNode list2Env) {
             REnvironment env = RDataFactory.createNewEnv(null);
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/NativeDataAccess.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/NativeDataAccess.java
index 9c2e312f17..de9ff2b821 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/NativeDataAccess.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/NativeDataAccess.java
@@ -193,19 +193,26 @@ public final class NativeDataAccess {
             RObject obj = (RObject) arg;
             NativeMirror mirror = (NativeMirror) obj.getNativeMirror();
             if (mirror == null) {
-                obj.setNativeMirror(mirror = arg instanceof CustomNativeMirror ? new NativeMirror(((CustomNativeMirror) arg).getCustomMirrorAddress()) : new NativeMirror());
-                // System.out.println(String.format("adding %16x = %s", mirror.id,
-                // obj.getClass().getSimpleName()));
-                nativeMirrors.put(mirror.id, new WeakReference<>(obj));
-                if (TRACE_MIRROR_ALLOCATION_SITES) {
-                    registerAllocationSite(arg, mirror);
-                }
+                mirror = putMirrorObject(arg, obj);
             }
             return mirror.id;
         }
         throw UnsupportedMessageException.raise(Message.AS_POINTER);
     }
 
+    @TruffleBoundary
+    private static NativeMirror putMirrorObject(Object arg, RObject obj) {
+        NativeMirror mirror;
+        obj.setNativeMirror(mirror = arg instanceof CustomNativeMirror ? new NativeMirror(((CustomNativeMirror) arg).getCustomMirrorAddress()) : new NativeMirror());
+        // System.out.println(String.format("adding %16x = %s", mirror.id,
+        // obj.getClass().getSimpleName()));
+        nativeMirrors.put(mirror.id, new WeakReference<>(obj));
+        if (TRACE_MIRROR_ALLOCATION_SITES) {
+            registerAllocationSite(arg, mirror);
+        }
+        return mirror;
+    }
+
     @TruffleBoundary
     private static void registerAllocationSite(Object arg, NativeMirror mirror) {
         nativeMirrorInfo.put(mirror.id, new RuntimeException(arg.getClass().getSimpleName() + " " + arg));
-- 
GitLab