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 14cc631717cbcc5bcf1db61d9a08a405b3432d25..9c105a0af64c45af2c5b086f125805916f891f3a 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 9c2e312f17d16967ac88b13b55f18ba26b0bc23e..de9ff2b821a97f48a5dc9189edde8caa77b27dd2 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));