From dc8142b0b006bdb2065f6a4ad395ce085ee52257 Mon Sep 17 00:00:00 2001 From: stepan <stepan.sindelar@oracle.com> Date: Tue, 18 Apr 2017 13:01:53 +0200 Subject: [PATCH] Remove obsoleted grid RFFI support --- .../ffi/nfi/TruffleNFI_RFFIFactory.java | 13 --- .../truffle/r/library/grid/GridFunctions.java | 109 ------------------ .../truffle/r/nodes/test/ExtBuiltinsList.java | 3 - .../r/runtime/ffi/generic/Generic_Grid.java | 87 -------------- .../r/runtime/ffi/jni/JNI_RFFIFactory.java | 13 --- .../truffle/r/runtime/ffi/GridRFFI.java | 49 -------- .../oracle/truffle/r/runtime/ffi/RFFI.java | 4 +- .../ffi/managed/Managed_RFFIFactory.java | 17 --- mx.fastr/copyrights/overrides | 1 - 9 files changed, 1 insertion(+), 295 deletions(-) delete mode 100644 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/grid/GridFunctions.java delete mode 100644 com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/generic/Generic_Grid.java delete mode 100644 com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/GridRFFI.java diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ffi/nfi/TruffleNFI_RFFIFactory.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ffi/nfi/TruffleNFI_RFFIFactory.java index fba810c5c1..a892fb8876 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ffi/nfi/TruffleNFI_RFFIFactory.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ffi/nfi/TruffleNFI_RFFIFactory.java @@ -31,7 +31,6 @@ import com.oracle.truffle.r.runtime.ffi.CRFFI; import com.oracle.truffle.r.runtime.ffi.CallRFFI; import com.oracle.truffle.r.runtime.ffi.DLL; import com.oracle.truffle.r.runtime.ffi.DLLRFFI; -import com.oracle.truffle.r.runtime.ffi.GridRFFI; import com.oracle.truffle.r.runtime.ffi.LapackRFFI; import com.oracle.truffle.r.runtime.ffi.LibPaths; import com.oracle.truffle.r.runtime.ffi.MiscRFFI; @@ -44,7 +43,6 @@ import com.oracle.truffle.r.runtime.ffi.StatsRFFI; import com.oracle.truffle.r.runtime.ffi.ToolsRFFI; import com.oracle.truffle.r.runtime.ffi.UserRngRFFI; import com.oracle.truffle.r.runtime.ffi.ZipRFFI; -import com.oracle.truffle.r.runtime.ffi.generic.Generic_Grid; public class TruffleNFI_RFFIFactory extends RFFIFactory implements RFFI { private static class ContextStateImpl implements RContext.ContextState { @@ -196,17 +194,6 @@ public class TruffleNFI_RFFIFactory extends RFFIFactory implements RFFI { return rEmbedRFFI; } - @CompilationFinal private GridRFFI gridRFFI; - - @Override - public GridRFFI getGridRFFI() { - if (gridRFFI == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - gridRFFI = new Generic_Grid(); - } - return gridRFFI; - } - private MiscRFFI miscRFFI; @Override diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/grid/GridFunctions.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/grid/GridFunctions.java deleted file mode 100644 index a5b48baf87..0000000000 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/grid/GridFunctions.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This material is distributed under the GNU General Public License - * Version 2. You may review the terms of this license at - * http://www.gnu.org/licenses/gpl-2.0.html - * - * Copyright (C) 2001-3 Paul Murrell - * Copyright (c) 1998-2013, The R Core Team - * Copyright (c) 2013, 2017, Oracle and/or its affiliates - * - * All rights reserved. - */ -package com.oracle.truffle.r.library.grid; - -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.notEmpty; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.stringValue; - -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; -import com.oracle.truffle.api.dsl.Fallback; -import com.oracle.truffle.api.dsl.Specialization; -import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; -import com.oracle.truffle.r.runtime.RError; -import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames; -import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RIntVector; -import com.oracle.truffle.r.runtime.data.RNull; -import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; -import com.oracle.truffle.r.runtime.env.REnvironment; -import com.oracle.truffle.r.runtime.ffi.GridRFFI; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -/** - * The .Call support for the grid package. - */ -public class GridFunctions { - - public abstract static class InitGrid extends RExternalBuiltinNode.Arg1 { - @Child GridRFFI.InitGridNode initGridNode = RFFIFactory.getRFFI().getGridRFFI().createInitGridNode(); - - static { - Casts casts = new Casts(InitGrid.class); - casts.arg(0).mustBe(REnvironment.class); - } - - @Specialization - @TruffleBoundary - protected Object initGrid(REnvironment gridEvalEnv) { - return initGridNode.execute(gridEvalEnv); - } - - @Fallback - protected Object initGridFallback(@SuppressWarnings("unused") Object x) { - return RNull.instance; - } - } - - public static final class KillGrid extends RExternalBuiltinNode { - @Child GridRFFI.KillGridNode killGridNode = RFFIFactory.getRFFI().getGridRFFI().createKillGridNode(); - - static { - Casts.noCasts(KillGrid.class); - } - - @Override - @TruffleBoundary - public Object call(RArgsValuesAndNames args) { - return killGridNode.execute(); - } - } - - public abstract static class ValidUnits extends RExternalBuiltinNode.Arg1 { - - static { - Casts casts = new Casts(ValidUnits.class); - casts.arg(0).mustBe(stringValue(), RError.Message.GENERIC, "'units' must be character").asStringVector().mustBe(notEmpty(), RError.Message.GENERIC, "'units' must be of length > 0"); - } - - @Specialization - protected RIntVector validUnits(RAbstractStringVector units) { - int[] data = new int[units.getLength()]; - for (int i = 0; i < data.length; i++) { - int code = convertUnit(units.getDataAt(i)); - if (code < 0) { - throw error(RError.Message.GENERIC, "Invalid unit"); - } - data[i] = code; - } - return RDataFactory.createIntVector(data, RDataFactory.COMPLETE_VECTOR); - } - - private enum UnitTab { - npc(0); - - private final int code; - - UnitTab(int code) { - this.code = code; - } - } - - private static int convertUnit(String unit) { - for (UnitTab unitTab : UnitTab.values()) { - if (unit.equals(unitTab.name())) { - return unitTab.code; - } - } - return -1; - } - } -} diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ExtBuiltinsList.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ExtBuiltinsList.java index 1035f57473..f7488cc482 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ExtBuiltinsList.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ExtBuiltinsList.java @@ -80,9 +80,6 @@ public class ExtBuiltinsList { com.oracle.truffle.r.library.stats.CompleteCases.class, com.oracle.truffle.r.library.stats.CdistNodeGen.class, com.oracle.truffle.r.library.stats.BinDistNodeGen.class, - com.oracle.truffle.r.library.grid.GridFunctionsFactory.InitGridNodeGen.class, - com.oracle.truffle.r.library.grid.GridFunctionsFactory.ValidUnitsNodeGen.class, - com.oracle.truffle.r.library.grid.GridFunctions.KillGrid.class, com.oracle.truffle.r.library.methods.SubstituteDirectNodeGen.class, com.oracle.truffle.r.library.methods.SlotFactory.R_getSlotNodeGen.class, com.oracle.truffle.r.library.methods.SlotFactory.R_setSlotNodeGen.class, diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/generic/Generic_Grid.java b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/generic/Generic_Grid.java deleted file mode 100644 index 8aad787c55..0000000000 --- a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/generic/Generic_Grid.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.truffle.r.runtime.ffi.generic; - -import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; -import com.oracle.truffle.r.runtime.env.REnvironment; -import com.oracle.truffle.r.runtime.ffi.CallRFFI; -import com.oracle.truffle.r.runtime.ffi.DLL; -import com.oracle.truffle.r.runtime.ffi.DLL.DLLInfo; -import com.oracle.truffle.r.runtime.ffi.DLL.SymbolHandle; -import com.oracle.truffle.r.runtime.ffi.GridRFFI; -import com.oracle.truffle.r.runtime.ffi.NativeCallInfo; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -public class Generic_Grid implements GridRFFI { - private static final String GRID = "grid"; - - private static class Generic_InitGridNode extends InitGridNode { - private static final String L_InitGrid = "L_initGrid"; - @Child private CallRFFI.InvokeCallNode invokeCallNode = RFFIFactory.getRFFI().getCallRFFI().createInvokeCallNode(); - @Child DLL.RFindSymbolNode findSymbolNode = DLL.RFindSymbolNode.create(); - @CompilationFinal private NativeCallInfo initNativeCallInfo; - - @Override - public Object execute(REnvironment gridEvalEnv) { - if (initNativeCallInfo == null) { - initNativeCallInfo = createNativeCallInfo(L_InitGrid, findSymbolNode); - } - return invokeCallNode.execute(initNativeCallInfo, new Object[]{gridEvalEnv}); - } - } - - private static class Generic_KillGridNode extends KillGridNode { - private static final String L_KillGrid = "L_killGrid"; - @Child private CallRFFI.InvokeCallNode invokeCallNode = RFFIFactory.getRFFI().getCallRFFI().createInvokeCallNode(); - @Child DLL.RFindSymbolNode findSymbolNode = DLL.RFindSymbolNode.create(); - @CompilationFinal private NativeCallInfo killNativeCallInfo; - - @Override - public Object execute() { - if (killNativeCallInfo == null) { - killNativeCallInfo = createNativeCallInfo(L_KillGrid, findSymbolNode); - } - return invokeCallNode.execute(killNativeCallInfo, new Object[0]); - } - - } - - private static NativeCallInfo createNativeCallInfo(String call, DLL.RFindSymbolNode findSymbolNode) { - DLLInfo dllInfo = DLL.findLibrary(GRID); - assert dllInfo != null; - SymbolHandle symbolHandle = findSymbolNode.execute(call, GRID, DLL.RegisteredNativeSymbol.any()); - assert symbolHandle != DLL.SYMBOL_NOT_FOUND; - return new NativeCallInfo(call, symbolHandle, dllInfo); - } - - @Override - public InitGridNode createInitGridNode() { - return new Generic_InitGridNode(); - } - - @Override - public KillGridNode createKillGridNode() { - return new Generic_KillGridNode(); - } - -} diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_RFFIFactory.java b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_RFFIFactory.java index 28f516f7c6..0ec293f8b1 100644 --- a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_RFFIFactory.java +++ b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/JNI_RFFIFactory.java @@ -31,7 +31,6 @@ import com.oracle.truffle.r.runtime.ffi.CRFFI; import com.oracle.truffle.r.runtime.ffi.CallRFFI; import com.oracle.truffle.r.runtime.ffi.DLL; import com.oracle.truffle.r.runtime.ffi.DLLRFFI; -import com.oracle.truffle.r.runtime.ffi.GridRFFI; import com.oracle.truffle.r.runtime.ffi.LapackRFFI; import com.oracle.truffle.r.runtime.ffi.LibPaths; import com.oracle.truffle.r.runtime.ffi.MiscRFFI; @@ -44,7 +43,6 @@ import com.oracle.truffle.r.runtime.ffi.StatsRFFI; import com.oracle.truffle.r.runtime.ffi.ToolsRFFI; import com.oracle.truffle.r.runtime.ffi.UserRngRFFI; import com.oracle.truffle.r.runtime.ffi.ZipRFFI; -import com.oracle.truffle.r.runtime.ffi.generic.Generic_Grid; import com.oracle.truffle.r.runtime.ffi.generic.Generic_Tools; /** @@ -146,17 +144,6 @@ public class JNI_RFFIFactory extends RFFIFactory implements RFFI { return toolsRFFI; } - @CompilationFinal private GridRFFI gridRFFI; - - @Override - public GridRFFI getGridRFFI() { - if (gridRFFI == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - gridRFFI = new Generic_Grid(); - } - return gridRFFI; - } - @CompilationFinal private UserRngRFFI userRngRFFI; @Override diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/GridRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/GridRFFI.java deleted file mode 100644 index 43082161ce..0000000000 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/GridRFFI.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.truffle.r.runtime.ffi; - -import com.oracle.truffle.api.nodes.Node; -import com.oracle.truffle.r.runtime.env.REnvironment; - -public interface GridRFFI { - abstract class InitGridNode extends Node { - public abstract Object execute(REnvironment gridEvalEnv); - - public static InitGridNode create() { - return RFFIFactory.getRFFI().getGridRFFI().createInitGridNode(); - } - } - - abstract class KillGridNode extends Node { - - public abstract Object execute(); - - public static KillGridNode create() { - return RFFIFactory.getRFFI().getGridRFFI().createKillGridNode(); - } - } - - InitGridNode createInitGridNode(); - - KillGridNode createKillGridNode(); -} diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFI.java index ccc6224ba1..12c23e7e6d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,8 +61,6 @@ public interface RFFI { ToolsRFFI getToolsRFFI(); - GridRFFI getGridRFFI(); - CRFFI getCRFFI(); CallRFFI getCallRFFI(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_RFFIFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_RFFIFactory.java index f5ec388349..36a30ba75a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_RFFIFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_RFFIFactory.java @@ -31,7 +31,6 @@ import com.oracle.truffle.r.runtime.ffi.BaseRFFI; import com.oracle.truffle.r.runtime.ffi.CRFFI; import com.oracle.truffle.r.runtime.ffi.CallRFFI; import com.oracle.truffle.r.runtime.ffi.DLLRFFI; -import com.oracle.truffle.r.runtime.ffi.GridRFFI; import com.oracle.truffle.r.runtime.ffi.LapackRFFI; import com.oracle.truffle.r.runtime.ffi.MiscRFFI; import com.oracle.truffle.r.runtime.ffi.PCRERFFI; @@ -109,22 +108,6 @@ public class Managed_RFFIFactory extends RFFIFactory implements RFFI { }; } - // TODO: will be removed anyway - @Override - public GridRFFI getGridRFFI() { - return new GridRFFI() { - @Override - public InitGridNode createInitGridNode() { - return null; - } - - @Override - public KillGridNode createKillGridNode() { - return null; - } - }; - } - @Override public CRFFI getCRFFI() { return new CRFFI() { diff --git a/mx.fastr/copyrights/overrides b/mx.fastr/copyrights/overrides index 45a5520630..b767f7c545 100644 --- a/mx.fastr/copyrights/overrides +++ b/mx.fastr/copyrights/overrides @@ -1,6 +1,5 @@ com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/graphics/RGraphics.java,gnu_r_graphics.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/graphics/RGridGraphicsAdapter.java,gnu_r_graphics.copyright -com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/grid/GridFunctions.java,gnu_r_murrel_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/methods/MethodsListDispatch.java,gnu_r.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/methods/Slot.java,gnu_r.copyright com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Arithmetic.java,gnu_r_gentleman_ihaka.copyright -- GitLab