Skip to content

Commit

Permalink
CharSXPWrapper caching fixed
Browse files Browse the repository at this point in the history
(cherry picked from commit 8dec54a)
  • Loading branch information
zslajchrt authored and ansalond committed Jun 27, 2018
1 parent 8a2962e commit 82e5e31
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.r.runtime.RRuntime;
import com.oracle.truffle.r.runtime.Utils;

import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.WeakHashMap;
Expand All @@ -49,7 +51,7 @@ public final class CharSXPWrapper extends RObject implements RTruffleObject {
private static final Map<CharSXPWrapper, WeakReference<CharSXPWrapper>> instances = new WeakHashMap<>(2048);

private CharSXPWrapper(String contents) {
this.contents = contents;
this.contents = Utils.intern(contents);
}

@TruffleBoundary
Expand All @@ -61,7 +63,7 @@ public String getContents() {
return RRuntime.STRING_NA;
}
// WARNING:
// we keep and use the contens value even in cases when contets got allocated and could be
// we keep and use the contents value even in cases when contents got allocated and could be
// accessed via NativeDataAccess.getData():
// - when used with RSymbol the String has to be interned - NDA.getData() will create a new
// instance if already allocated
Expand Down

0 comments on commit 82e5e31

Please sign in to comment.