diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java index 26b0eff1a789d542c4fce7578d55b98731650483..aea39489db98957faa8048ecfe9e8687fddfd185 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java @@ -116,7 +116,7 @@ import com.oracle.truffle.r.runtime.env.frame.REnvTruffleFrameAccess; public abstract class REnvironment extends RAttributeStorage { public static final class ContextStateImpl implements RContext.ContextState { - private static Map<RStringVector, WeakReference<FrameDescriptor>> frameDescriptorCache; + private static Map<RStringVector, WeakReference<FrameDescriptor>> frameDescriptorCache = Collections.synchronizedMap(new WeakHashMap<>(0)); private final MaterializedFrame globalFrame; @CompilationFinal private Base baseEnv; @@ -187,13 +187,7 @@ public abstract class REnvironment extends RAttributeStorage { public static FrameDescriptor getFrameDescriptorFromList(RList list) { CompilerAsserts.neverPartOfCompilation(); - // create lazily - if (frameDescriptorCache == null) { - frameDescriptorCache = Collections.synchronizedMap(new WeakHashMap<>()); - } - RStringVector names = list.getNames(); - WeakReference<FrameDescriptor> weakReference = frameDescriptorCache.get(names); FrameDescriptor fd = weakReference != null ? weakReference.get() : null;