Skip to content

Commit fa3758e

Browse files
committed
Convert RList to use the storage strategy pattern
1 parent 50c28ac commit fa3758e

File tree

11 files changed

+410
-242
lines changed

11 files changed

+410
-242
lines changed

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/ViewPort.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,9 @@ public RList execute(VirtualFrame frame) {
164164

165165
GridDevice device = GridContext.getContext().getCurrentDevice();
166166
// TODO: properly set the scale according to the current device
167-
Object[] data = topVP.getDataWithoutCopying();
168-
data[ViewPort.VP_XSCALE] = RDataFactory.createDoubleVector(new double[]{0, device.getNativeWidth()}, RDataFactory.COMPLETE_VECTOR);
169-
data[ViewPort.VP_YSCALE] = RDataFactory.createDoubleVector(new double[]{device.getNativeHeight(), 0}, RDataFactory.COMPLETE_VECTOR);
170-
data[ViewPort.PVP_GPAR] = GridContext.getContext().getGridState().getGpar();
167+
topVP.setDataAt(ViewPort.VP_XSCALE, RDataFactory.createDoubleVector(new double[]{0, device.getNativeWidth()}, RDataFactory.COMPLETE_VECTOR));
168+
topVP.setDataAt(ViewPort.VP_YSCALE, RDataFactory.createDoubleVector(new double[]{device.getNativeHeight(), 0}, RDataFactory.COMPLETE_VECTOR));
169+
topVP.setDataAt(ViewPort.PVP_GPAR, GridContext.getContext().getGridState().getGpar());
171170
return DoSetViewPort.doSetViewPort(topVP, false, true);
172171
}
173172
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private static Object combineRecursive(RArgsValuesAndNames args, Combine recursi
241241
for (int i = 0; i < argsArray.length; i++) {
242242
Object arg = argsArray[i];
243243
if (arg instanceof RList) {
244-
Object[] argsFromList = ((RList) arg).getDataWithoutCopying();
244+
Object[] argsFromList = ((RList) arg).getReadonlyData();
245245
newArgsArray[i] = recursiveCombine.executeCombine(new RArgsValuesAndNames(argsFromList,
246246
ArgumentsSignature.empty(argsFromList.length)), true);
247247
useNewArgs = true;

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java

Lines changed: 4 additions & 5 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, 2019, Oracle and/or its affiliates
4+
* Copyright (c) 2015, 2020, 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
@@ -425,10 +425,9 @@ static void signalError(RBaseNode callObj, Message msg, Object... args) {
425425
private static ReturnException gotoExitingHandler(Object cond, Object call, RList entry) throws ReturnException {
426426
REnvironment rho = (REnvironment) entry.getDataAt(ENTRY_TARGET_ENVIR);
427427
RList result = (RList) entry.getDataAt(ENTRY_RETURN_RESULT);
428-
Object[] resultData = result.getDataWithoutCopying();
429-
resultData[RESULT_COND] = cond;
430-
resultData[RESULT_CALL] = call;
431-
resultData[RESULT_HANDLER] = entry.getDataAt(ENTRY_HANDLER);
428+
result.setDataAt(RESULT_COND, cond);
429+
result.setDataAt(RESULT_CALL, call);
430+
result.setDataAt(RESULT_HANDLER, entry.getDataAt(ENTRY_HANDLER));
432431
throw new ReturnException(result, RArguments.getCall(rho.getFrame()));
433432
}
434433

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2020, 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

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

Lines changed: 0 additions & 158 deletions
This file was deleted.

0 commit comments

Comments
 (0)