Skip to content

Commit 3d34138

Browse files
committed
Minor fixes in MakeNames and S3 dispatch
1 parent 3d2f8f4 commit 3d34138

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MakeNames.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private static NewNames updateNewNames(RAbstractStringVector names, VectorReuse
117117
NewNames nn = newNames;
118118
if (nn == null) {
119119
RAbstractStringVector res = reuse.getResult(names);
120-
VectorAccess access = reuse.access(res);
120+
VectorAccess access = res.slowPathAccess();
121121
VectorAccess.RandomIterator iter = access.randomAccess(res);
122122
nn = new NewNames(res, access, iter);
123123
}

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public abstract static class NextMethod extends RBuiltinNode.Arg3 {
239239
private final ConditionProfile genericCallFrameNullProfile = ConditionProfile.createBinaryProfile();
240240
private final ConditionProfile genericDefFrameNullProfile = ConditionProfile.createBinaryProfile();
241241
private final ConditionProfile alternateClassHeaderProfile = ConditionProfile.createBinaryProfile();
242+
private ConditionProfile needToBoxStringProfile = ConditionProfile.createBinaryProfile();
242243

243244
private final ValueProfile parameterSignatureProfile = ValueProfile.createIdentityProfile();
244245
private final ValueProfile suppliedParameterSignatureProfile = ValueProfile.createIdentityProfile();
@@ -321,10 +322,17 @@ private RStringVector readType(VirtualFrame frame) {
321322
if (alternateClassHeaderProfile.profile(storedClass == null || storedClass == RNull.instance)) {
322323
return getAlternateClassHr(frame);
323324
} else {
324-
return (RStringVector) storedClass;
325+
return boxString(storedClass);
325326
}
326327
}
327328

329+
private RStringVector boxString(Object value) {
330+
if (needToBoxStringProfile.profile(value instanceof String)) {
331+
return RDataFactory.createStringVector((String) value);
332+
}
333+
return (RStringVector) value;
334+
}
335+
328336
private RStringVector getAlternateClassHr(VirtualFrame frame) {
329337
if (promiseHelper == null) {
330338
CompilerDirectives.transferToInterpreterAndInvalidate();

0 commit comments

Comments
 (0)