From 033901a8df0b46323f74fbae961cbe35dd22c0ae Mon Sep 17 00:00:00 2001 From: Lukas Stadler <lukas.stadler@oracle.com> Date: Thu, 10 Aug 2017 14:26:30 +0200 Subject: [PATCH] remove special handling of appl functions --- .../r/ffi/impl/llvm/TruffleLLVM_Misc.java | 19 +++ .../r/ffi/impl/llvm/TruffleLLVM_RAppl.java | 107 ------------- .../impl/llvm/TruffleLLVM_RFFIFactory.java | 12 -- .../ffi/impl/managed/Managed_RFFIFactory.java | 48 +----- .../r/ffi/impl/nfi/NativeFunction.java | 9 +- .../r/ffi/impl/nfi/TruffleNFI_Misc.java | 18 +++ .../r/ffi/impl/nfi/TruffleNFI_RAppl.java | 147 ------------------ .../ffi/impl/nfi/TruffleNFI_RFFIFactory.java | 12 -- .../fficall/src/truffle_common/appl_rffi.c | 60 ------- .../library/base/src/registration.c | 12 +- .../r/nodes/builtin/base/foreign/Dqrcf.java | 77 --------- .../r/nodes/builtin/base/foreign/Dqrdc2.java | 73 --------- .../r/nodes/builtin/base/foreign/Dqrqty.java | 79 ---------- .../r/nodes/builtin/base/foreign/Dqrqy.java | 79 ---------- .../r/nodes/builtin/base/foreign/Dqrrsd.java | 79 ---------- .../r/nodes/builtin/base/foreign/Dqrxb.java | 79 ---------- .../base/foreign/FortranAndCFunctions.java | 17 +- .../r/nodes/builtin/fastr/FastrDqrls.java | 4 +- .../truffle/r/nodes/test/ExtBuiltinsList.java | 2 - .../truffle/r/runtime/ffi/MiscRFFI.java | 9 ++ .../truffle/r/runtime/ffi/RApplRFFI.java | 103 ------------ .../oracle/truffle/r/runtime/ffi/RFFI.java | 4 - .../truffle/r/runtime/ffi/RFFIFactory.java | 4 - mx.fastr/copyrights/overrides | 2 - 24 files changed, 63 insertions(+), 992 deletions(-) delete mode 100644 com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java delete mode 100644 com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java delete mode 100644 com.oracle.truffle.r.native/fficall/src/truffle_common/appl_rffi.c delete mode 100644 com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java delete mode 100644 com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrdc2.java delete mode 100644 com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqty.java delete mode 100644 com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqy.java delete mode 100644 com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrrsd.java delete mode 100644 com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrxb.java delete mode 100644 com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Misc.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Misc.java index b37f1c2405..4f05321086 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Misc.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_Misc.java @@ -40,8 +40,27 @@ public class TruffleLLVM_Misc implements MiscRFFI { } } + private static final class TruffleLLVM_DqrlsNode extends TruffleLLVM_DownCallNode implements DqrlsNode { + + @Override + protected NativeFunction getFunction() { + return NativeFunction.dqrls; + } + + @Override + public void execute(double[] x, int n, int p, double[] y, int ny, double tol, double[] b, double[] rsd, double[] qty, int[] k, int[] jpvt, double[] qraux, double[] work) { + call(x, n, p, y, ny, tol, b, rsd, qty, k, jpvt, qraux, work); + } + } + @Override public ExactSumNode createExactSumNode() { return new TruffleLLVM_ExactSumNode(); } + + @Override + public DqrlsNode createDqrlsNode() { + return new TruffleLLVM_DqrlsNode(); + } + } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java deleted file mode 100644 index a69785d17c..0000000000 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RAppl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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 - * 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.ffi.impl.llvm; - -import com.oracle.truffle.r.ffi.impl.nfi.NativeFunction; -import com.oracle.truffle.r.runtime.RInternalError; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; - -/** - * See the comments in {@link TruffleLLVM_Lapack} regarding argument passing. - */ -public class TruffleLLVM_RAppl implements RApplRFFI { - - private static final class TruffleLLVM_Dqrdc2Node extends TruffleLLVM_DownCallNode implements Dqrdc2Node { - - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrdc2; - } - - @Override - public void execute(double[] x, int ldx, int n, int p, double tol, int[] rank, double[] qraux, int[] pivot, double[] work) { - call(x, ldx, n, p, tol, rank, qraux, pivot, work); - } - } - - private static final class TruffleLLVM_DqrcfNode extends TruffleLLVM_DownCallNode implements DqrcfNode { - - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrcf; - } - - @Override - public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] b, int[] info) { - call(x, n, k, qraux, y, ny, b, info); - } - } - - private static final class TruffleLLVM_DqrlsNode extends TruffleLLVM_DownCallNode implements DqrlsNode { - - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrls; - } - - @Override - public void execute(double[] x, int n, int p, double[] y, int ny, double tol, double[] b, double[] rsd, double[] qty, int[] k, int[] jpvt, double[] qraux, double[] work) { - call(x, n, p, y, ny, tol, b, rsd, qty, k, jpvt, qraux, work); - } - } - - @Override - public Dqrdc2Node createDqrdc2Node() { - return new TruffleLLVM_Dqrdc2Node(); - } - - @Override - public DqrcfNode createDqrcfNode() { - return new TruffleLLVM_DqrcfNode(); - } - - @Override - public DqrlsNode createDqrlsNode() { - return new TruffleLLVM_DqrlsNode(); - } - - @Override - public DqrqtyNode createDqrqtyNode() { - throw RInternalError.unimplemented(); - } - - @Override - public DqrqyNode createDqrqyNode() { - throw RInternalError.unimplemented(); - } - - @Override - public DqrrsdNode createDqrrsdNode() { - throw RInternalError.unimplemented(); - } - - @Override - public DqrxbNode createDqrxbNode() { - throw RInternalError.unimplemented(); - } -} diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RFFIFactory.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RFFIFactory.java index bf6b5230a5..b15ebf8a65 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RFFIFactory.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_RFFIFactory.java @@ -32,7 +32,6 @@ import com.oracle.truffle.r.runtime.ffi.DLLRFFI; import com.oracle.truffle.r.runtime.ffi.LapackRFFI; import com.oracle.truffle.r.runtime.ffi.MiscRFFI; import com.oracle.truffle.r.runtime.ffi.PCRERFFI; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI; import com.oracle.truffle.r.runtime.ffi.RFFI; import com.oracle.truffle.r.runtime.ffi.RFFIFactory; @@ -119,17 +118,6 @@ public class TruffleLLVM_RFFIFactory extends RFFIFactory { return truffleStatsRFFI; } - @CompilationFinal private RApplRFFI rApplRFFI; - - @Override - public RApplRFFI getRApplRFFI() { - CompilerAsserts.neverPartOfCompilation(); - if (rApplRFFI == null) { - rApplRFFI = new TruffleLLVM_RAppl(); - } - return rApplRFFI; - } - @CompilationFinal private LapackRFFI lapackRFFI; @Override diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java index 7bc9be3b72..2bd86ac7f2 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_RFFIFactory.java @@ -26,7 +26,6 @@ import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError.Message; -import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.context.RContext.ContextState; import com.oracle.truffle.r.runtime.ffi.BaseRFFI; @@ -36,7 +35,6 @@ import com.oracle.truffle.r.runtime.ffi.DLLRFFI; import com.oracle.truffle.r.runtime.ffi.LapackRFFI; import com.oracle.truffle.r.runtime.ffi.MiscRFFI; import com.oracle.truffle.r.runtime.ffi.PCRERFFI; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI; import com.oracle.truffle.r.runtime.ffi.RFFI; import com.oracle.truffle.r.runtime.ffi.RFFIFactory; @@ -67,47 +65,6 @@ public class Managed_RFFIFactory extends RFFIFactory { return new Managed_LapackRFFI(); } - @Override - public RApplRFFI getRApplRFFI() { - CompilerAsserts.neverPartOfCompilation(); - return new RApplRFFI() { - @Override - public Dqrdc2Node createDqrdc2Node() { - throw unsupported("dqrdc"); - } - - @Override - public DqrcfNode createDqrcfNode() { - throw unsupported("dqrcf"); - } - - @Override - public DqrlsNode createDqrlsNode() { - throw unsupported("dqrls"); - } - - @Override - public DqrqtyNode createDqrqtyNode() { - throw RInternalError.unimplemented(); - } - - @Override - public DqrqyNode createDqrqyNode() { - throw RInternalError.unimplemented(); - } - - @Override - public DqrrsdNode createDqrrsdNode() { - throw RInternalError.unimplemented(); - } - - @Override - public DqrxbNode createDqrxbNode() { - throw RInternalError.unimplemented(); - } - }; - } - @Override public StatsRFFI getStatsRFFI() { CompilerAsserts.neverPartOfCompilation(); @@ -245,6 +202,11 @@ public class Managed_RFFIFactory extends RFFIFactory { public ExactSumNode createExactSumNode() { throw unsupported("exactsum"); } + + @Override + public DqrlsNode createDqrlsNode() { + throw unsupported("dqrls"); + } }; } }; diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NativeFunction.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NativeFunction.java index d475068ea4..aafc59585c 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NativeFunction.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/NativeFunction.java @@ -54,14 +54,6 @@ public enum NativeFunction { getcapturenames("((sint32, string): void, uint64, uint64): sint32", "call_pcre_"), study("(uint64, sint32): void", "call_pcre_"), exec("(uint64, uint64, [uint8], sint32, sint32, sint32, [sint32], sint32): sint32", "call_pcre_"), - // RAppl - dqrdc2("([double], sint32, sint32, sint32, double, [sint32], [double], [sint32], [double]): void", "call_appl_"), - dqrcf("([double], sint32, sint32, [double], [double], sint32, [double], [sint32]): void", "call_appl_"), - dqrls("([double], sint32, sint32, [double], sint32, double, [double], [double], [double], [sint32], [sint32], [double], [double]): void", "call_appl_"), - dqrqty("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), - dqrqy("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), - dqrrsd("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), - dqrxb("([double], sint32, sint32, [double], [double], sint32, [double]): void", "call_appl_"), // zip compress("([uint8], uint64, [uint8], uint64): sint32", "call_zip_"), uncompress("([uint8], uint64, [uint8], uint64): sint32", "call_zip_"), @@ -83,6 +75,7 @@ public enum NativeFunction { "call_lapack_"), // misc exactSumFunc("([double], sint32, sint32, sint32): double", "call_misc_"), + dqrls("([double], sint32, sint32, [double], sint32, double, [double], [double], [double], [sint32], [sint32], [double], [double]): void", "call_appl_"), // stats fft_factor("(sint32, [sint32], [sint32]): void", TruffleNFI_Utils::lookupAndBindStats), fft_work("([double], sint32, sint32, sint32, sint32, [double], [sint32]): sint32", TruffleNFI_Utils::lookupAndBindStats); diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Misc.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Misc.java index 9842145846..f4afd4b699 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Misc.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Misc.java @@ -38,8 +38,26 @@ public class TruffleNFI_Misc implements MiscRFFI { } } + private static class TruffleNFI_DqrlsNode extends TruffleNFI_DownCallNode implements DqrlsNode { + @Override + protected NativeFunction getFunction() { + return NativeFunction.dqrls; + } + + @Override + public void execute(double[] x, int n, int p, double[] y, int ny, double tol, double[] b, double[] rsd, double[] qty, int[] k, int[] jpvt, double[] qraux, double[] work) { + call(x, n, p, y, ny, tol, b, rsd, qty, k, jpvt, qraux, work); + } + } + @Override public ExactSumNode createExactSumNode() { return new TruffleNFI_ExactSumNode(); } + + @Override + public DqrlsNode createDqrlsNode() { + return new TruffleNFI_DqrlsNode(); + } + } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java deleted file mode 100644 index 9e1d662147..0000000000 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RAppl.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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 - * 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.ffi.impl.nfi; - -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; - -public class TruffleNFI_RAppl implements RApplRFFI { - - private static class TruffleNFI_Dqrdc2Node extends TruffleNFI_DownCallNode implements Dqrdc2Node { - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrdc2; - } - - @Override - public void execute(double[] x, int ldx, int n, int p, double tol, int[] rank, double[] qraux, int[] pivot, double[] work) { - call(x, ldx, n, p, tol, rank, qraux, pivot, work); - } - } - - private static class TruffleNFI_DqrcfNode extends TruffleNFI_DownCallNode implements DqrcfNode { - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrcf; - } - - @Override - public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] b, int[] info) { - call(x, n, k, qraux, y, ny, b, info); - } - } - - private static class TruffleNFI_DqrlsNode extends TruffleNFI_DownCallNode implements DqrlsNode { - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrls; - } - - @Override - public void execute(double[] x, int n, int p, double[] y, int ny, double tol, double[] b, double[] rsd, double[] qty, int[] k, int[] jpvt, double[] qraux, double[] work) { - call(x, n, p, y, ny, tol, b, rsd, qty, k, jpvt, qraux, work); - } - } - - private static class TruffleNFI_DqrqtyNode extends TruffleNFI_DownCallNode implements DqrqtyNode { - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrqty; - } - - @Override - public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qty) { - call(x, n, k, qraux, y, ny, qty); - } - } - - private static class TruffleNFI_DqrqyNode extends TruffleNFI_DownCallNode implements DqrqyNode { - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrqy; - } - - @Override - public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qy) { - call(x, n, k, qraux, y, ny, qy); - } - } - - private static class TruffleNFI_DqrrsdNode extends TruffleNFI_DownCallNode implements DqrrsdNode { - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrrsd; - } - - @Override - public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] rsd) { - call(x, n, k, qraux, y, ny, rsd); - } - } - - private static class TruffleNFI_DqrxbNode extends TruffleNFI_DownCallNode implements DqrxbNode { - @Override - protected NativeFunction getFunction() { - return NativeFunction.dqrxb; - } - - @Override - public void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] xb) { - call(x, n, k, qraux, y, ny, xb); - } - } - - @Override - public Dqrdc2Node createDqrdc2Node() { - return new TruffleNFI_Dqrdc2Node(); - } - - @Override - public DqrcfNode createDqrcfNode() { - return new TruffleNFI_DqrcfNode(); - } - - @Override - public DqrlsNode createDqrlsNode() { - return new TruffleNFI_DqrlsNode(); - } - - @Override - public DqrqtyNode createDqrqtyNode() { - return new TruffleNFI_DqrqtyNode(); - } - - @Override - public DqrqyNode createDqrqyNode() { - return new TruffleNFI_DqrqyNode(); - } - - @Override - public DqrrsdNode createDqrrsdNode() { - return new TruffleNFI_DqrrsdNode(); - } - - @Override - public DqrxbNode createDqrxbNode() { - return new TruffleNFI_DqrxbNode(); - } -} diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RFFIFactory.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RFFIFactory.java index b141f8be4e..5de7192a15 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RFFIFactory.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_RFFIFactory.java @@ -35,7 +35,6 @@ import com.oracle.truffle.r.runtime.ffi.DLLRFFI; import com.oracle.truffle.r.runtime.ffi.LapackRFFI; import com.oracle.truffle.r.runtime.ffi.MiscRFFI; import com.oracle.truffle.r.runtime.ffi.PCRERFFI; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI; import com.oracle.truffle.r.runtime.ffi.RFFI; import com.oracle.truffle.r.runtime.ffi.RFFIFactory; @@ -159,17 +158,6 @@ public class TruffleNFI_RFFIFactory extends RFFIFactory { return lapackRFFI; } - @CompilationFinal private RApplRFFI rApplRFFI; - - @Override - public RApplRFFI getRApplRFFI() { - CompilerAsserts.neverPartOfCompilation(); - if (rApplRFFI == null) { - rApplRFFI = new TruffleNFI_RAppl(); - } - return rApplRFFI; - } - @CompilationFinal private StatsRFFI statsRFFI; @Override diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_common/appl_rffi.c b/com.oracle.truffle.r.native/fficall/src/truffle_common/appl_rffi.c deleted file mode 100644 index f54ca88773..0000000000 --- a/com.oracle.truffle.r.native/fficall/src/truffle_common/appl_rffi.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -#include <rffiutils.h> - -extern void dqrdc2_(double *x, int *ldx, int *n, int *p, double *tol, int *rank, double *qraux, int* pivot, double *work); -extern void dqrcf_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *b, int* info); -extern void dqrls_(double *x, int *n, int *p, double *y, int *ny, double *tol, double *b, double *rsd, double *qty, int *k, int *jpvt, double *qraux, double *work); -extern void dqrqty_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qty); -extern void dqrqy_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qy); -extern void dqrrsd_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *rsd); -extern void dqrxb_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *xb); - -void call_appl_dqrdc2(double *x, int ldx, int n, int p, double tol, int *rank, double *qraux, int* pivot, double *work) { - dqrdc2_(x, &ldx, &n, &p, &tol, rank, qraux, pivot, work); -} - -void call_appl_dqrcf(double *x, int n, int k, double *qraux, double *y, int ny, double *b, int* info) { - dqrcf_(x, &n, &k, qraux, y, &ny, b, info); -} - -void call_appl_dqrls(double *x, int n, int p, double *y, int ny, double tol, double *b, double *rsd, double *qty, int *k, int *jpvt, double *qraux, double *work) { - dqrls_(x, &n, &p, y, &ny, &tol, b, rsd, qty, k, jpvt, qraux, work); -} - -void call_appl_dqrqty(double *x, int n, int k, double *qraux, double *y, int ny, double *qty) { - dqrqty_(x, &n, &k, qraux, y, &ny, qty); -} - -void call_appl_dqrqy(double *x, int n, int k, double *qraux, double *y, int ny, double *qy) { - dqrqy_(x, &n, &k, qraux, y, &ny, qy); -} - -void call_appl_dqrrsd(double *x, int n, int k, double *qraux, double *y, int ny, double *rsd) { - dqrrsd_(x, &n, &k, qraux, y, &ny, rsd); -} - -void call_appl_dqrxb(double *x, int n, int k, double *qraux, double *y, int ny, double *xb) { - dqrxb_(x, &n, &k, qraux, y, &ny, xb); -} diff --git a/com.oracle.truffle.r.native/library/base/src/registration.c b/com.oracle.truffle.r.native/library/base/src/registration.c index ea4e3a81fd..4681057ce9 100644 --- a/com.oracle.truffle.r.native/library/base/src/registration.c +++ b/com.oracle.truffle.r.native/library/base/src/registration.c @@ -58,12 +58,16 @@ #include <R_ext/Callbacks.h> //#include <Rdynpriv.h> -//#include "basedecl.h" +extern void dqrdc2_(double *x, int *ldx, int *n, int *p, double *tol, int *rank, double *qraux, int* pivot, double *work); +extern void dqrcf_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *b, int* info); +extern void dqrls_(double *x, int *n, int *p, double *y, int *ny, double *tol, double *b, double *rsd, double *qty, int *k, int *jpvt, double *qraux, double *work); +extern void dqrqty_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qty); +extern void dqrqy_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *qy); +extern void dqrrsd_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *rsd); +extern void dqrxb_(double *x, int *n, int *k, double *qraux, double *y, int *ny, double *xb); -//#define FDEF(name, n) {#name, (DL_FUNC) &F77_SYMBOL(name), n, NULL} -// We don't care what the values of these symbols are at this point -#define FDEF(name, n) {#name, (DL_FUNC) NULL, n, NULL} +#define FDEF(name, n) {#name, (DL_FUNC) &(name##_), n, NULL} static R_FortranMethodDef fortranMethods[] = { /* LINPACK */ FDEF(dqrcf, 8), // qr and auxiliaries diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java deleted file mode 100644 index 8a4d7c4ea7..0000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java +++ /dev/null @@ -1,77 +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) 1995-2012, The R Core Team - * Copyright (c) 2003, The R Foundation - * Copyright (c) 2015, 2017, Oracle and/or its affiliates - * - * All rights reserved. - */ -package com.oracle.truffle.r.nodes.builtin.base.foreign; - -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; - -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.RRuntime; -import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RDoubleVector; -import com.oracle.truffle.r.runtime.data.RList; -import com.oracle.truffle.r.runtime.data.RStringVector; -import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; -import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -public abstract class Dqrcf extends RExternalBuiltinNode.Arg8 { - @Child private RApplRFFI.DqrcfNode dqcrfNode = RFFIFactory.getRApplRFFI().createDqrcfNode(); - - private static final String E = RRuntime.NAMES_ATTR_EMPTY_VALUE; - private static final RStringVector DQRCF_NAMES = RDataFactory.createStringVector(new String[]{E, E, E, E, E, E, "coef", "info"}, RDataFactory.COMPLETE_VECTOR); - - static { - Casts casts = new Casts(Dqrcf.class); - casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); - casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); - casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); - casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(6, "b").mustBe(doubleValue()).asDoubleVector(); - casts.arg(7, "info").mustBe(integerValue()).asIntegerVector(); - } - - @Specialization - public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector bVec, RAbstractIntVector infoVec) { - try { - double[] x = xVec.materialize().getDataTemp(); - double[] qraux = qrauxVec.materialize().getDataTemp(); - double[] y = yVec.materialize().getDataTemp(); - double[] b = bVec.materialize().getDataTemp(); - int[] info = infoVec.materialize().getDataTemp(); - dqcrfNode.execute(x, nx, k, qraux, y, ny, b, info); - RDoubleVector coef = RDataFactory.createDoubleVector(b, RDataFactory.COMPLETE_VECTOR); - coef.copyAttributesFrom(bVec); - // @formatter:off - Object[] data = new Object[]{ - RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), - nx, - k, - RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), - RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), - ny, - coef, - RDataFactory.createIntVector(info, RDataFactory.COMPLETE_VECTOR), - }; - // @formatter:on - return RDataFactory.createList(data, DQRCF_NAMES); - - } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { - throw error(RError.Message.INCORRECT_ARG, "dqrcf"); - } - } -} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrdc2.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrdc2.java deleted file mode 100644 index 357bf83269..0000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrdc2.java +++ /dev/null @@ -1,73 +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) 1995-2012, The R Core Team - * Copyright (c) 2003, The R Foundation - * Copyright (c) 2015, 2017, Oracle and/or its affiliates - * - * All rights reserved. - */ -package com.oracle.truffle.r.nodes.builtin.base.foreign; - -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; -import com.oracle.truffle.api.dsl.Specialization; -import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetDimAttributeNode; -import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; -import com.oracle.truffle.r.runtime.RRuntime; -import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RList; -import com.oracle.truffle.r.runtime.data.RStringVector; -import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; -import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -public abstract class Dqrdc2 extends RExternalBuiltinNode.Arg9 { - @Child private RApplRFFI.Dqrdc2Node dqrdc2Node = RFFIFactory.getRApplRFFI().createDqrdc2Node(); - - private static final String E = RRuntime.NAMES_ATTR_EMPTY_VALUE; - private static final RStringVector DQRDC2_NAMES = RDataFactory.createStringVector(new String[]{"qr", E, E, E, E, "rank", "qraux", "pivot", E}, RDataFactory.COMPLETE_VECTOR); - - public static Dqrdc2 create() { - return Dqrdc2NodeGen.create(); - } - - @Child private GetDimAttributeNode getDimNode = GetDimAttributeNode.create(); - - static { - Casts casts = new Casts(Dqrdc2.class); - casts.arg(0, "xVec").mustBe(doubleValue()).asDoubleVector(); - casts.arg(1, "ldx").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(2, "n").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(3, "p").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(4, "tol").mustBe(doubleValue()).asDoubleVector().findFirst(); - casts.arg(5, "rankVec").mustBe(integerValue()).asIntegerVector(); - casts.arg(6, "qrauxVec").mustBe(doubleValue()).asDoubleVector(); - casts.arg(7, "pivotVec").mustBe(integerValue()).asIntegerVector(); - casts.arg(8, "workVec").mustBe(doubleValue()).asDoubleVector(); - } - - @Specialization - public RList dqrdc2(RAbstractDoubleVector xVec, int ldx, int n, int p, double tol, RAbstractIntVector rankVec, RAbstractDoubleVector qrauxVec, RAbstractIntVector pivotVec, - RAbstractDoubleVector workVec) { - double[] x = xVec.materialize().getDataTemp(); - int[] rank = rankVec.materialize().getDataTemp(); - double[] qraux = qrauxVec.materialize().getDataTemp(); - int[] pivot = pivotVec.materialize().getDataTemp(); - dqrdc2Node.execute(x, ldx, n, p, tol, rank, qraux, pivot, workVec.materialize().getDataCopy()); - // @formatter:off - Object[] data = new Object[]{ - RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR, getDimNode.getDimensions(xVec)), - ldx, n, p, tol, - RDataFactory.createIntVector(rank, RDataFactory.COMPLETE_VECTOR), - RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), - RDataFactory.createIntVector(pivot, RDataFactory.COMPLETE_VECTOR), - workVec - }; - // @formatter:on - return RDataFactory.createList(data, DQRDC2_NAMES); - } -} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqty.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqty.java deleted file mode 100644 index 3a681d4522..0000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqty.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 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.nodes.builtin.base.foreign; - -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; - -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.RDataFactory; -import com.oracle.truffle.r.runtime.data.RDoubleVector; -import com.oracle.truffle.r.runtime.data.RList; -import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -public abstract class Dqrqty extends RExternalBuiltinNode.Arg7 { - @Child private RApplRFFI.DqrqtyNode dqrqtyNode = RFFIFactory.getRApplRFFI().createDqrqtyNode(); - - static { - Casts casts = new Casts(Dqrqty.class); - casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); - casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); - casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); - casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(6, "b").mustBe(doubleValue()).asDoubleVector(); - } - - @Specialization - public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector bVec) { - try { - double[] x = xVec.materialize().getDataTemp(); - double[] qraux = qrauxVec.materialize().getDataTemp(); - double[] y = yVec.materialize().getDataTemp(); - double[] b = bVec.materialize().getDataTemp(); - dqrqtyNode.execute(x, nx, k, qraux, y, ny, b); - RDoubleVector coef = RDataFactory.createDoubleVector(b, RDataFactory.COMPLETE_VECTOR); - coef.copyAttributesFrom(bVec); - // @formatter:off - Object[] data = new Object[]{ - RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), - nx, - k, - RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), - RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), - ny, - coef, - }; - // @formatter:on - return RDataFactory.createList(data); - - } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { - throw error(RError.Message.INCORRECT_ARG, "dqrqty"); - } - } -} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqy.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqy.java deleted file mode 100644 index 9ccdf43844..0000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrqy.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 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.nodes.builtin.base.foreign; - -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; - -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.RDataFactory; -import com.oracle.truffle.r.runtime.data.RDoubleVector; -import com.oracle.truffle.r.runtime.data.RList; -import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -public abstract class Dqrqy extends RExternalBuiltinNode.Arg7 { - @Child private RApplRFFI.DqrqyNode dqrqyNode = RFFIFactory.getRApplRFFI().createDqrqyNode(); - - static { - Casts casts = new Casts(Dqrqy.class); - casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); - casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); - casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); - casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(6, "b").mustBe(doubleValue()).asDoubleVector(); - } - - @Specialization - public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector bVec) { - try { - double[] x = xVec.materialize().getDataTemp(); - double[] qraux = qrauxVec.materialize().getDataTemp(); - double[] y = yVec.materialize().getDataTemp(); - double[] b = bVec.materialize().getDataTemp(); - dqrqyNode.execute(x, nx, k, qraux, y, ny, b); - RDoubleVector coef = RDataFactory.createDoubleVector(b, RDataFactory.COMPLETE_VECTOR); - coef.copyAttributesFrom(bVec); - // @formatter:off - Object[] data = new Object[]{ - RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), - nx, - k, - RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), - RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), - ny, - coef, - }; - // @formatter:on - return RDataFactory.createList(data); - - } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { - throw error(RError.Message.INCORRECT_ARG, "dqrqy"); - } - } -} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrrsd.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrrsd.java deleted file mode 100644 index 23b66ab9b3..0000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrrsd.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 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.nodes.builtin.base.foreign; - -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; - -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.RDataFactory; -import com.oracle.truffle.r.runtime.data.RDoubleVector; -import com.oracle.truffle.r.runtime.data.RList; -import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -public abstract class Dqrrsd extends RExternalBuiltinNode.Arg7 { - @Child private RApplRFFI.DqrrsdNode dqrrsdNode = RFFIFactory.getRApplRFFI().createDqrrsdNode(); - - static { - Casts casts = new Casts(Dqrrsd.class); - casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); - casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); - casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); - casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(6, "rsd").mustBe(doubleValue()).asDoubleVector(); - } - - @Specialization - public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector rsdVec) { - try { - double[] x = xVec.materialize().getDataTemp(); - double[] qraux = qrauxVec.materialize().getDataTemp(); - double[] y = yVec.materialize().getDataTemp(); - double[] rsd = rsdVec.materialize().getDataTemp(); - dqrrsdNode.execute(x, nx, k, qraux, y, ny, rsd); - RDoubleVector coef = RDataFactory.createDoubleVector(rsd, RDataFactory.COMPLETE_VECTOR); - coef.copyAttributesFrom(rsdVec); - // @formatter:off - Object[] data = new Object[]{ - RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), - nx, - k, - RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), - RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), - ny, - coef, - }; - // @formatter:on - return RDataFactory.createList(data); - - } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { - throw error(RError.Message.INCORRECT_ARG, "dqrrsd"); - } - } -} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrxb.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrxb.java deleted file mode 100644 index 6702b7633d..0000000000 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrxb.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 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.nodes.builtin.base.foreign; - -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.doubleValue; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; - -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.RDataFactory; -import com.oracle.truffle.r.runtime.data.RDoubleVector; -import com.oracle.truffle.r.runtime.data.RList; -import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; - -public abstract class Dqrxb extends RExternalBuiltinNode.Arg7 { - @Child private RApplRFFI.DqrxbNode dqrrsdNode = RFFIFactory.getRApplRFFI().createDqrxbNode(); - - static { - Casts casts = new Casts(Dqrxb.class); - casts.arg(0, "x").mustBe(doubleValue()).asDoubleVector(); - casts.arg(1, "nx").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(2, "k").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(3, "qraux").mustBe(doubleValue()).asDoubleVector(); - casts.arg(4, "y").mustBe(doubleValue()).asDoubleVector(); - casts.arg(5, "ny").mustBe(integerValue()).asIntegerVector().findFirst(); - casts.arg(6, "xb").mustBe(doubleValue()).asDoubleVector(); - } - - @Specialization - public RList dqrcf(RAbstractDoubleVector xVec, int nx, int k, RAbstractDoubleVector qrauxVec, RAbstractDoubleVector yVec, int ny, RAbstractDoubleVector xbVec) { - try { - double[] x = xVec.materialize().getDataTemp(); - double[] qraux = qrauxVec.materialize().getDataTemp(); - double[] y = yVec.materialize().getDataTemp(); - double[] xb = xbVec.materialize().getDataTemp(); - dqrrsdNode.execute(x, nx, k, qraux, y, ny, xb); - RDoubleVector coef = RDataFactory.createDoubleVector(xb, RDataFactory.COMPLETE_VECTOR); - coef.copyAttributesFrom(xbVec); - // @formatter:off - Object[] data = new Object[]{ - RDataFactory.createDoubleVector(x, RDataFactory.COMPLETE_VECTOR), - nx, - k, - RDataFactory.createDoubleVector(qraux, RDataFactory.COMPLETE_VECTOR), - RDataFactory.createDoubleVector(y, RDataFactory.COMPLETE_VECTOR), - ny, - coef, - }; - // @formatter:on - return RDataFactory.createList(data); - - } catch (ClassCastException | ArrayIndexOutOfBoundsException ex) { - throw error(RError.Message.INCORRECT_ARG, "dqrxb"); - } - } -} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java index a0f416daf6..a4a9546852 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java @@ -79,22 +79,7 @@ public class FortranAndCFunctions { @Override @TruffleBoundary public RExternalBuiltinNode lookupBuiltin(RList symbol) { - switch (LookupAdapter.lookupName(symbol)) { - case "dqrdc2": - return Dqrdc2.create(); - case "dqrcf": - return DqrcfNodeGen.create(); - case "dqrqty": - return DqrqtyNodeGen.create(); - case "dqrqy": - return DqrqyNodeGen.create(); - case "dqrrsd": - return DqrrsdNodeGen.create(); - case "dqrxb": - return DqrxbNodeGen.create(); - default: - return null; - } + return null; } @SuppressWarnings("unused") diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastrDqrls.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastrDqrls.java index c5f6be6387..c5f56bb36d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastrDqrls.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastrDqrls.java @@ -28,7 +28,7 @@ import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; -import com.oracle.truffle.r.runtime.ffi.RApplRFFI; +import com.oracle.truffle.r.runtime.ffi.MiscRFFI; import com.oracle.truffle.r.runtime.ffi.RFFIFactory; /** @@ -37,7 +37,7 @@ import com.oracle.truffle.r.runtime.ffi.RFFIFactory; */ @RBuiltin(name = ".fastr.dqrls", visibility = OFF, kind = PRIMITIVE, parameterNames = {"x", "n", "p", "y", "ny", "tol", "coeff"}, behavior = PURE) public abstract class FastrDqrls extends RBuiltinNode.Arg7 { - @Child private RApplRFFI.DqrlsNode dqrlsNode = RFFIFactory.getRApplRFFI().createDqrlsNode(); + @Child private MiscRFFI.DqrlsNode dqrlsNode = RFFIFactory.getMiscRFFI().createDqrlsNode(); private static final String[] NAMES = new String[]{"qr", "coefficients", "residuals", "effects", "rank", "pivot", "qraux", "tol", "pivoted"}; private static RStringVector namesVector = null; 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 f7488cc482..22db6fbbd0 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 @@ -50,8 +50,6 @@ public class ExtBuiltinsList { com.oracle.truffle.r.nodes.builtin.base.foreign.MakeQuartzDefault.class, com.oracle.truffle.r.nodes.builtin.base.foreign.Flushconsole.class, com.oracle.truffle.r.nodes.builtin.base.foreign.FftNodeGen.class, - com.oracle.truffle.r.nodes.builtin.base.foreign.Dqrdc2NodeGen.class, - com.oracle.truffle.r.nodes.builtin.base.foreign.Dqrcf.class, com.oracle.truffle.r.nodes.builtin.base.foreign.CairoPropsNodeGen.class, com.oracle.truffle.r.library.tools.ToolsTextFactory.DoTabExpandNodeGen.class, com.oracle.truffle.r.library.tools.ToolsTextFactory.CodeFilesAppendNodeGen.class, diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/MiscRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/MiscRFFI.java index 7f20d3f638..9fb02a1e8e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/MiscRFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/MiscRFFI.java @@ -37,6 +37,15 @@ public interface MiscRFFI { } } + interface DqrlsNode extends NodeInterface { + void execute(double[] x, int n, int p, double[] y, int ny, double tol, double[] b, double[] rsd, double[] qty, int[] k, int[] jpvt, double[] qraux, double[] work); + + static DqrlsNode create() { + return RFFIFactory.getMiscRFFI().createDqrlsNode(); + } + } + ExactSumNode createExactSumNode(); + DqrlsNode createDqrlsNode(); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java deleted file mode 100644 index 1134a3c705..0000000000 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RApplRFFI.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 - * 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.NodeInterface; - -/** - * Collection of statically typed methods (from Linpack and elsewhere) that are built in to a GnuR - * implementation and factored out into a separate library in FastR. This corresponds to the - * {@code libappl} library in GnuR. - */ -public interface RApplRFFI { - interface Dqrdc2Node extends NodeInterface { - void execute(double[] x, int ldx, int n, int p, double tol, int[] rank, double[] qraux, int[] pivot, double[] work); - - static Dqrdc2Node create() { - return RFFIFactory.getRApplRFFI().createDqrdc2Node(); - } - } - - interface DqrcfNode extends NodeInterface { - void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] b, int[] info); - - static Dqrdc2Node create() { - return RFFIFactory.getRApplRFFI().createDqrdc2Node(); - } - } - - interface DqrlsNode extends NodeInterface { - void execute(double[] x, int n, int p, double[] y, int ny, double tol, double[] b, double[] rsd, double[] qty, int[] k, int[] jpvt, double[] qraux, double[] work); - - static DqrlsNode create() { - return RFFIFactory.getRApplRFFI().createDqrlsNode(); - } - } - - interface DqrqtyNode extends NodeInterface { - void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qty); - - static DqrqtyNode create() { - - return RFFIFactory.getRApplRFFI().createDqrqtyNode(); - } - } - - interface DqrqyNode extends NodeInterface { - void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] qy); - - static DqrqyNode create() { - return RFFIFactory.getRApplRFFI().createDqrqyNode(); - } - } - - interface DqrrsdNode extends NodeInterface { - void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] rsd); - - static DqrrsdNode create() { - return RFFIFactory.getRApplRFFI().createDqrrsdNode(); - } - } - - interface DqrxbNode extends NodeInterface { - void execute(double[] x, int n, int k, double[] qraux, double[] y, int ny, double[] xb); - - static DqrxbNode create() { - return RFFIFactory.getRApplRFFI().createDqrxbNode(); - } - } - - Dqrdc2Node createDqrdc2Node(); - - DqrcfNode createDqrcfNode(); - - DqrlsNode createDqrlsNode(); - - DqrqtyNode createDqrqtyNode(); - - DqrqyNode createDqrqyNode(); - - DqrrsdNode createDqrrsdNode(); - - DqrxbNode createDqrxbNode(); -} 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 6c517528b9..614b7f2693 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 @@ -32,8 +32,6 @@ package com.oracle.truffle.r.runtime.ffi; * {@code Lapack} functions.</li> * <li>{@link StatsRFFI}: native functions in the {@code stats} package.</li> * <li>{@link ToolsRFFI}: native functions in the {@code tools} package.</li> - * <li>{@link RApplRFFI}: the specific, typed, foreign functions required by the built-in - * {@code Linpack} functions.</li> * <li>{@link CRFFI}: {@code .C} and {@code .Fortran} call interface.</li> * <li>{@link CallRFFI}: {@code .Call} and {@code .External} call interface.</li> * <li>{@link UserRngRFFI}: specific interface to user-supplied random number generator.</li> @@ -54,8 +52,6 @@ public interface RFFI { LapackRFFI getLapackRFFI(); - RApplRFFI getRApplRFFI(); - StatsRFFI getStatsRFFI(); ToolsRFFI getToolsRFFI(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIFactory.java index 9311022ead..f0ae3fa3a1 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIFactory.java @@ -121,10 +121,6 @@ public abstract class RFFIFactory { return getRFFI().getLapackRFFI(); } - public static RApplRFFI getRApplRFFI() { - return getRFFI().getRApplRFFI(); - } - public static StatsRFFI getStatsRFFI() { return getRFFI().getStatsRFFI(); } diff --git a/mx.fastr/copyrights/overrides b/mx.fastr/copyrights/overrides index aad66d1261..e69add7b7a 100644 --- a/mx.fastr/copyrights/overrides +++ b/mx.fastr/copyrights/overrides @@ -120,8 +120,6 @@ com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/E com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FileFunctions.java,gnu_r.copyright com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CairoProps.java,gnu_r.copyright com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java,gnu_r.copyright -com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrcf.java,gnu_r.copyright -com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Dqrdc2.java,gnu_r.copyright com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Fft.java,gnu_r.copyright com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/Flushconsole.java,gnu_r.copyright com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/FortranAndCFunctions.java,gnu_r.copyright -- GitLab