Skip to content

Commit 8e4a940

Browse files
committed
Nodes in SpecialAttributesFunctions can cast their 2nd argument and "dim" uses that to cast it to a integer vector
1 parent ac1bfc2 commit 8e4a940

File tree

16 files changed

+95
-73
lines changed

16 files changed

+95
-73
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -277,7 +277,7 @@ public abstract static class NamesGetsNode extends FFIUpCallNode.Arg2 {
277277

278278
@Specialization
279279
Object doNewObject(Object vec, Object val) {
280-
setNamesNode.execute(vec, val);
280+
setNamesNode.setAttr(vec, val);
281281
return vec;
282282
}
283283

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RMultinomNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 1995, 1996 Robert Gentleman and Ross Ihaka
33
* Copyright (c) 1997-2012, The R Core Team
44
* Copyright (c) 2003-2008, The R Foundation
5-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates
5+
* Copyright (c) 2016, 2019, Oracle and/or its affiliates
66
*
77
* This program is free software; you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by
@@ -142,7 +142,7 @@ protected RIntVector doMultinom(int n, int size, RAbstractDoubleVector probs,
142142
Object probsNames = getNamesNode.execute(probs.getAttributes());
143143
updateSharedAttributeNode.execute(probs, probsNames);
144144
Object[] dimnamesData = new Object[]{probsNames, RNull.instance};
145-
setDimNamesNode.execute(resultVec.getAttributes(), RDataFactory.createList(dimnamesData));
145+
setDimNamesNode.setAttr(resultVec.getAttributes(), RDataFactory.createList(dimnamesData));
146146
}
147147
return resultVec;
148148
}

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/TypeConvert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -227,7 +227,7 @@ protected Object typeConvert(RAbstractStringVector x, RAbstractStringVector naSt
227227
}
228228
}
229229
RIntVector res = RDataFactory.createIntVector(data, complete);
230-
setLevelsAttrNode.execute(res, RDataFactory.createStringVector(levels.keySet().toArray(new String[0]), RDataFactory.COMPLETE_VECTOR));
230+
setLevelsAttrNode.setAttr(res, RDataFactory.createStringVector(levels.keySet().toArray(new String[0]), RDataFactory.COMPLETE_VECTOR));
231231
return RVector.setVectorClassAttr(res, RDataFactory.createStringVector("factor"));
232232
}
233233
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -432,7 +432,7 @@ protected static Object updateEnvironment(RAbstractContainer obj, REnvironment e
432432
@TruffleBoundary
433433
protected static Object updateEnvironment(RAttributable obj, REnvironment env,
434434
@Cached("createSetEnvAttrNode()") SetFixedAttributeNode setEnvAttrNode) {
435-
setEnvAttrNode.execute(obj, env);
435+
setEnvAttrNode.setAttr(obj, env);
436436
return obj;
437437
}
438438

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 1995-2015, The R Core Team
33
* Copyright (c) 2003, The R Foundation
4-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates
4+
* Copyright (c) 2015, 2019, Oracle and/or its affiliates
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -904,20 +904,20 @@ protected Object regexp(RAbstractStringVector patternArg, RAbstractStringVector
904904
}
905905
}
906906
RIntVector ret = RDataFactory.createIntVector(result, RDataFactory.COMPLETE_VECTOR);
907-
setMatchLengthAttrNode.execute(ret, RDataFactory.createIntVector(matchLength, RDataFactory.COMPLETE_VECTOR));
907+
setMatchLengthAttrNode.setAttr(ret, RDataFactory.createIntVector(matchLength, RDataFactory.COMPLETE_VECTOR));
908908
if (useBytes) {
909-
setIndexTypeAttrNode.execute(ret, indexType);
910-
setUseBytesAttrNode.execute(ret, RRuntime.LOGICAL_TRUE);
909+
setIndexTypeAttrNode.setAttr(ret, indexType);
910+
setUseBytesAttrNode.setAttr(ret, RRuntime.LOGICAL_TRUE);
911911
}
912912
if (hasCaptureResult) {
913913
RStringVector captureNamesVec = RDataFactory.createStringVector(captureNames, RDataFactory.COMPLETE_VECTOR);
914914
RIntVector captureStartVec = RDataFactory.createIntVector(captureStart, RDataFactory.COMPLETE_VECTOR, new int[]{vector.getLength(), captureNames.length});
915-
setDimNamesAttrNode.execute(captureStartVec, RDataFactory.createList(new Object[]{RNull.instance, captureNamesVec.copy()}));
916-
setCaptureStartAttrNode.execute(ret, captureStartVec);
915+
setDimNamesAttrNode.setAttr(captureStartVec, RDataFactory.createList(new Object[]{RNull.instance, captureNamesVec.copy()}));
916+
setCaptureStartAttrNode.setAttr(ret, captureStartVec);
917917
RIntVector captureLengthVec = RDataFactory.createIntVector(captureLength, RDataFactory.COMPLETE_VECTOR, new int[]{vector.getLength(), captureNames.length});
918-
setDimNamesAttrNode.execute(captureLengthVec, RDataFactory.createList(new Object[]{RNull.instance, captureNamesVec.copy()}));
919-
setCaptureLengthAttrNode.execute(ret, captureLengthVec);
920-
setCaptureNamesAttrNode.execute(ret, captureNamesVec);
918+
setDimNamesAttrNode.setAttr(captureLengthVec, RDataFactory.createList(new Object[]{RNull.instance, captureNamesVec.copy()}));
919+
setCaptureLengthAttrNode.setAttr(ret, captureLengthVec);
920+
setCaptureNamesAttrNode.setAttr(ret, captureNamesVec);
921921
}
922922
return ret;
923923
} catch (PatternSyntaxException e) {
@@ -1088,12 +1088,12 @@ protected Object regexp(RAbstractStringVector patternArg, RAbstractStringVector
10881088
}
10891089
}
10901090
RIntVector matches = RDataFactory.createIntVector(matchPos, RDataFactory.COMPLETE_VECTOR);
1091-
setMatchLengthAttrNode.execute(matches, RDataFactory.createIntVector(matchLength, RDataFactory.COMPLETE_VECTOR));
1091+
setMatchLengthAttrNode.setAttr(matches, RDataFactory.createIntVector(matchLength, RDataFactory.COMPLETE_VECTOR));
10921092
ret.setElement(i, matches);
10931093
}
10941094
if (useBytes) {
1095-
setIndexTypeAttrNode.execute(ret, indexType);
1096-
setUseBytesAttrNode.execute(ret, RRuntime.LOGICAL_TRUE);
1095+
setIndexTypeAttrNode.setAttr(ret, indexType);
1096+
setUseBytesAttrNode.setAttr(ret, RRuntime.LOGICAL_TRUE);
10971097
}
10981098
return ret;
10991099
} catch (PatternSyntaxException e) {
@@ -1163,12 +1163,12 @@ private void setNoCaptureAttributes(RIntVector vec, RStringVector captureNames)
11631163
Arrays.fill(captureStartData, -1);
11641164
Arrays.fill(captureLengthData, -1);
11651165
RIntVector captureStart = RDataFactory.createIntVector(captureStartData, RDataFactory.COMPLETE_VECTOR, new int[]{1, captureNames.getLength()});
1166-
setDimNamesAttrNode.execute(captureStart, RDataFactory.createList(new Object[]{RNull.instance, captureNames.copy()}));
1166+
setDimNamesAttrNode.setAttr(captureStart, RDataFactory.createList(new Object[]{RNull.instance, captureNames.copy()}));
11671167
RIntVector captureLength = RDataFactory.createIntVector(captureLengthData, RDataFactory.COMPLETE_VECTOR, new int[]{1, captureNames.getLength()});
1168-
setDimNamesAttrNode.execute(captureLength, RDataFactory.createList(new Object[]{RNull.instance, captureNames.copy()}));
1169-
setCaptureStartAttrNode.execute(vec, captureStart);
1170-
setCaptureLengthAttrNode.execute(vec, captureLength);
1171-
setCaptureNamesAttrNode.execute(vec, captureNames);
1168+
setDimNamesAttrNode.setAttr(captureLength, RDataFactory.createList(new Object[]{RNull.instance, captureNames.copy()}));
1169+
setCaptureStartAttrNode.setAttr(vec, captureStart);
1170+
setCaptureLengthAttrNode.setAttr(vec, captureLength);
1171+
setCaptureNamesAttrNode.setAttr(vec, captureNames);
11721172
}
11731173

11741174
@Specialization
@@ -1205,18 +1205,18 @@ protected Object regexp(RAbstractStringVector patternArg, RAbstractStringVector
12051205
resData[j] = j + 1;
12061206
}
12071207
res = RDataFactory.createIntVector(resData, RDataFactory.COMPLETE_VECTOR);
1208-
setMatchLengthAttrNode.execute(res, RDataFactory.createIntVector(txt.length()));
1208+
setMatchLengthAttrNode.setAttr(res, RDataFactory.createIntVector(txt.length()));
12091209
if (useBytes) {
1210-
setIndexTypeAttrNode.execute(res, indexType);
1211-
setUseBytesAttrNode.execute(res, RRuntime.LOGICAL_TRUE);
1210+
setIndexTypeAttrNode.setAttr(res, indexType);
1211+
setUseBytesAttrNode.setAttr(res, RRuntime.LOGICAL_TRUE);
12121212
}
12131213
} else {
12141214
List<Info> l = getInfo(common, pattern, vector.getDataAt(i), ignoreCase, perl, fixed);
12151215
res = toIndexOrSizeVector(l, true);
1216-
setMatchLengthAttrNode.execute(res, toIndexOrSizeVector(l, false));
1216+
setMatchLengthAttrNode.setAttr(res, toIndexOrSizeVector(l, false));
12171217
if (useBytes) {
1218-
setIndexTypeAttrNode.execute(res, indexType);
1219-
setUseBytesAttrNode.execute(res, RRuntime.LOGICAL_TRUE);
1218+
setIndexTypeAttrNode.setAttr(res, indexType);
1219+
setUseBytesAttrNode.setAttr(res, RRuntime.LOGICAL_TRUE);
12201220
}
12211221
RIntVector captureStart = toCaptureStartOrLength(l, true);
12221222
if (captureStart != null) {
@@ -1231,9 +1231,9 @@ protected Object regexp(RAbstractStringVector patternArg, RAbstractStringVector
12311231
}
12321232
}
12331233
hasAnyCapture = true;
1234-
setCaptureStartAttrNode.execute(res, captureStart);
1235-
setCaptureLengthAttrNode.execute(res, captureLength);
1236-
setCaptureNamesAttrNode.execute(res, captureNames);
1234+
setCaptureStartAttrNode.setAttr(res, captureStart);
1235+
setCaptureLengthAttrNode.setAttr(res, captureLength);
1236+
setCaptureNamesAttrNode.setAttr(res, captureNames);
12371237
} else if (hasAnyCapture) {
12381238
assert captureNames != null;
12391239
// it's capture names from previous iteration, so copy
@@ -1277,7 +1277,7 @@ private RIntVector toCaptureStartOrLength(List<Info> list, boolean start) {
12771277
}
12781278
}
12791279
RIntVector ret = RDataFactory.createIntVector(arr, RDataFactory.COMPLETE_VECTOR, new int[]{list.size(), firstInfo.captureNames.length});
1280-
setDimNamesAttrNode.execute(ret, RDataFactory.createList(new Object[]{RNull.instance, RDataFactory.createStringVector(firstInfo.captureNames, RDataFactory.COMPLETE_VECTOR)}));
1280+
setDimNamesAttrNode.setAttr(ret, RDataFactory.createList(new Object[]{RNull.instance, RDataFactory.createStringVector(firstInfo.captureNames, RDataFactory.COMPLETE_VECTOR)}));
12811281
return ret;
12821282
}
12831283

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 1995-2012, The R Core Team
33
* Copyright (c) 2003, The R Foundation
4-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates
4+
* Copyright (c) 2013, 2019, Oracle and/or its affiliates
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -520,7 +520,7 @@ protected RList doDetGeReal(RAbstractDoubleVector aIn, boolean useLog,
520520
}
521521
}
522522
RDoubleVector modulusVec = RDataFactory.createDoubleVectorFromScalar(modulus);
523-
setLogAttrNode.execute(modulusVec, RRuntime.asLogical(useLog));
523+
setLogAttrNode.setAttr(modulusVec, RRuntime.asLogical(useLog));
524524
RList result = RDataFactory.createList(new Object[]{modulusVec, sign}, NAMES_VECTOR);
525525
RVector.setVectorClassAttr(result, DET_CLASS);
526526
return result;
@@ -593,8 +593,8 @@ protected RDoubleVector doDetGeReal(RAbstractDoubleVector aIn, boolean piv, doub
593593
}
594594

595595
RDoubleVector result = (RDoubleVector) copyAttributesNode.execute(RDataFactory.createDoubleVector(aData, RDataFactory.INCOMPLETE_VECTOR), aIn);
596-
setPivotAttrNode.execute(result, RDataFactory.createIntVector(ipiv, false));
597-
setRankAttrNode.execute(result, rank[0]);
596+
setPivotAttrNode.setAttr(result, RDataFactory.createIntVector(ipiv, false));
597+
setRankAttrNode.setAttr(result, rank[0]);
598598
RList dn = getDimNamesNode.getDimNames(aIn);
599599
if (dn != null && dn.getDataAt(0) != null) {
600600
Object[] dn2 = new Object[m];

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -264,7 +264,7 @@ private void addAttributes(RExpression exprs, Source source, REnvironment srcFil
264264
throw RInternalError.unimplemented("attribute of type " + data.getClass().getSimpleName());
265265
}
266266
}
267-
setSrcRefAttrNode.execute(exprs, RDataFactory.createList(srcrefData));
267+
setSrcRefAttrNode.setAttr(exprs, RDataFactory.createList(srcrefData));
268268
int[] wholeSrcrefData = new int[8];
269269
int endOffset = source.getCharacters().length() - 1;
270270
wholeSrcrefData[0] = source.getLineNumber(0);
@@ -273,8 +273,8 @@ private void addAttributes(RExpression exprs, Source source, REnvironment srcFil
273273
wholeSrcrefData[6] = wholeSrcrefData[0];
274274
wholeSrcrefData[6] = wholeSrcrefData[3];
275275

276-
setWholeSrcRefAttrNode.execute(exprs, RDataFactory.createIntVector(wholeSrcrefData, RDataFactory.COMPLETE_VECTOR));
277-
setSrcFileAttrNode.execute(exprs, srcFile);
276+
setWholeSrcRefAttrNode.setAttr(exprs, RDataFactory.createIntVector(wholeSrcrefData, RDataFactory.COMPLETE_VECTOR));
277+
setSrcFileAttrNode.setAttr(exprs, srcFile);
278278

279279
RIntVector parseData = new ParseDataVisitor(exprs).getParseData();
280280
srcFile.safePut("parseData", parseData);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
33
* Copyright (c) 1995-2014, The R Core Team
44
* Copyright (c) 2002-2008, The R Foundation
5-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates
5+
* Copyright (c) 2015, 2019, Oracle and/or its affiliates
66
*
77
* This program is free software; you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by
@@ -243,12 +243,12 @@ protected RVector<?> transposeNonMatrixGeneric(RAbstractVector x,
243243
}
244244

245245
private void putNewDimsFromDimnames(RAbstractVector source, RAbstractVector dest, int[] newDim) {
246-
putDimensions.execute(initAttributes.execute(dest), RDataFactory.createIntVector(newDim, RDataFactory.COMPLETE_VECTOR));
246+
putDimensions.setAttr(initAttributes.execute(dest), RDataFactory.createIntVector(newDim, RDataFactory.COMPLETE_VECTOR));
247247
convertDimNames(source, dest);
248248
}
249249

250250
private void putNewDimsFromNames(RAbstractVector source, RAbstractVector dest, int[] newDim) {
251-
putDimensions.execute(initAttributes.execute(dest), RDataFactory.createIntVector(newDim, RDataFactory.COMPLETE_VECTOR));
251+
putDimensions.setAttr(initAttributes.execute(dest), RDataFactory.createIntVector(newDim, RDataFactory.COMPLETE_VECTOR));
252252
convertNamesToDimnames(source, dest);
253253
}
254254

@@ -261,7 +261,7 @@ private void convertDimNames(RAbstractVector source, RAbstractVector dest) {
261261
RStringVector axisNames = extractAxisNamesNode.execute(dimNames);
262262
RStringVector transAxisNames = axisNames == null ? null : RDataFactory.createStringVector(new String[]{axisNames.getDataAt(1), axisNames.getDataAt(0)}, true);
263263
RList newDimNames = RDataFactory.createList(new Object[]{dimNames.getDataAt(1), dimNames.getDataAt(0)}, transAxisNames);
264-
putDimNames.execute(dest.getAttributes(), newDimNames);
264+
putDimNames.setAttr(dest.getAttributes(), newDimNames);
265265
}
266266
}
267267

@@ -274,7 +274,7 @@ private void convertNamesToDimnames(RAbstractVector source, RAbstractVector dest
274274
if (names != null) {
275275
RList newDimNames = RDataFactory.createList(new Object[]{RNull.instance, names});
276276
DynamicObject attributes = dest.getAttributes();
277-
putDimNames.execute(attributes, newDimNames);
277+
putDimNames.setAttr(attributes, newDimNames);
278278
if (removeAttributeNode == null) {
279279
CompilerDirectives.transferToInterpreterAndInvalidate();
280280
removeAttributeNode = insert(RemoveAttributeNode.create());

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@ protected Object dim(RSharingAttributeStorage container, RAbstractStringVector v
6565
CompilerDirectives.transferToInterpreterAndInvalidate();
6666
setCommentAttrNode = insert(createGetCommentAttrNode());
6767
}
68-
setCommentAttrNode.execute(container, value);
68+
setCommentAttrNode.setAttr(container, value);
6969
return container;
7070
}
7171

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@ protected RAbstractVector updateDim(RAbstractVector vector, RAbstractIntVector d
8787
attrs = RAttributesLayout.createDim(dimensionsMaterialized);
8888
result.initAttributes(attrs);
8989
} else {
90-
putDimensions.execute(attrs, dimensionsMaterialized);
90+
putDimensions.setAttr(attrs, dimensionsMaterialized);
9191
}
9292
return result;
9393
}

0 commit comments

Comments
 (0)