Skip to content

Commit 438ecb3

Browse files
committed
Invalidate the "no CharSXP vectors" assumption in RStringVector ctor if appropriate
1 parent d055a9e commit 438ecb3

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ public final class RStringVector extends RVector<Object[]> implements RAbstractS
4646

4747
private static final Assumption noWrappedStrings = Truffle.getRuntime().createAssumption();
4848

49-
private long nativeContentsAddr;
5049
private Object[] data;
5150

5251
RStringVector(Object[] data, boolean complete) {
5352
super(complete);
5453
assert data instanceof String[] || data instanceof CharSXPWrapper[];
54+
if (noWrappedStrings.isValid() && data instanceof CharSXPWrapper[]) {
55+
noWrappedStrings.invalidate();
56+
}
5557
this.data = data;
5658
assert RAbstractVector.verify(this);
5759
}

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,7 @@ public final String toString() {
791791
}
792792

793793
protected boolean canBeValidStore(Object store, Object data) {
794-
RContext ctx;
795-
try {
796-
ctx = RContext.getInstance();
797-
} catch (IllegalStateException ex) {
798-
return true; // no context, we cannot check anything
799-
}
800794
// We can be only sure if there is only one thread
801-
return !ctx.isSingle() || store == data;
795+
return !RContext.isSingle() || store == data;
802796
}
803797
}

0 commit comments

Comments
 (0)