Skip to content

Commit eae16ce

Browse files
committed
Fix: intern strings used as symbols in ATTRIB RFFI function
1 parent 8e4a940 commit eae16ce

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetRowNamesAttributeNode;
4646
import com.oracle.truffle.r.nodes.function.opt.UpdateShareableChildValueNode;
4747
import com.oracle.truffle.r.nodes.unary.CastNode;
48+
import com.oracle.truffle.r.nodes.unary.InternStringNode;
4849
import com.oracle.truffle.r.runtime.ArgumentsSignature;
4950
import com.oracle.truffle.r.runtime.RError;
5051
import com.oracle.truffle.r.runtime.RError.Message;
@@ -144,6 +145,7 @@ public abstract static class ATTRIB extends FFIUpCallNode.Arg1 {
144145

145146
@Specialization
146147
public Object doAttributable(RAttributable obj,
148+
@Cached("create()") InternStringNode internStringNode,
147149
@Cached("createWithCompactRowNames()") GetAttributesNode getAttributesNode) {
148150
Object resultObj = getAttributesNode.execute(obj);
149151
if (resultObj == RNull.instance) {
@@ -153,14 +155,14 @@ public Object doAttributable(RAttributable obj,
153155
RList list = (RList) resultObj;
154156
Object result = RNull.instance;
155157
RStringVector names = list.getNames();
156-
assert names.getLength() == list.getLength();
158+
assert names != null && names.getLength() == list.getLength();
157159
for (int i = list.getLength() - 1; i >= 0; i--) {
158160
Object item = list.getDataAt(i);
159161
String name = names.getDataAt(i);
160162
if (name.equals(RRuntime.ROWNAMES_ATTR_KEY)) {
161163
item = GetRowNamesAttributeNode.ensureRowNamesCompactFormat(item);
162164
}
163-
RSymbol symbol = RDataFactory.createSymbol(name);
165+
RSymbol symbol = RDataFactory.createSymbol(internStringNode.execute(name));
164166
result = RDataFactory.createPairList(item, result, symbol);
165167
}
166168
return result;

0 commit comments

Comments
 (0)