From 8b7750d83f02986421d25ab3f5b76615aa3c97e6 Mon Sep 17 00:00:00 2001 From: Lukas Stadler <lukas.stadler@oracle.com> Date: Tue, 13 Feb 2018 15:12:25 +0100 Subject: [PATCH] cleanups --- .../com/oracle/truffle/r/engine/REngine.java | 6 --- .../engine/shell/EmbeddedConsoleHandler.java | 10 ++--- .../truffle/r/engine/shell/REmbedded.java | 33 ++++++++-------- .../llvm/TruffleLLVM_DownCallNodeFactory.java | 4 +- .../managed/Managed_DownCallNodeFactory.java | 14 +++---- .../r/ffi/impl/nfi/TruffleNFI_Call.java | 1 - .../r/ffi/impl/nfi/TruffleNFI_Context.java | 8 ++-- .../nfi/TruffleNFI_DownCallNodeFactory.java | 5 +-- .../ffi/impl/nodes/AttributesAccessNodes.java | 2 +- .../truffle/r/ffi/impl/nodes/MiscNodes.java | 1 - .../truffle/r/ffi/impl/nodes/RfEvalNode.java | 2 - .../oracle/truffle/r/launcher/Launcher.java | 3 +- .../truffle/r/launcher/RCmdOptions.java | 29 ++++---------- .../truffle/r/launcher/RStartParams.java | 8 ++-- .../r/library/fastrGrid/GridColorUtils.java | 13 +++---- .../truffle/r/library/fastrGrid/Unit.java | 35 +++++++++-------- .../r/library/fastrGrid/color/RGB.java | 1 - .../r/library/fastrGrid/device/SVGDevice.java | 8 ++-- .../device/awt/Graphics2DDevice.java | 20 +++++----- .../fastrGrid/device/awt/JFrameDevice.java | 5 +-- .../grDevices/OpenDefaultDevice.java | 3 +- .../truffle/r/library/tools/C_ParseRd.java | 5 +-- .../r/nodes/builtin/base/AsVector.java | 6 +-- .../r/nodes/builtin/base/BetaFunctions.java | 4 +- .../truffle/r/nodes/builtin/base/Bind.java | 1 - .../truffle/r/nodes/builtin/base/CharTr.java | 3 -- .../truffle/r/nodes/builtin/base/Combine.java | 1 - .../truffle/r/nodes/builtin/base/DoCall.java | 33 +++++++--------- .../r/nodes/builtin/base/FileFunctions.java | 38 +++++++++---------- .../r/nodes/builtin/base/FindInterval.java | 4 +- .../r/nodes/builtin/base/FormatInfo.java | 5 +-- .../r/nodes/builtin/base/FrameFunctions.java | 26 ++++++------- .../r/nodes/builtin/base/LaFunctions.java | 2 - .../truffle/r/nodes/builtin/base/Match.java | 14 +++---- .../nodes/builtin/base/OptionsFunctions.java | 2 +- .../builtin/base/SerializeFunctions.java | 4 +- .../r/nodes/builtin/base/Substitute.java | 14 +++---- .../truffle/r/nodes/builtin/base/Typeof.java | 1 - .../r/nodes/builtin/base/UpdateNames.java | 1 + .../r/nodes/builtin/base/infix/Subscript.java | 8 ++-- .../r/nodes/builtin/base/infix/Subset.java | 4 +- .../r/nodes/builtin/fastr/FastRInterop.java | 2 +- .../builtin/fastr/memprof/FastRprofmem.java | 1 - .../fastr/memprof/FastRprofmemShow.java | 2 - .../fastr/memprof/FastRprofmemSource.java | 1 - .../access/vector/VectorManipulationTest.java | 2 +- .../truffle/r/nodes/casts/CastUtils.java | 14 +++---- .../r/nodes/casts/SamplesCollector.java | 3 +- .../r/nodes/access/AccessArgumentNode.java | 1 - .../access/vector/PositionCheckNode.java | 1 - .../r/nodes/attributes/GetAttributesNode.java | 1 - .../attributes/SetFixedAttributeNode.java | 1 - .../SpecialAttributesFunctions.java | 13 ++++--- .../r/nodes/builtin/EnvironmentNodes.java | 6 +-- .../nodes/builtin/casts/CastForeignNode.java | 30 ++++++--------- .../truffle/r/nodes/builtin/casts/Filter.java | 8 +--- .../builtin/casts/PipelineToCastNode.java | 4 +- .../r/nodes/control/AbstractLoopNode.java | 1 - .../truffle/r/nodes/control/ForNode.java | 24 ++++++------ .../function/FunctionDefinitionNode.java | 3 -- .../function/FunctionExpressionNode.java | 1 - .../truffle/r/nodes/function/RCallNode.java | 26 ++++++------- .../r/nodes/unary/CastComplexNode.java | 1 - .../r/nodes/unary/CastIntegerNode.java | 1 - .../r/nodes/unary/CastLogicalNode.java | 1 - .../truffle/r/nodes/unary/CastRawNode.java | 1 - .../truffle/r/nodes/unary/PrecedenceNode.java | 2 +- .../truffle/r/runtime/FileSystemUtils.java | 3 -- .../r/runtime/LazyResourceHandlerFactory.java | 3 +- .../oracle/truffle/r/runtime/RCleanUp.java | 8 ---- .../com/oracle/truffle/r/runtime/RError.java | 2 +- .../oracle/truffle/r/runtime/RSerialize.java | 4 +- .../oracle/truffle/r/runtime/RSuicide.java | 11 +----- .../truffle/r/runtime/context/EvalThread.java | 12 +----- .../truffle/r/runtime/ffi/BaseRFFI.java | 1 - .../r/runtime/ffi/DownCallNodeFactory.java | 6 +-- .../truffle/r/runtime/ffi/LapackRFFI.java | 4 +- .../truffle/r/runtime/ffi/PCRERFFI.java | 4 +- .../truffle/r/runtime/ffi/RFFIContext.java | 6 ++- .../truffle/r/runtime/ffi/ToolsRFFI.java | 3 +- .../r/runtime/ffi/interop/NativePointer.java | 3 +- .../interop/FastrInteropTryContextState.java | 1 - .../r/runtime/interop/ForeignArray2R.java | 6 +-- .../truffle/r/runtime/nodes/RBaseNode.java | 2 +- .../r/runtime/nodes/RInstrumentableNode.java | 4 -- .../r/test/builtins/TestBuiltin_asvector.java | 3 +- .../r/test/engine/interop/AbstractMRTest.java | 2 +- .../r/test/engine/interop/ListMRTest.java | 4 +- .../test/engine/interop/RFunctionMRTest.java | 9 ++--- .../r/test/library/fastr/TestJavaInterop.java | 12 ------ 90 files changed, 259 insertions(+), 392 deletions(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java index 9ea740469f..52dd4f23b3 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java @@ -36,8 +36,6 @@ import com.oracle.truffle.api.Truffle; import com.oracle.truffle.api.TruffleLanguage.ContextReference; import com.oracle.truffle.api.dsl.UnsupportedSpecializationException; import com.oracle.truffle.api.frame.Frame; -import com.oracle.truffle.api.frame.FrameSlot; -import com.oracle.truffle.api.frame.FrameSlotKind; import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.interop.TruffleObject; @@ -79,7 +77,6 @@ import com.oracle.truffle.r.runtime.RParserFactory; import com.oracle.truffle.r.runtime.RProfile; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RSource; -import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.ReturnException; import com.oracle.truffle.r.runtime.RootWithBody; import com.oracle.truffle.r.runtime.ThreadTimings; @@ -102,14 +99,11 @@ import com.oracle.truffle.r.runtime.data.RSymbol; import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.env.REnvironment; -import com.oracle.truffle.r.runtime.env.frame.ActiveBinding; -import com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor; import com.oracle.truffle.r.runtime.interop.R2Foreign; import com.oracle.truffle.r.runtime.interop.R2ForeignNodeGen; import com.oracle.truffle.r.runtime.nodes.RNode; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -import com.oracle.truffle.r.runtime.rng.RRNG; /** * The engine for the FastR implementation. Handles parsing and evaluation. There is one instance of diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/EmbeddedConsoleHandler.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/EmbeddedConsoleHandler.java index e551bd7148..4af701bbec 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/EmbeddedConsoleHandler.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/EmbeddedConsoleHandler.java @@ -39,12 +39,10 @@ import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.r.launcher.ConsoleHandler; import com.oracle.truffle.r.launcher.DelegatingConsoleHandler; import com.oracle.truffle.r.runtime.RInterfaceCallbacks; -import com.oracle.truffle.r.runtime.ffi.REmbedRFFI; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI.ReadConsoleNode; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI.WriteConsoleBaseNode; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI.WriteConsoleNode; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI.WriteErrConsoleNode; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; /** * In embedded mode the console functions as defined in {@code Rinterface.h} can be overridden. This @@ -138,11 +136,11 @@ public final class EmbeddedConsoleHandler extends DelegatingConsoleHandler { return createOutputSteam(this::getWriteErrCallTarget, defaultValue); } - private OutputStream createOutputSteam(Supplier<CallTarget> writeCallTarget, OutputStream defaultStream) { - return new BufferedOutputStream(new EmbeddedConsoleOutputSteam(writeCallTarget, defaultStream), 128); + private OutputStream createOutputSteam(Supplier<CallTarget> writeCallTargetSupplier, OutputStream defaultStream) { + return new BufferedOutputStream(new EmbeddedConsoleOutputSteam(writeCallTargetSupplier, defaultStream), 128); } - private boolean isOverridden(String name) { + private static boolean isOverridden(String name) { RInterfaceCallbacks clbk = RInterfaceCallbacks.valueOf(name); return clbk.isOverridden(); } @@ -223,7 +221,7 @@ public final class EmbeddedConsoleHandler extends DelegatingConsoleHandler { return writeErrCallTarget; } - private CallTarget createWriteCallTarget(WriteConsoleBaseNode writeConsoleNode) { + private static CallTarget createWriteCallTarget(WriteConsoleBaseNode writeConsoleNode) { return Truffle.getRuntime().createCallTarget(new WriteOutBaseRootNode(writeConsoleNode)); } diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java index e40dcb1c72..f38d6a838c 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/REmbedded.java @@ -54,11 +54,9 @@ import com.oracle.truffle.r.runtime.context.RContext; * Rf_mainloop(); * </pre> * - * {@code Rf_initialize_R} invokes {@link #initializeR(String[], boolean)}, which creates new + * {@code Rf_initialize_R} invokes {@link #initializeR(String[],boolean)}, which creates new * polyglot {@link Context}. The call to {@code R_SetParams} adjusts the values stored in the - * {@link RStartParams} object and then {@code Rf_mainloop}, which calls {@code #setupRmainloop()} - * and then {@link #runRmainloop()}, which will complete the FastR initialization and enter the - * read-eval-print loop. + * {@link RStartParams} object. */ public class REmbedded { @@ -66,10 +64,10 @@ public class REmbedded { private static Context context; /** - * Creates the {@link Engine} and initializes it. Called from native code when FastR is - * embedded. Corresponds to FFI method {@code Rf_initialize_R}. N.B. This does not completely - * initialize FastR as we cannot do that until the embedding system has had a chance to adjust - * the {@link RStartParams}, which happens after this call returns. + * Creates the {@link Engine} and initializes it. Called from native code when FastR is embedded. + * Corresponds to FFI method {@code Rf_initialize_R}. N.B. This does not completely initialize FastR + * as we cannot do that until the embedding system has had a chance to adjust the + * {@link RStartParams}, which happens after this call returns. */ private static void initializeR(String[] args, boolean initMainLoop) { assert context == null; @@ -97,10 +95,10 @@ public class REmbedded { } /** - * Adjusts the values stored in {@link RStartParams}. Invoked from the native embedding code, - * i.e. not from a down-call, so the callbacks native array is not set-up properly. Moreover, - * this call is made during R initialization, so it not entirely clear if the FFI implementation - * has been fully initialized yet. + * Adjusts the values stored in {@link RStartParams}. Invoked from the native embedding code, i.e. + * not from a down-call, so the callbacks native array is not set-up properly. Moreover, this call + * is made during R initialization, so it not entirely clear if the FFI implementation has been + * fully initialized yet. */ @SuppressWarnings("unused") private static void setParams(boolean quietA, boolean slaveA, boolean interactiveA, boolean verboseA, boolean loadSiteFileA, @@ -112,9 +110,9 @@ public class REmbedded { } /** - * N.B. This expression cannot contain any R functions, e.g. "invisible", because at the time it - * is evaluated the R builtins have not been installed, see {@link #initializeR}. The - * suppression of printing is handled a a special case based on {@link Internal#INIT_EMBEDDED}. + * N.B. This expression cannot contain any R functions, e.g. "invisible", because at the time it is + * evaluated the R builtins have not been installed, see {@link #initializeR}. The suppression of + * printing is handled a a special case based on {@link Internal#INIT_EMBEDDED}. */ private static final Source INIT = Source.newBuilder("R", "1", "<embedded>").buildLiteral(); @@ -153,9 +151,8 @@ public class REmbedded { /** * Upcalled from embedded mode via JNI to (really) commit suicide. This provides the default - * implementation of the {@code R_Suicide} function in the {@code Rinterface} API. If an - * embeddee overrides it, it typically will save this value and invoke it after its own - * customization. + * implementation of the {@code R_Suicide} function in the {@code Rinterface} API. If an embeddee + * overrides it, it typically will save this value and invoke it after its own customization. */ @SuppressWarnings("unused") private static void R_Suicide(String msg) { diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DownCallNodeFactory.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DownCallNodeFactory.java index 722f0a242c..8600debf0f 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DownCallNodeFactory.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DownCallNodeFactory.java @@ -50,8 +50,8 @@ final class TruffleLLVM_DownCallNodeFactory extends DownCallNodeFactory { } @Override - public DownCallNode createDownCallNode(NativeFunction function) { - return new DownCallNode(function) { + public DownCallNode createDownCallNode(NativeFunction f) { + return new DownCallNode(f) { @Override protected TruffleObject getTarget(NativeFunction function) { CompilerAsserts.neverPartOfCompilation(); diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_DownCallNodeFactory.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_DownCallNodeFactory.java index 5276e06159..f2141a851c 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_DownCallNodeFactory.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/managed/Managed_DownCallNodeFactory.java @@ -31,7 +31,6 @@ import java.nio.file.attribute.FileAttribute; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.util.EnumSet; -import java.util.List; import java.util.Set; import com.oracle.truffle.api.CallTarget; @@ -56,8 +55,8 @@ public final class Managed_DownCallNodeFactory extends DownCallNodeFactory { } @Override - public DownCallNode createDownCallNode(NativeFunction function) { - return new DownCallNode(function) { + public DownCallNode createDownCallNode(NativeFunction f) { + return new DownCallNode(f) { @Override protected TruffleObject getTarget(NativeFunction function) { if (function == NativeFunction.getpid) { @@ -121,9 +120,8 @@ public final class Managed_DownCallNodeFactory extends DownCallNodeFactory { } /** - * Implements simplified version of the {@code mkdtemp} from {@code stdlib}. The reason why we - * do not use only Java version is that the real {@code mkdtemp} seems to be more reliable and - * secure. + * Implements simplified version of the {@code mkdtemp} from {@code stdlib}. The reason why we do + * not use only Java version is that the real {@code mkdtemp} seems to be more reliable and secure. */ private static final class Mkdtemp implements TruffleObject { private static final FileAttribute<Set<PosixFilePermission>> irwxuPermissions = PosixFilePermissions.asFileAttribute( @@ -177,8 +175,8 @@ public final class Managed_DownCallNodeFactory extends DownCallNodeFactory { } /** - * Gives the current working directory. For some reasons, this is not exactly equivalent to - * calling the C function, which manifests itself during codetools package installation. + * Gives the current working directory. For some reasons, this is not exactly equivalent to calling + * the C function, which manifests itself during codetools package installation. */ private static final class Getwd implements TruffleObject { @Override diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java index eaeb8c8b05..ede11e852a 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Call.java @@ -27,7 +27,6 @@ import static com.oracle.truffle.r.ffi.impl.common.RFFIUtils.traceDownCallReturn import static com.oracle.truffle.r.ffi.impl.common.RFFIUtils.traceEnabled; import com.oracle.truffle.api.CompilerAsserts; -import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.ImportStatic; diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Context.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Context.java index b002c48847..b6f6453876 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Context.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_Context.java @@ -106,9 +106,9 @@ final class TruffleNFI_Context extends RFFIContext { private RuntimeException lastException; /** - * Memory allocated using Rf_alloc, which should be reclaimed at every down-call exit. Note: - * this is less efficient than GNUR's version, we may need to implement it properly should the - * performance be a problem. + * Memory allocated using Rf_alloc, which should be reclaimed at every down-call exit. Note: this is + * less efficient than GNUR's version, we may need to implement it properly should the performance + * be a problem. */ public final ArrayList<Long> transientAllocations = new ArrayList<>(); @@ -203,7 +203,7 @@ final class TruffleNFI_Context extends RFFIContext { } @TruffleBoundary - private long initCallbacksAddress() { + private static long initCallbacksAddress() { // get the address of the native thread local try { Node bind = Message.createInvoke(1).createNode(); diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_DownCallNodeFactory.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_DownCallNodeFactory.java index c54cca485f..2481ed6657 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_DownCallNodeFactory.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_DownCallNodeFactory.java @@ -39,15 +39,14 @@ public final class TruffleNFI_DownCallNodeFactory extends DownCallNodeFactory { } @Override - public DownCallNode createDownCallNode(NativeFunction function) { - return new DownCallNode(function) { + public DownCallNode createDownCallNode(NativeFunction f) { + return new DownCallNode(f) { @Override protected TruffleObject getTarget(NativeFunction function) { // TODO: this lookupNativeFunction function can exist in all FFI Contexts return TruffleNFI_Context.getInstance().lookupNativeFunction(function); } - @SuppressWarnings("cast") @Override @ExplodeLoop protected long beforeCall(NativeFunction function, TruffleObject target, Object[] args) { diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java index fe2516186b..a6d0515c51 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java @@ -153,7 +153,7 @@ public final class AttributesAccessNodes { } @TruffleBoundary - private Object getSymbol(String name) { + private static Object getSymbol(String name) { return RDataFactory.createSymbol(name); } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java index 1b2b55205c..c7259e6558 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java @@ -52,7 +52,6 @@ import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctionsFactory.S import com.oracle.truffle.r.nodes.builtin.EnvironmentNodes.GetFunctionEnvironmentNode; import com.oracle.truffle.r.nodes.builtin.casts.fluent.CastNodeBuilder; import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode; -import com.oracle.truffle.r.nodes.function.call.RExplicitCallNode; import com.oracle.truffle.r.nodes.objects.NewObject; import com.oracle.truffle.r.nodes.objects.NewObjectNodeGen; import com.oracle.truffle.r.nodes.unary.CastNode; diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java index 4b795471d4..a3dd1b686b 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java @@ -26,8 +26,6 @@ import static com.oracle.truffle.r.runtime.RError.Message.ARGUMENT_NOT_ENVIRONME import static com.oracle.truffle.r.runtime.RError.Message.ARGUMENT_NOT_FUNCTION; import static com.oracle.truffle.r.runtime.RError.Message.UNKNOWN_OBJECT; -import org.graalvm.polyglot.Value; - import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Cached; diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/Launcher.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/Launcher.java index 5cd71fdfe9..6e73843f7b 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/Launcher.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, 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 @@ -453,7 +453,6 @@ public abstract class Launcher { } } - @SuppressWarnings("deprecation") protected static void printLanguages(Engine engine, boolean printWhenEmpty) { if (engine.getLanguages().isEmpty()) { if (printWhenEmpty) { diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCmdOptions.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCmdOptions.java index 54f4d5fa33..ae47a2ce3f 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCmdOptions.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RCmdOptions.java @@ -22,9 +22,6 @@ */ package com.oracle.truffle.r.launcher; -import static com.oracle.truffle.r.launcher.RCmdOptions.RCmdOption.HELP; -import static com.oracle.truffle.r.launcher.RCmdOptions.RCmdOption.VERSION; - import java.util.ArrayList; import java.util.EnumMap; import java.util.List; @@ -259,16 +256,16 @@ public final class RCmdOptions { } /** - * Parse the arguments from the standard R/Rscript command line syntax, setting the - * corresponding values. + * Parse the arguments from the standard R/Rscript command line syntax, setting the corresponding + * values. * * R supports {@code --arg=value} or {@code -arg value} for string-valued options. * - * The spec for {@code commandArgs()} states that it returns the executable by which R was - * invoked in element 0, which is consistent with the C {@code main} function, but defines the - * exact form to be platform independent. Java does not provide the executable (for obvious - * reasons) so we use "FastR". However, embedded mode does pass the executable in - * {@code args[0]} and we do not want to parse that! + * The spec for {@code commandArgs()} states that it returns the executable by which R was invoked + * in element 0, which is consistent with the C {@code main} function, but defines the exact form to + * be platform independent. Java does not provide the executable (for obvious reasons) so we use + * "FastR". However, embedded mode does pass the executable in {@code args[0]} and we do not want to + * parse that! */ public static RCmdOptions parseArguments(Client client, String[] args, boolean reparse) { EnumMap<RCmdOption, Object> options = new EnumMap<>(RCmdOption.class); @@ -346,21 +343,9 @@ public final class RCmdOptions { System.out.println("\nFILE may contain spaces but not shell metacharacters.\n"); } - private static RuntimeException printHelpAndExit(Client client) { - printHelp(client); - System.exit(0); - throw RCommand.fatal("should not reach here"); - } - static void printVersion() { System.out.print("FastR version "); System.out.println(RVersionNumber.FULL); System.out.println(RVersionNumber.LICENSE); } - - private static RuntimeException printVersionAndExit() { - printVersion(); - System.exit(0); - throw RCommand.fatal("should not reach here"); - } } diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RStartParams.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RStartParams.java index 4548d0e625..8e105b3f70 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RStartParams.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RStartParams.java @@ -89,9 +89,9 @@ public class RStartParams { this.slave = options.getBoolean(SLAVE); /* - * GnuR behavior differs from the manual entry for {@code interactive} in that {@code - * --interactive} never applies to {@code -e/-f}, only to console input that has been - * redirected from a pipe/file etc. + * GnuR behavior differs from the manual entry for {@code interactive} in that {@code --interactive} + * never applies to {@code -e/-f}, only to console input that has been redirected from a pipe/file + * etc. */ String file = options.getString(FILE); List<String> expressions = options.getStringList(EXPR); @@ -133,7 +133,7 @@ public class RStartParams { * Used for R embedding, allows to alter some of the values. */ public void setParams(boolean quietA, boolean slaveA, boolean interactiveA, boolean verboseA, boolean loadSiteFileA, - boolean loadInitFileA, boolean debugInitFileA, int restoreActionA, int saveActionA, boolean noRenvironA) { + boolean loadInitFileA, boolean debugInitFileA, @SuppressWarnings("unused") int restoreActionA, @SuppressWarnings("unused") int saveActionA, boolean noRenvironA) { quiet = quietA; slave = slaveA; interactive = interactiveA; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/GridColorUtils.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/GridColorUtils.java index 77cd59a19d..9558c56840 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/GridColorUtils.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/GridColorUtils.java @@ -35,8 +35,8 @@ public final class GridColorUtils { } /** - * Converts given object into {@link GridColor}. The object may be a vector, in which case the - * index modulo its size is used to select element of that vector. + * Converts given object into {@link GridColor}. The object may be a vector, in which case the index + * modulo its size is used to select element of that vector. */ public static GridColor getColor(Object value, int index) { GridColor color = GridColorUtils.getPaletteColor(value, index); @@ -61,10 +61,9 @@ public final class GridColorUtils { } /** - * Converts the representation of color used within R, e.g. as value for - * {@code gpar(col='value')}, to our internal representation that grid device should understand. - * The acceptable color formats are: name of known color, HTML style hex value, and HTML style - * hex value including alpha. + * Converts the representation of color used within R, e.g. as value for {@code gpar(col='value')}, + * to our internal representation that grid device should understand. The acceptable color formats + * are: name of known color, HTML style hex value, and HTML style hex value including alpha. */ public static GridColor gridColorFromString(String value) { if (value.startsWith("#") && (value.length() == 7 || value.length() == 9)) { @@ -130,7 +129,7 @@ public final class GridColorUtils { } else if (colorId instanceof String && !RRuntime.isNA((String) colorId)) { paletteIdx = paletteIdxFromString((String) colorId); } else if (colorId instanceof Byte && !RRuntime.isNA((byte) colorId)) { - paletteIdx = (int) (byte) colorId; + paletteIdx = (byte) colorId; } if (RRuntime.isNA(paletteIdx)) { return null; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/Unit.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/Unit.java index 23a7f92db6..e70b7b641f 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/Unit.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/Unit.java @@ -5,7 +5,7 @@ * * Copyright (C) 2001-3 Paul Murrell * Copyright (c) 1998-2013, The R Core Team - * Copyright (c) 2017, Oracle and/or its affiliates + * Copyright (c) 2017, 2018, Oracle and/or its affiliates * * All rights reserved. */ @@ -379,27 +379,27 @@ public final class Unit { return visit(unit, null); } - protected T visitListUnit(RList unit) { + protected T visitListUnit(@SuppressWarnings("unused") RList unit) { throw RInternalError.shouldNotReachHere(); } - protected T visitArithmeticUnit(ArithmeticUnit unit) { + protected T visitArithmeticUnit(@SuppressWarnings("unused") ArithmeticUnit unit) { throw RInternalError.shouldNotReachHere(); } - protected T visitSimpleUnit(RAbstractVector unit) { + protected T visitSimpleUnit(@SuppressWarnings("unused") RAbstractVector unit) { throw RInternalError.shouldNotReachHere(); } - protected T visitListUnit(RList unit, R arg) { + protected T visitListUnit(RList unit, @SuppressWarnings("unused") R arg) { return visitListUnit(unit); } - protected T visitArithmeticUnit(ArithmeticUnit unit, R arg) { + protected T visitArithmeticUnit(ArithmeticUnit unit, @SuppressWarnings("unused") R arg) { return visitArithmeticUnit(unit); } - protected T visitSimpleUnit(RAbstractVector unit, R arg) { + protected T visitSimpleUnit(RAbstractVector unit, @SuppressWarnings("unused") R arg) { return visitSimpleUnit(unit); } } @@ -426,16 +426,16 @@ public final class Unit { /** * Arithmetic unit objects can represent 'vectorized' expressions, e.g. - * {@code 3*c(unit(1,'cm'), unit(2,'mm'))}, in such case the 'length' is not simply the length - * of the underlying vector/list. + * {@code 3*c(unit(1,'cm'), unit(2,'mm'))}, in such case the 'length' is not simply the length of + * the underlying vector/list. */ public static int getLength(RAbstractContainer unit) { return UnitLengthVisitor.INSTANCE.visit(unit); } /** - * Returns {@code true} if the given unit object represents a unit without actual unit type, - * i.e. the unit type is {@link #NULL}. Such units are used internally for layouting, and the + * Returns {@code true} if the given unit object represents a unit without actual unit type, i.e. + * the unit type is {@link #NULL}. Such units are used internally for layouting, and the * interpretation is to take-up all the left space (evenly if there are more such units). */ public static boolean isRelativeUnit(GridContext ctx, Object unit, int index) { @@ -447,9 +447,9 @@ public final class Unit { } /** - * Used to discriminate between x axis, y axis, width, and height when doing unit conversions. - * The order should be the same as used in e.g. {@code L_convert}, which is 0 means x, 1 means - * y, 2 means width, 3 means height. + * Used to discriminate between x axis, y axis, width, and height when doing unit conversions. The + * order should be the same as used in e.g. {@code L_convert}, which is 0 means x, 1 means y, 2 + * means width, 3 means height. */ public enum AxisOrDimension { X, @@ -476,8 +476,7 @@ public final class Unit { /** * Wraps the data necessary for converting a unit to another unit. Note: {@code nullLMode} and * {@code nullAMode} is only used for converting 'NULL' units and is only explicitly set when - * calculating layout. When e.g. drawing or calculating bounds, both should have default zero - * value. + * calculating layout. When e.g. drawing or calculating bounds, both should have default zero value. */ public static final class UnitConversionContext { public final Size viewPortSize; @@ -639,8 +638,8 @@ public final class Unit { Object updatedGrob = ctx.evalInternalRFunction("grobConversionPreDraw", grob); /* - * The call to preDraw may have pushed viewports and/or enforced gpar settings, SO we need - * to re-establish the current viewport and gpar settings before evaluating the width unit. + * The call to preDraw may have pushed viewports and/or enforced gpar settings, SO we need to + * re-establish the current viewport and gpar settings before evaluating the width unit. */ currentVP = ctx.getGridState().getViewPort(); RList currentGP = ctx.getGridState().getGpar(); diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/color/RGB.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/color/RGB.java index 6cc23c226a..bafb494bc0 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/color/RGB.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/color/RGB.java @@ -17,7 +17,6 @@ import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.r.library.fastrGrid.color.RGBNodeGen.DoubleRGBNodeGen; import com.oracle.truffle.r.library.fastrGrid.color.RGBNodeGen.IntegerRGBNodeGen; -import com.oracle.truffle.r.library.fastrGrid.device.GridColor; import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; import com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef; import com.oracle.truffle.r.nodes.unary.CastDoubleNode; diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/SVGDevice.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/SVGDevice.java index 2aa4664219..413d1c638d 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/SVGDevice.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/SVGDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, 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 @@ -119,11 +119,11 @@ public class SVGDevice implements GridDevice, FileGridDevice { } @Override - public void drawRaster(double leftX, double bottomY, double width, double height, int[] pixels, int pixelsColumnsCount, ImageInterpolation interpolation) { + public void drawRaster(double leftX, double bottomY, double w, double h, int[] pixels, int pixelsColumnsCount, ImageInterpolation interpolation) { byte[] bitmap = Bitmap.create(pixels, pixelsColumnsCount); String base64 = Base64.getEncoder().encodeToString(bitmap); - data.append("<image x='").append(round(leftX * COORD_FACTOR)).append("' y='").append(trRound(transY(bottomY + height))); - data.append("' width='").append(round(width * COORD_FACTOR)).append("' height='").append(trRound(height)); + data.append("<image x='").append(round(leftX * COORD_FACTOR)).append("' y='").append(trRound(transY(bottomY + h))); + data.append("' width='").append(round(w * COORD_FACTOR)).append("' height='").append(trRound(h)); data.append("' preserveAspectRatio='none' xlink:href='data:image/bmp;base64,").append(base64).append("'/>\n"); } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/Graphics2DDevice.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/Graphics2DDevice.java index c334bab485..806ed306b2 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/Graphics2DDevice.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/Graphics2DDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, 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 @@ -74,8 +74,8 @@ public class Graphics2DDevice implements GridDevice { * @param graphics Object that should be used for the drawing. * @param width Width of the drawing area in AWT units. * @param height Height of the drawing area in AWT units. - * @param graphicsIsExclusive If the graphics object is exclusively used for drawing only by - * this class, then it can optimize some things. + * @param graphicsIsExclusive If the graphics object is exclusively used for drawing only by this + * class, then it can optimize some things. */ public Graphics2DDevice(Graphics2D graphics, int width, int height, boolean graphicsIsExclusive) { setGraphics2D(graphics); @@ -161,12 +161,12 @@ public class Graphics2DDevice implements GridDevice { } @Override - public void drawRaster(double leftX, double bottomY, double width, double height, int[] pixels, int pixelsColumnsCount, ImageInterpolation interpolation) { + public void drawRaster(double leftX, double bottomY, double w, double h, int[] pixels, int pixelsColumnsCount, ImageInterpolation interpolation) { graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, fromInterpolation(interpolation)); Image image = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(pixelsColumnsCount, pixels.length / pixelsColumnsCount, pixels, 0, pixelsColumnsCount)); - double yRel = transY(bottomY + height); + double yRel = transY(bottomY + h); double xRel = transX(leftX); - graphics.drawImage(image, iround(xRel), iround(yRel), transDim(width, xRel), transDim(height, yRel), null); + graphics.drawImage(image, iround(xRel), iround(yRel), transDim(w, xRel), transDim(h, yRel), null); } @Override @@ -349,15 +349,15 @@ public class Graphics2DDevice implements GridDevice { private BasicStroke getStrokeFromCtx(DrawingContext ctx) { byte[] type = ctx.getLineType(); - double width = ctx.getLineWidth(); + double w = ctx.getLineWidth(); int lineJoin = fromGridLineJoin(ctx.getLineJoin()); float lineMitre = (float) ctx.getLineMitre(); int endCap = fromGridLineEnd(ctx.getLineEnd()); if (type == DrawingContext.GRID_LINE_BLANK) { return blankStroke; } else if (type == DrawingContext.GRID_LINE_SOLID) { - if (stokeCache == null || !areEqual(stokeCache, (float) width, endCap, lineJoin, lineMitre)) { - stokeCache = new BasicStroke((float) (width), endCap, lineJoin, lineMitre); + if (stokeCache == null || !areEqual(stokeCache, (float) w, endCap, lineJoin, lineMitre)) { + stokeCache = new BasicStroke((float) (w), endCap, lineJoin, lineMitre); } return stokeCache; } @@ -365,7 +365,7 @@ public class Graphics2DDevice implements GridDevice { for (int i = 0; i < pattern.length; i++) { pattern[i] = type[i]; } - return new BasicStroke((float) (width), endCap, lineJoin, lineMitre, pattern, 0f); + return new BasicStroke((float) (w), endCap, lineJoin, lineMitre, pattern, 0f); } private static int fromGridLineEnd(GridLineEnd lineEnd) { diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/JFrameDevice.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/JFrameDevice.java index 2dd4e5a5b0..06688ca961 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/JFrameDevice.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/device/awt/JFrameDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, 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 @@ -267,8 +267,7 @@ public final class JFrameDevice implements GridDevice, ImageSaver { return; } synchronized (JFrameDevice.this) { - Graphics2D graphics = (Graphics2D) g; - graphics.drawImage(toDraw, 0, 0, null); + ((Graphics2D) g).drawImage(toDraw, 0, 0, null); } } diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/OpenDefaultDevice.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/OpenDefaultDevice.java index 3307dd77ef..4fe0972db4 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/OpenDefaultDevice.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/grDevices/OpenDefaultDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, 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 @@ -31,6 +31,7 @@ import com.oracle.truffle.r.library.fastrGrid.GridContext; * directly through .Call/.External interface. */ public final class OpenDefaultDevice extends Node { + @SuppressWarnings("static-method") @TruffleBoundary public void execute() { // if no device has been opened yet, open the default one and make it current diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/tools/C_ParseRd.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/tools/C_ParseRd.java index b62147da84..2e54572883 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/tools/C_ParseRd.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/tools/C_ParseRd.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -40,11 +40,10 @@ import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.env.REnvironment; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; import com.oracle.truffle.r.runtime.ffi.ToolsRFFI; public abstract class C_ParseRd extends RExternalBuiltinNode.Arg9 { - @Child private ToolsRFFI.ParseRdNode parseRdNode = RFFIFactory.getToolsRFFI().createParseRdNode(); + @Child private ToolsRFFI.ParseRdNode parseRdNode = ToolsRFFI.createParseRdNode(); static { Casts casts = new Casts(C_ParseRd.class); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java index 9f8a0e0109..21250f4c7b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsVector.java @@ -277,7 +277,7 @@ public abstract class AsVector extends RBuiltinNode.Arg2 { } @Specialization(guards = "pairList.getAttributes() != null") - protected Object drop(Object original, RPairList pairList) { + protected Object drop(@SuppressWarnings("unused") Object original, RPairList pairList) { // dropping already done in the cast node CastPairListNode below return pairList; } @@ -296,7 +296,7 @@ public abstract class AsVector extends RBuiltinNode.Arg2 { } @Fallback - protected Object drop(Object original, Object o) { + protected Object drop(@SuppressWarnings("unused") Object original, Object o) { // includes RExpression, RSymbol return o; } @@ -352,7 +352,7 @@ public abstract class AsVector extends RBuiltinNode.Arg2 { } @TruffleBoundary - private Object fromVectorWithAttributes(RAbstractContainer x, RemoveNamesAttributeNode removeNamesAttributeNode) { + private static Object fromVectorWithAttributes(RAbstractContainer x, RemoveNamesAttributeNode removeNamesAttributeNode) { if (x.getLength() == 0) { return RNull.instance; } else { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BetaFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BetaFunctions.java index c67e53a675..1aec1a232c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BetaFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BetaFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, 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 @@ -87,7 +87,7 @@ public class BetaFunctions { return doVectors(a, b, a.slowPathAccess(), b.slowPathAccess(), factory); } - private double lbeta(double a, double b) { + private static double lbeta(double a, double b) { if (RRuntime.isNA(a) || RRuntime.isNA(b)) { return RRuntime.DOUBLE_NA; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java index dd35239bad..f165604b37 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java @@ -65,7 +65,6 @@ import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.RArguments; 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.RRuntime; import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.builtins.RBuiltin; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharTr.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharTr.java index 9ac6720898..428abc7bdb 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharTr.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharTr.java @@ -32,12 +32,9 @@ import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.r.nodes.attributes.RemoveRegAttributesNode; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import com.oracle.truffle.r.nodes.function.opt.ReuseTemporaryNode; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; -import com.oracle.truffle.r.runtime.data.RDataFactory.VectorFactory; -import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.nodes.VectorAccess; import com.oracle.truffle.r.runtime.data.nodes.VectorAccess.SequentialIterator; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java index 4cbfd06eec..c67f195568 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Combine.java @@ -70,7 +70,6 @@ import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames; import com.oracle.truffle.r.runtime.data.RAttributesLayout; import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RExpression; import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.data.RLanguage; import com.oracle.truffle.r.runtime.data.RList; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java index b84f42df00..66c49f3c0a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java @@ -23,7 +23,6 @@ package com.oracle.truffle.r.nodes.builtin.base; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.instanceOf; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.returnIf; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.stringValue; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.toBoolean; import static com.oracle.truffle.r.runtime.RVisibility.CUSTOM; @@ -66,9 +65,7 @@ import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.VirtualEvalFrame; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.builtins.RBuiltinKind; -import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.Closure; -import com.oracle.truffle.r.runtime.data.ClosureCache; import com.oracle.truffle.r.runtime.data.ClosureCache.RNodeClosureCache; import com.oracle.truffle.r.runtime.data.ClosureCache.SymbolClosureCache; import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames; @@ -87,7 +84,6 @@ import com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor; import com.oracle.truffle.r.runtime.env.frame.RFrameSlot; import com.oracle.truffle.r.runtime.nodes.InternalRSyntaxNodeChildren; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; @RBuiltin(name = ".fastr.do.call", visibility = CUSTOM, kind = RBuiltinKind.INTERNAL, parameterNames = {"what", "args", "quote", "envir"}, behavior = COMPLEX, splitCaller = true) public abstract class DoCall extends RBuiltinNode.Arg4 implements InternalRSyntaxNodeChildren { @@ -145,8 +141,8 @@ public abstract class DoCall extends RBuiltinNode.Arg4 implements InternalRSynta } /** - * Because the underlying AST in {@link RExplicitCallNode} may cache frame slots, i.e. - * expect the {@link FrameDescriptor} to never change, we're caching this AST and also + * Because the underlying AST in {@link RExplicitCallNode} may cache frame slots, i.e. expect the + * {@link FrameDescriptor} to never change, we're caching this AST and also * {@link GetVisibilityNode} for each {@link FrameDescriptor} we encounter. */ @Specialization(guards = {"getFrameDescriptor(env) == fd"}, limit = "20") @@ -167,8 +163,8 @@ public abstract class DoCall extends RBuiltinNode.Arg4 implements InternalRSynta } /** - * Slow-path version avoids the problem by creating {@link RExplicitCallNode} for every call - * again and again and putting it behind truffle boundary to avoid deoptimization. + * Slow-path version avoids the problem by creating {@link RExplicitCallNode} for every call again + * and again and putting it behind truffle boundary to avoid deoptimization. */ @Specialization(replaces = "doFastPath") public Object doSlowPath(VirtualFrame virtualFrame, String funcName, RFunction func, RList argsAsList, boolean quote, REnvironment env, @@ -186,27 +182,26 @@ public abstract class DoCall extends RBuiltinNode.Arg4 implements InternalRSynta } /** - * The contract is that the function call will be evaluated in the given environment, but at - * the same time some primitives expect to see {@code do.call(foo, ...)} as the caller, so - * we create a frame the fakes caller, but otherwise delegates to the frame backing the - * explicitly given environment. + * The contract is that the function call will be evaluated in the given environment, but at the + * same time some primitives expect to see {@code do.call(foo, ...)} as the caller, so we create a + * frame the fakes caller, but otherwise delegates to the frame backing the explicitly given + * environment. */ - private MaterializedFrame getEvalFrame(VirtualFrame virtualFrame, MaterializedFrame envFrame) { + private static MaterializedFrame getEvalFrame(VirtualFrame virtualFrame, MaterializedFrame envFrame) { return VirtualEvalFrame.create(envFrame, RArguments.getFunction(virtualFrame), RArguments.getCall(virtualFrame)); } /** * If the call leads to actual call via - * {@link com.oracle.truffle.r.nodes.function.call.CallRFunctionNode}, which creates new - * frame and new set of arguments for it, then for this new arguments we explicitly provide - * a caller that looks like the function was called from the explicitly given environment - * (it will be its parent call), but at the same time its depth is one above the do.call - * function that actually invoked it. + * {@link com.oracle.truffle.r.nodes.function.call.CallRFunctionNode}, which creates new frame and + * new set of arguments for it, then for this new arguments we explicitly provide a caller that + * looks like the function was called from the explicitly given environment (it will be its parent + * call), but at the same time its depth is one above the do.call function that actually invoked it. * * @see RCaller * @see RArguments */ - private RCaller getExplicitCaller(VirtualFrame virtualFrame, MaterializedFrame envFrame, String funcName, RFunction func, RArgsValuesAndNames args) { + private static RCaller getExplicitCaller(VirtualFrame virtualFrame, MaterializedFrame envFrame, String funcName, RFunction func, RArgsValuesAndNames args) { Supplier<RSyntaxElement> callerSyntax; if (funcName != null) { callerSyntax = RCallerHelper.createFromArguments(funcName, args); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FileFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FileFunctions.java index 45461997df..40e244346f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FileFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FileFunctions.java @@ -136,12 +136,12 @@ public class FileFunctions { @TruffleBoundary protected RLogicalVector doFileAppend(RAbstractStringVector file1Vec, RAbstractStringVector file2Vec) { /* - * There are two simple (non-trivial) cases and one tricky 1. 1. Append one or more - * files to a single file (len1 == 1, len2 >= 1) 2. Append one file to one file for - * several files (len1 == len2) + * There are two simple (non-trivial) cases and one tricky 1. 1. Append one or more files to a + * single file (len1 == 1, len2 >= 1) 2. Append one file to one file for several files (len1 == + * len2) * - * The tricky case is when len1 > 1 && len2 > len1. E.g. f1,f2 <- g1,g2,g3 In this case, - * this is really f1,f2,f1 <- g1,g2,g3 + * The tricky case is when len1 > 1 && len2 > len1. E.g. f1,f2 <- g1,g2,g3 In this case, this is + * really f1,f2,f1 <- g1,g2,g3 */ int len1 = file1Vec.getLength(); @@ -277,14 +277,14 @@ public class FileFunctions { @TruffleBoundary protected RList doFileInfo(RAbstractStringVector vec, @SuppressWarnings("unused") Boolean extraCols) { /* - * Create a list, the elements of which are vectors of length vec.getLength() containing - * the information. The R closure that called the .Internal turns the result into a - * dataframe and sets the row.names attributes to the paths in vec. It also updates the - * mtime, ctime, atime fields using .POSIXct. + * Create a list, the elements of which are vectors of length vec.getLength() containing the + * information. The R closure that called the .Internal turns the result into a dataframe and sets + * the row.names attributes to the paths in vec. It also updates the mtime, ctime, atime fields + * using .POSIXct. * - * We try to use the JDK classes, even though they provide a more abstract interface - * than R. In particular there seems to be no way to get the uid/gid values. We might be - * better off justing using a native call. + * We try to use the JDK classes, even though they provide a more abstract interface than R. In + * particular there seems to be no way to get the uid/gid values. We might be better off justing + * using a native call. * * TODO implement extras_cols=FALSE */ @@ -616,9 +616,8 @@ public class FileFunctions { boolean includeDirs, boolean noDotDot) { /* - * Pattern in first element of vector, remaining elements are ignored (as per GnuR). - * N.B. The pattern matches file names not paths, which means we cannot just use the - * Java File path matcher. + * Pattern in first element of vector, remaining elements are ignored (as per GnuR). N.B. The + * pattern matches file names not paths, which means we cannot just use the Java File path matcher. */ String pattern = null; @@ -633,7 +632,7 @@ public class FileFunctions { return doListFilesBody(vec, pattern, allFiles, fullNames, recursive, ignoreCase, includeDirs, noDotDot); } - private RStringVector doListFilesBody(RAbstractStringVector vec, String patternString, boolean allFiles, boolean fullNames, boolean recursive, + private static RStringVector doListFilesBody(RAbstractStringVector vec, String patternString, boolean allFiles, boolean fullNames, boolean recursive, boolean ignoreCase, boolean includeDirsIn, boolean noDotDot) { boolean includeDirs = !recursive || includeDirsIn; int flags = ignoreCase ? Pattern.CASE_INSENSITIVE : 0; @@ -666,8 +665,7 @@ public class FileFunctions { files.add(file.toString()); } /* - * Annoyingly "." and ".." are never visited by Files.find, so we have to - * process them manually. + * Annoyingly "." and ".." are never visited by Files.find, so we have to process them manually. */ if (!noDotDot) { if (pattern == null || pattern.matcher(DOT).find()) { @@ -948,8 +946,8 @@ public class FileFunctions { // copy to existing files is skipped unless overWrite if (!Files.exists(toPath) || overwrite) { /* - * toB Be careful if toPath is a directory, if empty Java will - * replace it with a plain file, otherwise the copy will fail + * toB Be careful if toPath is a directory, if empty Java will replace it with a plain file, + * otherwise the copy will fail */ Files.copy(fromPath, toPath, copyOptions); status[i] = RRuntime.LOGICAL_TRUE; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FindInterval.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FindInterval.java index 149ee82320..a5029b6c6c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FindInterval.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FindInterval.java @@ -4,7 +4,7 @@ * http://www.gnu.org/licenses/gpl-2.0.html * * Copyright (c) 2002--2016, The R Core Team - * Copyright (c) 2017, Oracle and/or its affiliates + * Copyright (c) 2017, 2018, Oracle and/or its affiliates * * All rights reserved. */ @@ -81,7 +81,7 @@ public abstract class FindInterval extends RBuiltinNode.Arg5 { // transcribed from appl/interv.c - private int findInterval2(VectorAccess xtAccess, RandomIterator xtIter, double x, boolean right, boolean inside, boolean leftOpen, int iloIn) { + private static int findInterval2(VectorAccess xtAccess, RandomIterator xtIter, double x, boolean right, boolean inside, boolean leftOpen, int iloIn) { int n = xtAccess.getLength(xtIter); if (n == 0) { return 0; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FormatInfo.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FormatInfo.java index 89c5c092bf..4710463527 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FormatInfo.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FormatInfo.java @@ -61,13 +61,12 @@ public abstract class FormatInfo extends RBuiltinNode.Arg3 { } @Specialization - protected int doInt(int n, @SuppressWarnings("unused") int digits, @SuppressWarnings("unused") int nsmall, - @Cached("create()") VectorFactory factory) { + protected int doInt(int n, @SuppressWarnings("unused") int digits, @SuppressWarnings("unused") int nsmall) { return (n == RRuntime.INT_NA) ? 2 : intLength(n); } @Specialization - protected int doString(String s, int digits, int nsmall) { + protected int doString(String s, @SuppressWarnings("unused") int digits, @SuppressWarnings("unused") int nsmall) { return s.length(); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java index 6e2f7dda03..57731e227b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java @@ -107,8 +107,8 @@ public class FrameFunctions { private final ConditionProfile currentFrameProfile = ConditionProfile.createBinaryProfile(); /** - * Determine the frame access mode of a subclass. The rule of thumb is that subclasses that - * only use the frame internally should not materialize it, i.e., they should use + * Determine the frame access mode of a subclass. The rule of thumb is that subclasses that only use + * the frame internally should not materialize it, i.e., they should use * {@link FrameAccess#READ_ONLY} or {@link FrameAccess#READ_WRITE}. */ private final FrameAccess access; @@ -203,7 +203,7 @@ public class FrameFunctions { } @TruffleBoundary - private Object createCall(RCaller call) { + private static Object createCall(RCaller call) { assert call == null || !call.isPromise(); if (call == null || !call.isValidCaller()) { return RNull.instance; @@ -218,13 +218,12 @@ public class FrameFunctions { * unlike, {@code sys.call}, the {@code call} argument can be provided by the caller. "..." is a * significant complication for two reasons: * <ol> - * <li>If {@code expand.dots} is {@code false} the "..." args are wrapped in a {@code pairlist} - * </li> - * <li>One of the args might itself be "..." in which case the values have to be retrieved from - * the environment associated with caller of the function containing {@code match.call}.</li> + * <li>If {@code expand.dots} is {@code false} the "..." args are wrapped in a {@code pairlist}</li> + * <li>One of the args might itself be "..." in which case the values have to be retrieved from the + * environment associated with caller of the function containing {@code match.call}.</li> * </ol> - * In summary, although the simple cases are indeed simple, there are many possible variants - * using "..." that make the code a lot more complex that it seems it ought to be. + * In summary, although the simple cases are indeed simple, there are many possible variants using + * "..." that make the code a lot more complex that it seems it ought to be. */ @RBuiltin(name = "match.call", kind = INTERNAL, parameterNames = {"definition", "call", "expand.dots", "envir"}, behavior = COMPLEX) public abstract static class MatchCall extends RBuiltinNode.Arg4 { @@ -242,8 +241,8 @@ public class FrameFunctions { @Specialization protected RLanguage matchCall(RFunction definition, Object callObj, byte expandDotsL, REnvironment env) { /* - * definition==null in the standard (default) case, in which case we get the RFunction - * from the calling frame + * definition==null in the standard (default) case, in which case we get the RFunction from the + * calling frame */ RLanguage call = checkCall(callObj); if (expandDotsL == RRuntime.LOGICAL_NA) { @@ -257,9 +256,8 @@ public class FrameFunctions { @TruffleBoundary private static RLanguage doMatchCall(MaterializedFrame cframe, RFunction definition, RLanguage call, boolean expandDots) { /* - * We have to ensure that all parameters are named, in the correct order, and deal with - * "...". This process has a lot in common with MatchArguments, which we use as a - * starting point + * We have to ensure that all parameters are named, in the correct order, and deal with "...". This + * process has a lot in common with MatchArguments, which we use as a starting point */ RCallNode callNode = (RCallNode) RASTUtils.unwrap(call.getRep()); CallArgumentsNode callArgs = callNode.createArguments(null, false, true); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LaFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LaFunctions.java index 88be8006f5..1a19c3ea05 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LaFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LaFunctions.java @@ -56,7 +56,6 @@ import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetNames import com.oracle.truffle.r.nodes.attributes.UnaryCopyAttributesNode; import com.oracle.truffle.r.nodes.builtin.NodeWithArgumentCasts.Casts; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import com.oracle.truffle.r.nodes.unary.CastComplexNode; import com.oracle.truffle.r.nodes.unary.CastDoubleNode; import com.oracle.truffle.r.nodes.unary.CastDoubleNodeGen; import com.oracle.truffle.r.runtime.RAccuracyInfo; @@ -399,7 +398,6 @@ public class LaFunctions { @Cached("create()") ExtractListElement extractTauElement, @Cached("create()") GetDimAttributeNode getQDimAttribute, @Cached("create()") GetDimAttributeNode getBDimAttribute, - @Cached("create()") CastComplexNode bAsComplex, @Cached("create()") VectorFactory resultVectorFactory) { RAbstractComplexVector qr = (RAbstractComplexVector) extractQrElement.execute(q, 0); RAbstractComplexVector tau = (RAbstractComplexVector) extractTauElement.execute(q, 2); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java index 4b7a5d24b2..6e3a30e828 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Match.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -684,12 +684,12 @@ public abstract class Match extends RBuiltinNode.Arg4 { } @Specialization - protected RIntVector match(RAbstractRawVector x, RAbstractLogicalVector table, int nomatch) { + protected RIntVector match(RAbstractRawVector x, @SuppressWarnings("unused") RAbstractLogicalVector table, @SuppressWarnings("unused") int nomatch) { return RDataFactory.createIntVector(x.getLength(), true); } @Specialization - protected RIntVector match(RAbstractRawVector x, RAbstractComplexVector table, int nomatch) { + protected RIntVector match(RAbstractRawVector x, @SuppressWarnings("unused") RAbstractComplexVector table, @SuppressWarnings("unused") int nomatch) { return RDataFactory.createIntVector(x.getLength(), true); } @@ -712,12 +712,12 @@ public abstract class Match extends RBuiltinNode.Arg4 { } @Specialization - protected RIntVector match(RAbstractLogicalVector x, RAbstractRawVector table, int nomatch) { + protected RIntVector match(RAbstractLogicalVector x, @SuppressWarnings("unused") RAbstractRawVector table, @SuppressWarnings("unused") int nomatch) { return RDataFactory.createIntVector(x.getLength(), true); } @Specialization - protected RIntVector match(RAbstractComplexVector x, RAbstractRawVector table, int nomatch) { + protected RIntVector match(RAbstractComplexVector x, @SuppressWarnings("unused") RAbstractRawVector table, @SuppressWarnings("unused") int nomatch) { return RDataFactory.createIntVector(x.getLength(), true); } @@ -875,8 +875,8 @@ public abstract class Match extends RBuiltinNode.Arg4 { } /** - * Set the "complete" status. If {@code nomatch} is not NA (uncommon), then the result - * vector is always COMPLETE, otherwise it is INCOMPLETE unless everything matched. + * Set the "complete" status. If {@code nomatch} is not NA (uncommon), then the result vector is + * always COMPLETE, otherwise it is INCOMPLETE unless everything matched. */ private static boolean setCompleteState(boolean matchAll, int nomatch) { return nomatch != RRuntime.INT_NA || matchAll ? RDataFactory.COMPLETE_VECTOR : RDataFactory.INCOMPLETE_VECTOR; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java index 1e1194bbfc..df9b8b4509 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java @@ -80,7 +80,7 @@ public class OptionsFunctions { Object[] data = new Object[optionSettings.size()]; String[] names = new String[data.length]; - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") Map.Entry<String, Object>[] entries = optionSettings.toArray(new Map.Entry[optionSettings.size()]); Locale locale = RContext.getInstance().stateRLocale.getLocale(RLocale.COLLATE); Collator collator = locale == Locale.ROOT || locale == null ? null : RLocale.getOrderCollator(locale); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SerializeFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SerializeFunctions.java index a560f8f4a0..03a083f18a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SerializeFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SerializeFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, 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 @@ -179,7 +179,7 @@ public class SerializeFunctions { } @Specialization - protected Object serialize(Object object, RNull conn, int type, @SuppressWarnings("unused") Object version, @SuppressWarnings("unused") RNull refhook) { + protected Object serialize(Object object, @SuppressWarnings("unused") RNull conn, int type, @SuppressWarnings("unused") Object version, @SuppressWarnings("unused") RNull refhook) { byte[] data = RSerialize.serialize(object, type, RSerialize.DEFAULT_VERSION, null); return RDataFactory.createRawVector(data); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substitute.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substitute.java index 8251eb1da6..a7e9cde294 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substitute.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substitute.java @@ -58,7 +58,7 @@ public abstract class Substitute extends RBuiltinNode.Arg2 { } @Specialization - protected Object doSubstitute(VirtualFrame frame, @SuppressWarnings("unused") RMissing exprMissing, @SuppressWarnings("unused") RMissing envMissing) { + protected Object doSubstitute(@SuppressWarnings("unused") RMissing exprMissing, @SuppressWarnings("unused") RMissing envMissing) { return RSymbol.MISSING; } @@ -90,16 +90,16 @@ public abstract class Substitute extends RBuiltinNode.Arg2 { /** * Handles all above specializations. Transforms an AST into another AST, with the appropriate - * substitutions. The incoming AST will either denote a symbol, constant or function call - * (because in R everything else is a call). So in general, both the input and output is a call( - * language element). E.g. {@link IfNode} is a special case because it is not (currently) - * represented as a function, as are several other nodes. + * substitutions. The incoming AST will either denote a symbol, constant or function call (because + * in R everything else is a call). So in general, both the input and output is a call( language + * element). E.g. {@link IfNode} is a special case because it is not (currently) represented as a + * function, as are several other nodes. * * @param expr * @param env {@code null} if the {@code env} argument was {@code RMissing} to avoid always * materializing the current frame. - * @return in general an {@link RLanguage} instance, but simple cases could be a constant value - * or {@link RSymbol} + * @return in general an {@link RLanguage} instance, but simple cases could be a constant value or + * {@link RSymbol} */ private Object doSubstituteWithEnv(RPromise expr, REnvironment env) { // In the global environment, substitute behaves like quote diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Typeof.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Typeof.java index 0393807fe6..2aedfac070 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Typeof.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Typeof.java @@ -28,7 +28,6 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.unary.TypeofNode; -import com.oracle.truffle.r.nodes.unary.TypeofNodeGen; import com.oracle.truffle.r.runtime.builtins.RBuiltin; @RBuiltin(name = "typeof", kind = INTERNAL, parameterNames = {"x"}, behavior = PURE) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateNames.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateNames.java index a7879e7a0c..4f8eccbddd 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateNames.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateNames.java @@ -95,6 +95,7 @@ public abstract class UpdateNames extends RBuiltinNode.Arg2 { return result; } + @SuppressWarnings("unused") @Fallback protected Object doOthers(Object target, Object names) { throw error(Message.NAMES_NONVECTOR); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java index 1e5a320d89..c853bf8455 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subscript.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -195,7 +195,7 @@ abstract class SubscriptSpecial extends SubscriptSpecialBase { } @Specialization(guards = {"simpleVector(vector)", "!inReplacement"}) - protected static Object access(RAbstractVector vector, Object index, + protected static Object accessObject(RAbstractVector vector, Object index, @Cached("createAccess()") ExtractVectorNode extract) { return extract.apply(vector, new Object[]{index}, RRuntime.LOGICAL_TRUE, RLogical.TRUE); } @@ -274,8 +274,8 @@ public abstract class Subscript extends RBuiltinNode.Arg4 { @Specialization(guards = "!indexes.isEmpty()") protected Object get(Object x, RArgsValuesAndNames indexes, RAbstractLogicalVector exact, @SuppressWarnings("unused") Object drop) { /* - * "drop" is not actually used by this builtin, but it needs to be in the argument list - * (because the "drop" argument needs to be skipped). + * "drop" is not actually used by this builtin, but it needs to be in the argument list (because the + * "drop" argument needs to be skipped). */ return extractNode.apply(x, indexes.getArguments(), exact, RLogical.TRUE); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java index 107b02ea74..0c51ea27ed 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/Subset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -77,7 +77,7 @@ abstract class SubsetSpecial extends SubscriptSpecialBase { } @Specialization(guards = {"simpleVector(vector)", "!inReplacement"}) - protected Object access(RAbstractVector vector, Object index, + protected Object accessObject(RAbstractVector vector, Object index, @Cached("createAccess()") ExtractVectorNode extract) { return extract.apply(vector, new Object[]{index}, RRuntime.LOGICAL_TRUE, RLogical.TRUE); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java index 8da59509ff..adc76dc605 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java @@ -855,7 +855,7 @@ public class FastRInterop { String msg = isTesting ? "error during Java object instantiation" : "error during Java object instantiation: " + e.getMessage(); throw error(RError.Message.GENERIC, msg); } catch (RuntimeException e) { - throw RError.handleInteropException(this, e, clazz); + throw RError.handleInteropException(this, e); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java index 802b049011..831dfe2853 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmem.java @@ -35,7 +35,6 @@ import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.builtins.RBuiltin; -import com.oracle.truffle.r.runtime.data.RNull; @RBuiltin(name = ".fastr.profmem", visibility = OFF, kind = PRIMITIVE, parameterNames = {"on"}, behavior = IO) public abstract class FastRprofmem extends RBuiltinNode.Arg1 { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java index 9179838da5..7db239af4e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemShow.java @@ -31,7 +31,6 @@ import static com.oracle.truffle.r.runtime.RVisibility.OFF; import static com.oracle.truffle.r.runtime.builtins.RBehavior.IO; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; @@ -39,7 +38,6 @@ import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RNull; -import com.oracle.truffle.r.runtime.instrument.memprof.MemAllocProfilerPaths; @RBuiltin(name = ".fastr.profmem.show", visibility = OFF, kind = PRIMITIVE, parameterNames = {"levels", "desc", "id", "printParents", "view", "snapshot"}, behavior = IO) public abstract class FastRprofmemShow extends RBuiltinNode.Arg6 { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java index 5e3eac7f32..b52c435d98 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/memprof/FastRprofmemSource.java @@ -37,7 +37,6 @@ import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RNull; -import com.oracle.truffle.r.runtime.instrument.memprof.MemAllocProfilerPaths; @RBuiltin(name = ".fastr.profmem.source", visibility = OFF, kind = PRIMITIVE, parameterNames = {"id", "view", "snapshot"}, behavior = IO) public abstract class FastRprofmemSource extends RBuiltinNode.Arg3 { diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/access/vector/VectorManipulationTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/access/vector/VectorManipulationTest.java index 8dc15dad45..5239122f77 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/access/vector/VectorManipulationTest.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/access/vector/VectorManipulationTest.java @@ -141,7 +141,7 @@ public class VectorManipulationTest extends TestBase { }); } - private <ArrayT> void assertDataContents(RVector<ArrayT> vec, ArrayT arr) { + private static <ArrayT> void assertDataContents(RVector<ArrayT> vec, ArrayT arr) { int len = vec.getLength(); RType type = vec.getRType(); for (int i = 0; i < len; i++) { diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java index fda59988b9..f29e0c1400 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -255,13 +255,11 @@ public class CastUtils { }; /** - * It transforms this type coverage into another one that would be returned in the - * situation when the source and the target type were either positive or negative, as - * determined by the <code>sourcePositive</code> and <code>targetPositive</code> - * arguments. + * It transforms this type coverage into another one that would be returned in the situation when + * the source and the target type were either positive or negative, as determined by the + * <code>sourcePositive</code> and <code>targetPositive</code> arguments. * <p> - * N.B. It is assumed that this coverage is obtained for the positive source anb target - * types. + * N.B. It is assumed that this coverage is obtained for the positive source anb target types. */ public abstract Coverage transpose(Type sourceType, Type targetType, boolean sourcePositive, boolean targetPositive); @@ -564,7 +562,6 @@ public class CastUtils { } } - @SuppressWarnings("rawtypes") public static Class<?>[] rTypeToClasses(RType type) { switch (type) { case Integer: @@ -773,7 +770,6 @@ public class CastUtils { return Arrays.stream(classes).flatMap(t -> CastUtils.sampleValuesForType(t).stream()).collect(Collectors.toSet()); } - @SuppressWarnings("rawtypes") public static Set<?> sampleValuesForClass(Class<?> cls) { return sampleValuesForClasses(new Class[]{cls}); } diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/SamplesCollector.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/SamplesCollector.java index 7318fc93e7..7048b7a331 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/SamplesCollector.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/SamplesCollector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, 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 @@ -222,7 +222,6 @@ public class SamplesCollector extends ExecutionPathVisitor<Consumer<Object>> // Filter visitor @Override - @SuppressWarnings("rawtypes") public Consumer<Object> visit(TypeFilter<?, ?> filter, Consumer<Object> previous) { Class<?>[] filterTypes = new Class[]{filter.getType1(), filter.getType2()}; Set<?> samples = CastUtils.sampleValuesForClasses(filterTypes); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArgumentNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArgumentNode.java index 1010da72fc..3003dad63a 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArgumentNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArgumentNode.java @@ -35,7 +35,6 @@ import com.oracle.truffle.r.nodes.RASTUtils; import com.oracle.truffle.r.nodes.builtin.RBuiltinRootNode; import com.oracle.truffle.r.nodes.function.ArgumentStatePush; import com.oracle.truffle.r.nodes.function.FormalArguments; -import com.oracle.truffle.r.nodes.function.PromiseHelperNode; import com.oracle.truffle.r.nodes.function.opt.EagerEvalHelper; import com.oracle.truffle.r.nodes.function.opt.OptConstantPromiseNode; import com.oracle.truffle.r.nodes.function.opt.OptVariablePromiseBaseNode; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/PositionCheckNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/PositionCheckNode.java index 3c4af86bd2..0b4a296297 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/PositionCheckNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/PositionCheckNode.java @@ -30,7 +30,6 @@ import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.access.vector.PositionCheckNodeFactory.Mat2indsubNodeGen; import com.oracle.truffle.r.nodes.access.vector.PositionsCheckNode.PositionProfile; import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetDimAttributeNode; -import com.oracle.truffle.r.nodes.control.RLengthNode; import com.oracle.truffle.r.nodes.profile.VectorLengthProfile; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributesNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributesNode.java index 18892d089c..2adbdc699b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributesNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/GetAttributesNode.java @@ -42,7 +42,6 @@ import com.oracle.truffle.r.runtime.data.RLanguage; import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RPairList; -import com.oracle.truffle.r.runtime.data.RRaw; import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractContainer; import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java index 14bd617b1b..e5112aec29 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetFixedAttributeNode.java @@ -34,7 +34,6 @@ import com.oracle.truffle.api.object.Shape; import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.profiles.ValueProfile; -import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetSpecialAttributeNode; import com.oracle.truffle.r.nodes.function.opt.ShareObjectNode; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.data.RAttributable; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java index c912a44eec..bea8d31085 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java @@ -421,11 +421,10 @@ public final class SpecialAttributesFunctions { RPairList pl = x.getPairListInternal(); if (pairListProfile.profile(pl == null)) { /* - * "names" for a language object is a special case, that is applicable to calls and - * returns the names of the actual arguments, if any. E.g. f(x=1, 3) would return - * c("", "x", ""). GnuR defines it as returning the "tag" values on the pairlist - * that represents the call. Well, we don't have a pairlist, (we could get one by - * serializing the expression), so we do it by AST walking. + * "names" for a language object is a special case, that is applicable to calls and returns the + * names of the actual arguments, if any. E.g. f(x=1, 3) would return c("", "x", ""). GnuR defines + * it as returning the "tag" values on the pairlist that represents the call. Well, we don't have a + * pairlist, (we could get one by serializing the expression), so we do it by AST walking. */ RStringVector names = RContext.getRRuntimeASTAccess().getNames(x); return names; @@ -990,8 +989,10 @@ public final class SpecialAttributesFunctions { public abstract void execute(RAbstractContainer x, int[] dimensions, RStringVector names, RList dimNames); @Specialization - protected void initContainerAttributes(RAbstractContainer x, int[] dimensions, RStringVector names, RList dimNames, + protected void initContainerAttributes(RAbstractContainer x, int[] dimensions, RStringVector initialNames, RList initialDimNames, @Cached("create()") ShareObjectNode shareObjectNode) { + RStringVector names = initialNames; + RList dimNames = initialDimNames; assert names != x; assert dimNames != x; DynamicObject attrs = x.getAttributes(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/EnvironmentNodes.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/EnvironmentNodes.java index ef47ee3c24..c1c7c48766 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/EnvironmentNodes.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/EnvironmentNodes.java @@ -45,8 +45,8 @@ import com.oracle.truffle.r.runtime.nodes.RBaseNode; public final class EnvironmentNodes { /** - * Convert an {@link RList} to an {@link REnvironment}, which is needed in several builtins, - * e.g. {@code substitute}. + * Convert an {@link RList} to an {@link REnvironment}, which is needed in several builtins, e.g. + * {@code substitute}. */ public abstract static class RList2EnvNode extends RBaseNode { private final boolean ignoreMissingNames; @@ -68,7 +68,7 @@ public final class EnvironmentNodes { } @TruffleBoundary - private REnvironment createNewEnv(String envName, REnvironment parentEnv) { + private static REnvironment createNewEnv(String envName, REnvironment parentEnv) { REnvironment createNewEnv = RDataFactory.createNewEnv(envName); RArguments.initializeEnclosingFrame(createNewEnv.getFrame(), parentEnv.getFrame()); createNewEnv.setParent(parentEnv); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/CastForeignNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/CastForeignNode.java index e19e652678..d52436f13f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/CastForeignNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/CastForeignNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, 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 @@ -22,28 +22,22 @@ */ package com.oracle.truffle.r.nodes.builtin.casts; -import com.oracle.truffle.api.dsl.Cached; -import com.oracle.truffle.api.dsl.ImportStatic; -import com.oracle.truffle.api.dsl.Specialization; -import com.oracle.truffle.api.interop.TruffleObject; +import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.r.nodes.unary.CastNode; import com.oracle.truffle.r.runtime.interop.ForeignArray2R; -@ImportStatic({ForeignArray2R.class}) -public abstract class CastForeignNode extends CastNode { +public final class CastForeignNode extends CastNode { - protected CastForeignNode() { - } + @Child private ForeignArray2R foreignArray2R = ForeignArray2R.create(); - @Specialization(guards = {"foreignArray2R.isForeignVector(obj)"}) - protected Object castForeign(TruffleObject obj, - @Cached("create()") ForeignArray2R foreignArray2R) { - return foreignArray2R.convert(obj); - } + private final ConditionProfile isForeign = ConditionProfile.createBinaryProfile(); - @Specialization(guards = {"!foreignArray2R.isForeignVector(obj)"}) - protected Object passThrough(Object obj, - @Cached("create()") ForeignArray2R foreignArray2R) { - return obj; + @Override + protected Object execute(Object obj) { + if (isForeign.profile(foreignArray2R.isForeignVector(obj))) { + return foreignArray2R.convert(obj); + } else { + return obj; + } } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/Filter.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/Filter.java index 4a644f967f..337b56f08e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/Filter.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -92,7 +92,6 @@ public abstract class Filter<T, R extends T> { private final Class<?> type2; private final Predicate<R> extraCondition; - @SuppressWarnings("rawtypes") public TypeFilter(Class<R> type) { assert type != null; this.type1 = type; @@ -100,7 +99,6 @@ public abstract class Filter<T, R extends T> { this.extraCondition = null; } - @SuppressWarnings({"unchecked", "rawtypes"}) public TypeFilter(Class<R> type, Predicate<R> extraCondition) { assert type != null; this.type1 = type; @@ -108,7 +106,6 @@ public abstract class Filter<T, R extends T> { this.extraCondition = extraCondition; } - @SuppressWarnings("rawtypes") public TypeFilter(Class<?> type1, Class<?> type2) { assert type1 != null && type2 != null; assert type1 != Object.class && type2 != Object.class; @@ -566,8 +563,7 @@ public abstract class Filter<T, R extends T> { /** * This is an enumeration of possible fixed outcomes of a filter's test method for a given input - * value. It is used now only in connection with {@link RNull} and {@link RMissing} as input - * values. + * value. It is used now only in connection with {@link RNull} and {@link RMissing} as input values. * <P> * The <code>FALSE</code>, resp. <code>TRUE</code>, indicates that the filter will always return * <code>false</code>, resp. <code>true</code>, for the given input value. diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/PipelineToCastNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/PipelineToCastNode.java index 037b7b409d..c368d40165 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/PipelineToCastNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/casts/PipelineToCastNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -116,7 +116,7 @@ public final class PipelineToCastNode { boolean singleMapStep = firstStepIn.getNext() == null && firstStepIn instanceof MapIfStep; PipelineStep<?, ?> firstStep = singleMapStep ? ((MapIfStep<?, ?>) firstStepIn).withoutReturns() : firstStepIn; - CastNode firstCastNode = config.getCastForeign() ? CastForeignNodeGen.create() : null; + CastNode firstCastNode = config.getCastForeign() ? new CastForeignNode() : null; Supplier<CastNode> originalPipelineFactory = () -> convert(firstCastNode, firstStep, new CastNodeFactory(config.getDefaultError(), config.getDefaultWarning(), config.getDefaultDefaultMessage())); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java index f6a7f0db7d..3708337af7 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java @@ -23,7 +23,6 @@ package com.oracle.truffle.r.nodes.control; import com.oracle.truffle.api.CompilerAsserts; -import com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.nodes.RepeatingNode; import com.oracle.truffle.api.nodes.RootNode; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ForNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ForNode.java index 7a3866e37c..9a2f65bb07 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ForNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ForNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -80,9 +80,9 @@ public abstract class ForNode extends AbstractLoopNode implements RSyntaxNode, R @Specialization(guards = "!isForeignObject(range)") protected Object iterate(VirtualFrame frame, Object range, - @Cached("createIndexName()") String indexName, - @Cached("createRangeName()") String rangeName, - @Cached("createLengthName()") String lengthName, + @Cached("createIndexName()") @SuppressWarnings("unused") String indexName, + @Cached("createRangeName()") @SuppressWarnings("unused") String rangeName, + @Cached("createLengthName()") @SuppressWarnings("unused") String lengthName, @Cached("createWriteVariable(indexName)") WriteVariableNode writeIndexNode, @Cached("createWriteVariable(rangeName)") WriteVariableNode writeRangeNode, @Cached("createWriteVariable(lengthName)") WriteVariableNode writeLengthNode, @@ -107,13 +107,13 @@ public abstract class ForNode extends AbstractLoopNode implements RSyntaxNode, R @Cached("createWriteVariable(lengthName)") WriteVariableNode writeLengthNode, @Cached("create()") RLengthNode length, @Cached("createForIndexLoopNode(indexName, lengthName, rangeName)") LoopNode l, - @Cached("HAS_SIZE.createNode()") Node hasSize) { + @Cached("HAS_SIZE.createNode()") @SuppressWarnings("unused") Node hasSize) { return iterate(frame, range, indexName, rangeName, lengthName, writeIndexNode, writeRangeNode, writeLengthNode, length, l); } @Specialization(guards = "isJavaIterable(range)") protected Object iterateForeignArray(VirtualFrame frame, Object range, - @Cached("createIteratorName()") String iteratorName, + @Cached("createIteratorName()") @SuppressWarnings("unused") String iteratorName, @Cached("createWriteVariable(iteratorName)") WriteVariableNode writeIteratorNode, @Cached("createForIterableLoopNode(iteratorName)") LoopNode l, @Cached("READ.createNode()") Node readNode, @@ -129,18 +129,18 @@ public abstract class ForNode extends AbstractLoopNode implements RSyntaxNode, R @Specialization(guards = {"isForeignObject(range)", "!isForeignArray(range, hasSizeNode)", "!isJavaIterable(range)"}) protected Object iterateKeys(VirtualFrame frame, Object range, - @Cached("createIndexName()") String indexName, - @Cached("createPositionName()") String positionName, - @Cached("createRangeName()") String rangeName, - @Cached("createKeysName()") String keysName, - @Cached("createLengthName()") String lengthName, + @Cached("createIndexName()") @SuppressWarnings("unused") String indexName, + @Cached("createPositionName()") @SuppressWarnings("unused") String positionName, + @Cached("createRangeName()") @SuppressWarnings("unused") String rangeName, + @Cached("createKeysName()") @SuppressWarnings("unused") String keysName, + @Cached("createLengthName()") @SuppressWarnings("unused") String lengthName, @Cached("createWriteVariable(indexName)") WriteVariableNode writeIndexNode, @Cached("createWriteVariable(rangeName)") WriteVariableNode writeRangeNode, @Cached("createWriteVariable(keysName)") WriteVariableNode writeKeysNode, @Cached("createWriteVariable(lengthName)") WriteVariableNode writeLengthNode, @Cached("createForKeysLoopNode(indexName, positionName, lengthName, rangeName, keysName)") LoopNode l, @Cached("KEYS.createNode()") Node keysNode, - @Cached("HAS_SIZE.createNode()") Node hasSizeNode, + @Cached("HAS_SIZE.createNode()") @SuppressWarnings("unused") Node hasSizeNode, @Cached("GET_SIZE.createNode()") Node sizeNode) { try { TruffleObject keys = ForeignAccess.sendKeys(keysNode, (TruffleObject) range); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java index ce7183dbc7..fbb1754702 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java @@ -23,7 +23,6 @@ package com.oracle.truffle.r.nodes.function; import java.util.ArrayList; -import java.util.IdentityHashMap; import java.util.List; import com.oracle.truffle.api.Assumption; @@ -70,8 +69,6 @@ import com.oracle.truffle.r.runtime.Utils.DebugExitException; import com.oracle.truffle.r.runtime.builtins.RBuiltinDescriptor; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.context.TruffleRLanguage; -import com.oracle.truffle.r.runtime.data.Closure; -import com.oracle.truffle.r.runtime.data.ClosureCache; import com.oracle.truffle.r.runtime.data.ClosureCache.RNodeClosureCache; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RPairList; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java index b42898c63e..f677a2ecfd 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionExpressionNode.java @@ -35,7 +35,6 @@ import com.oracle.truffle.r.nodes.function.opt.EagerEvalHelper; import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.nodes.instrumentation.RInstrumentation; import com.oracle.truffle.r.runtime.ArgumentsSignature; -import com.oracle.truffle.r.runtime.builtins.FastPathFactory; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java index 16ba409614..bc87ff97fc 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java @@ -260,9 +260,9 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS } /** - * If there are no parameters, or the target function does not refer to a builtin, or the - * builtin has no special dispatching, then we know that we will just call the function with no - * special dispatch logic. + * If there are no parameters, or the target function does not refer to a builtin, or the builtin + * has no special dispatching, then we know that we will just call the function with no special + * dispatch logic. */ protected boolean isDefaultDispatch(RFunction function) { return (signature != null && signature.isEmpty()) || nullBuiltinProfile.profile(function.getRBuiltin() == null) || function.getRBuiltin().getDispatch() == RDispatch.DEFAULT; @@ -285,9 +285,9 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS } /** - * If the target function refers to a builtin that requires internal generic dispatch and there - * are actual parameters to dispatch on, then we will do an internal generic dispatch on the - * first parameter. + * If the target function refers to a builtin that requires internal generic dispatch and there are + * actual parameters to dispatch on, then we will do an internal generic dispatch on the first + * parameter. */ protected boolean isInternalGenericDispatch(RFunction function) { if (signature != null && signature.isEmpty()) { @@ -667,7 +667,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS RInternalError.reportError(e); throw RError.interopError(RError.findParentRBase(this), e, function); } catch (RuntimeException e) { - throw RError.handleInteropException(this, e, function); + throw RError.handleInteropException(this, e); } } @@ -751,9 +751,8 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS } /** - * Creates a modified call in which the first N arguments are replaced by - * {@code replacementArgs}. This is only used to support - * {@code HiddenInternalFunctions.MakeLazy}. + * Creates a modified call in which the first N arguments are replaced by {@code replacementArgs}. + * This is only used to support {@code HiddenInternalFunctions.MakeLazy}. */ @TruffleBoundary public static RCallNode createCloneReplacingArgs(RCallNode call, RSyntaxNode... replacementArgs) { @@ -815,8 +814,8 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS /** * Note: s3DefaultArguments is intended to carry default arguments from - * {@link RCallNode#callGroupGeneric} if the R dispatch method has some. Currently this is - * only the case for 'summary' group so this argument is either null or set to + * {@link RCallNode#callGroupGeneric} if the R dispatch method has some. Currently this is only the + * case for 'summary' group so this argument is either null or set to * {@link RArguments#SUMMARY_GROUP_DEFAULT_VALUE_NA_RM} */ public abstract Object execute(VirtualFrame frame, RFunction function, Object varArgs, Object s3Args, Object s3DefaultArguments); @@ -882,8 +881,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS } /* - * Use a TruffleBoundaryNode to be able to switch child nodes without invalidating the whole - * method. + * Use a TruffleBoundaryNode to be able to switch child nodes without invalidating the whole method. */ protected final class GenericCall extends TruffleBoundaryNode { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java index 7d56657dec..34dbaafbe5 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastComplexNode.java @@ -36,7 +36,6 @@ import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RComplexVector; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RList; -import com.oracle.truffle.r.runtime.data.RLogicalVector; import com.oracle.truffle.r.runtime.data.RMissing; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RPairList; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java index ca459c41a3..1ede1d748c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerNode.java @@ -36,7 +36,6 @@ import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames; import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RDoubleSequence; -import com.oracle.truffle.r.runtime.data.RDoubleVector; import com.oracle.truffle.r.runtime.data.RIntSequence; import com.oracle.truffle.r.runtime.data.RIntVector; import com.oracle.truffle.r.runtime.data.RList; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastLogicalNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastLogicalNode.java index b198081c7e..8df91e8627 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastLogicalNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastLogicalNode.java @@ -33,7 +33,6 @@ import com.oracle.truffle.r.nodes.helpers.InheritsCheckNode; 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.RIntVector; import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RLogicalVector; import com.oracle.truffle.r.runtime.data.RMissing; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java index d270202091..3613830314 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java @@ -32,7 +32,6 @@ import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RLogicalVector; import com.oracle.truffle.r.runtime.data.RMissing; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RPairList; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java index d3cb285c7c..8515ffef86 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/PrecedenceNode.java @@ -168,7 +168,7 @@ public abstract class PrecedenceNode extends RBaseNode { return doListRecursiveInternal(val, precedenceNode, recursive); } - private int doListRecursiveInternal(RAbstractListVector val, PrecedenceNode precedenceNode, boolean recursive) { + private static int doListRecursiveInternal(RAbstractListVector val, PrecedenceNode precedenceNode, boolean recursive) { int precedence = -1; for (int i = 0; i < val.getLength(); i++) { precedence = Math.max(precedence, precedenceNode.executeInteger(val.getDataAt(i), recursive)); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FileSystemUtils.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FileSystemUtils.java index 8d9a196593..b5a050a2d9 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FileSystemUtils.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FileSystemUtils.java @@ -23,11 +23,8 @@ package com.oracle.truffle.r.runtime; import java.io.IOException; -import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.attribute.FileAttribute; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.util.EnumSet; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyResourceHandlerFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyResourceHandlerFactory.java index aa6ee73ec4..9615cb547d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyResourceHandlerFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/LazyResourceHandlerFactory.java @@ -106,8 +106,7 @@ class LazyResourceHandlerFactory extends ResourceHandlerFactory implements Handl } return result; } catch (Exception ex) { - RSuicide.rSuicide(RContext.getInstance(), ex, "Could not load R files from resources. Details: " + ex.getMessage()); - return null; + throw RSuicide.rSuicide(RContext.getInstance(), ex, "Could not load R files from resources. Details: " + ex.getMessage()); } } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCleanUp.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCleanUp.java index 61ddc58a29..17b2a0cdd2 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCleanUp.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCleanUp.java @@ -13,7 +13,6 @@ package com.oracle.truffle.r.runtime; import java.util.ArrayList; -import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.RootCallTarget; import com.oracle.truffle.api.Truffle; import com.oracle.truffle.api.frame.VirtualFrame; @@ -21,13 +20,6 @@ import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.r.launcher.RStartParams; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.context.RContext.ConsoleIO; -import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RIntVector; -import com.oracle.truffle.r.runtime.ffi.CallRFFI.InvokeCallNode; -import com.oracle.truffle.r.runtime.ffi.DLL.RFindSymbolNode; -import com.oracle.truffle.r.runtime.ffi.DLL.SymbolHandle; -import com.oracle.truffle.r.runtime.ffi.NativeCallInfo; -import com.oracle.truffle.r.runtime.ffi.REmbedRFFI; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI.EmbeddedCleanUpNode; import com.oracle.truffle.r.runtime.gnur.SA_TYPE; import com.oracle.truffle.r.runtime.instrument.InstrumentationState; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java index 9c04e55fe4..a4cc7250eb 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java @@ -192,7 +192,7 @@ public final class RError extends RuntimeException implements TruffleException { } @TruffleBoundary - public static RError handleInteropException(Node node, RuntimeException e, TruffleObject o) { + public static RError handleInteropException(Node node, RuntimeException e) { if (e instanceof TruffleException) { if (RContext.getInstance().stateInteropTry.isInTry()) { // will be catched and handled in .fastr.interop.try builtin diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java index ee28563e94..7289839a04 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSerialize.java @@ -299,8 +299,10 @@ public class RSerialize { /** * Supports the saving of deparsed lazily loaded package functions for instrumentation access. */ - public static void setSaveDeparse(boolean status) { + public static void setSaveDeparse(@SuppressWarnings("unused") boolean status) { + @SuppressWarnings("unused") ContextStateImpl serializeContextState = getContextState(); + // TODO: reenable this functionality } @TruffleBoundary diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSuicide.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSuicide.java index 18e74dc486..66eb80b63a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSuicide.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSuicide.java @@ -22,20 +22,12 @@ */ package com.oracle.truffle.r.runtime; -import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.RootCallTarget; import com.oracle.truffle.api.Truffle; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.r.runtime.context.RContext; -import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RStringVector; -import com.oracle.truffle.r.runtime.ffi.CallRFFI.InvokeCallNode; -import com.oracle.truffle.r.runtime.ffi.DLL.RFindSymbolNode; -import com.oracle.truffle.r.runtime.ffi.DLL.SymbolHandle; -import com.oracle.truffle.r.runtime.ffi.NativeCallInfo; import com.oracle.truffle.r.runtime.ffi.REmbedRFFI.EmbeddedSuicideNode; -import com.oracle.truffle.r.runtime.ffi.RFFIFactory; public abstract class RSuicide { private RSuicide() { @@ -58,7 +50,8 @@ public abstract class RSuicide { throw rSuicideDefault(msg); } - public static RuntimeException rSuicide(RContext ctx, Throwable cause, String msg) { + public static RuntimeException rSuicide(RContext ctx, @SuppressWarnings("unused") Throwable cause, String msg) { + // TODO: output "cause" invokeUserDefinedSuicide(ctx, msg); throw rSuicideDefault(msg); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/EvalThread.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/EvalThread.java index 002526c7f6..ef11fec1bc 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/EvalThread.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/EvalThread.java @@ -103,7 +103,7 @@ public class EvalThread extends Thread { Engine rEngine = RContext.getEngine(); // Object eval = rEngine.eval(rEngine.parse(source), rEngine.getGlobalFrame()); Object evalResult = rEngine.parseAndEval(source, rEngine.getGlobalFrame(), false); - result = createEvalResult(evalResult == null ? RNull.instance : evalResult, false); + result = RDataFactory.createList(new Object[]{evalResult == null ? RNull.instance : evalResult}); } catch (ParseException e) { e.report(info.getStdout()); result = createErrorResult(e.getMessage()); @@ -124,16 +124,6 @@ public class EvalThread extends Thread { return result; } - /** - * The result is an {@link RList} contain the value, plus an "error" attribute if the evaluation - * resulted in an error. - */ - @TruffleBoundary - private static RList createEvalResult(Object result, boolean usePolyglot) { - assert result != null; - return RDataFactory.createList(new Object[]{result}); - } - @TruffleBoundary public static RList createErrorResult(String errorMsg) { RList list = RDataFactory.createList(new Object[]{RRuntime.LOGICAL_NA}); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/BaseRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/BaseRFFI.java index a658970712..42ad63917c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/BaseRFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/BaseRFFI.java @@ -28,7 +28,6 @@ import java.util.Map; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.interop.java.JavaInterop; import com.oracle.truffle.r.runtime.ffi.base.ESoftVersionResult; import com.oracle.truffle.r.runtime.ffi.base.GlobResult; import com.oracle.truffle.r.runtime.ffi.base.ReadlinkResult; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DownCallNodeFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DownCallNodeFactory.java index af484e9aee..c6907f7bd3 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DownCallNodeFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DownCallNodeFactory.java @@ -88,13 +88,13 @@ public abstract class DownCallNodeFactory { * Should return a {@link TruffleObject} that will invoke the given function upon the * {@code EXECUTE} message. */ - protected abstract TruffleObject getTarget(NativeFunction function); + protected abstract TruffleObject getTarget(NativeFunction f); /** * Allows to transform the arguments before the execute message is sent to the result of * {@link #getTarget(NativeFunction)}. */ - protected abstract long beforeCall(NativeFunction nativeFunction, TruffleObject function, Object[] args); + protected abstract long beforeCall(NativeFunction nativeFunction, TruffleObject f, Object[] args); /** * Allows to post-process the arguments after the execute message was sent to the result of @@ -102,6 +102,6 @@ public abstract class DownCallNodeFactory { * {@link #beforeCall(NativeFunction, TruffleObject, Object[])} was not successfull, the * {@code before} parameter will have value {@code -1}. */ - protected abstract void afterCall(long before, NativeFunction function, TruffleObject target, Object[] args); + protected abstract void afterCall(long before, NativeFunction f, TruffleObject t, Object[] args); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java index ff82db0faf..9c4beb34f0 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java @@ -26,7 +26,7 @@ package com.oracle.truffle.r.runtime.ffi; * Collection of statically typed Lapack methods that are used in the {@code base} package. The * signatures match the Fortran definition with the exception that the "info" value is returned as * the result of the call. - * + * * The documentation for individual functions can be found in the * <a href="http://www.netlib.org/lapack/explore-html">spec</a>. */ @@ -47,7 +47,7 @@ public final class LapackRFFI { } public void execute(int[] version) { - call((Object) version); + call(version); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/PCRERFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/PCRERFFI.java index 4bc7d2fc40..ce118468cb 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/PCRERFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/PCRERFFI.java @@ -153,7 +153,8 @@ public final class PCRERFFI { super(factory.createDownCallNode(NativeFunction.study)); } - public Result execute(long code, int options) { + @SuppressWarnings("unused") + public static Result execute(long code, int options) { throw RInternalError.shouldNotReachHere("The factory method should throw unimplemented already"); } @@ -199,6 +200,7 @@ public final class PCRERFFI { return new GetCaptureNamesNode(downCallNodeFactory); } + @SuppressWarnings("static-method") public StudyNode createStudyNode() { throw RInternalError.unimplemented("study function in PCRE"); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIContext.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIContext.java index c5de3d2ae5..cd0f4118da 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIContext.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/RFFIContext.java @@ -88,6 +88,7 @@ public abstract class RFFIContext extends RFFI { * the list of preserved objects. */ public void beforeUpcall(boolean canRunGc) { + // empty by default } public void afterUpcall(boolean canRunGc) { @@ -99,7 +100,8 @@ public abstract class RFFIContext extends RFFI { /** * Invoked during RContext initialization, but after the global environment is set up. */ - public void initializeVariables(RContext context) { + public void initializeVariables(@SuppressWarnings("unused") RContext context) { + // empty by default } /** @@ -109,7 +111,7 @@ public abstract class RFFIContext extends RFFI { * threaded and always creates exactly one context. This method shall be invoked after * {@link #initialize(RContext)} and {@link #initializeVariables(RContext)}. */ - public void initializeEmbedded(RContext context) { + public void initializeEmbedded(@SuppressWarnings("unused") RContext context) { throw RInternalError.unimplemented("R Embedding not supported with " + this.getClass().getSimpleName() + " RFFI backend."); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/ToolsRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/ToolsRFFI.java index 34ef4a966a..2c49b3677a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/ToolsRFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/ToolsRFFI.java @@ -24,7 +24,6 @@ package com.oracle.truffle.r.runtime.ffi; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.nodes.Node; -import com.oracle.truffle.api.nodes.NodeInterface; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.conn.RConnection; import com.oracle.truffle.r.runtime.data.RLogicalVector; @@ -75,7 +74,7 @@ public final class ToolsRFFI { } } - public ParseRdNode createParseRdNode() { + public static ParseRdNode createParseRdNode() { return new ParseRdNode(); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativePointer.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativePointer.java index a42e1133dc..0b113e2711 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativePointer.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativePointer.java @@ -54,7 +54,8 @@ public class NativePointer implements TruffleObject { private static int tableHwm; private static class Table { - private final RTruffleObject object; + // TODO: is this reference to object needed? + @SuppressWarnings("unused") private final RTruffleObject object; private final long nativePointer; Table(RTruffleObject object, long nativePointer) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/FastrInteropTryContextState.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/FastrInteropTryContextState.java index 4505048c89..c8cd0dfc97 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/FastrInteropTryContextState.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/FastrInteropTryContextState.java @@ -27,7 +27,6 @@ import com.oracle.truffle.r.runtime.context.RContext; /** * Context-specific state relevant to the .fastr.interop.try builtins. */ -@SuppressWarnings("serial") public class FastrInteropTryContextState implements RContext.ContextState { /** * Values is either NULL or an RPairList, for {@code restarts}. diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java index 16ace45dfb..2cd826b868 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java @@ -152,11 +152,11 @@ public abstract class ForeignArray2R extends RBaseNode { @Specialization(guards = "isJavaIterable(obj)") @TruffleBoundary - protected ForeignArrayData doJavaIterable(TruffleObject obj, @SuppressWarnings("unused") boolean recursive, ForeignArrayData arrayData, int depth, + protected ForeignArrayData doJavaIterable(TruffleObject obj, @SuppressWarnings("unused") boolean recursive, ForeignArrayData arrayData, @SuppressWarnings("unused") int depth, @Cached("createExecute(0).createNode()") Node execute) { try { - return getIterableElements(arrayData == null ? new ForeignArrayData() : arrayData, obj, execute, depth); + return getIterableElements(arrayData == null ? new ForeignArrayData() : arrayData, obj, execute); } catch (UnsupportedMessageException | UnknownIdentifierException | UnsupportedTypeException | ArityException e) { throw error(RError.Message.GENERIC, "error while casting external object to list: " + e.getMessage()); } @@ -197,7 +197,7 @@ public abstract class ForeignArray2R extends RBaseNode { return arrayData; } - private ForeignArrayData getIterableElements(ForeignArrayData arrayData, TruffleObject obj, Node execute, int depth) + private ForeignArrayData getIterableElements(ForeignArrayData arrayData, TruffleObject obj, Node execute) throws UnknownIdentifierException, ArityException, UnsupportedMessageException, UnsupportedTypeException { if (read == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java index c42a6dbd1e..694a5de17e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RBaseNode.java @@ -185,7 +185,7 @@ public abstract class RBaseNode extends Node { return getRSyntaxNode().getSourceSection(); } - public boolean hasTag(Class<? extends Tag> tag) { + public boolean hasTag(@SuppressWarnings("unused") Class<? extends Tag> tag) { // RNode, which is instrumentable, overrides this to actually check if the node has the tag return false; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java index 333fbe9f21..1e3ad2a9a8 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RInstrumentableNode.java @@ -22,12 +22,8 @@ */ package com.oracle.truffle.r.runtime.nodes; -import com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode; import com.oracle.truffle.api.instrumentation.InstrumentableNode; -import com.oracle.truffle.api.instrumentation.Tag; import com.oracle.truffle.api.nodes.Node; -import com.oracle.truffle.r.runtime.RRuntimeASTAccess; -import com.oracle.truffle.r.runtime.context.RContext; /** * Some additional support for instrumentable nodes. diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java index 3e46568e4f..cf1870d917 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java @@ -12,7 +12,6 @@ package com.oracle.truffle.r.test.builtins; import org.junit.Test; -import com.oracle.truffle.r.test.TestBase; import com.oracle.truffle.r.test.TestRBase; // Checkstyle: stop line length check @@ -484,7 +483,7 @@ public class TestBuiltin_asvector extends TestRBase { "as.environment(list(a=3,b=4,x=5))", }; - private final String[] otherValues = new String[]{ + @SuppressWarnings("unused") private final String[] otherValues = new String[]{ "NULL", }; diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/AbstractMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/AbstractMRTest.java index db917705ad..9fcf40ab9e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/AbstractMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/AbstractMRTest.java @@ -253,7 +253,7 @@ public abstract class AbstractMRTest { }); } - private void testKeys(TruffleObject obj) throws UnknownIdentifierException, UnsupportedMessageException { + private void testKeys(TruffleObject obj) throws UnknownIdentifierException { try { TruffleObject keysObj = ForeignAccess.sendKeys(Message.KEYS.createNode(), obj); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java index fa4893330d..29d48191b2 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java @@ -55,12 +55,12 @@ public class ListMRTest extends AbstractMRTest { } @Test - public void testKeysReadWrite() throws UnsupportedMessageException, UnknownIdentifierException, UnsupportedTypeException { + public void testKeysReadWrite() { testKeysReadWrite("list"); testKeysReadWrite("pairlist"); } - private void testKeysReadWrite(String createFun) throws UnsupportedMessageException, UnknownIdentifierException, UnsupportedTypeException { + private void testKeysReadWrite(String createFun) { execInContext(() -> { RAbstractContainer l = create(createFun, testValues); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RFunctionMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RFunctionMRTest.java index deb0bbd202..a6ce7ce890 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RFunctionMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RFunctionMRTest.java @@ -25,23 +25,20 @@ package com.oracle.truffle.r.test.engine.interop; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import org.graalvm.polyglot.Source; +import org.graalvm.polyglot.Value; import org.junit.Test; -import com.oracle.truffle.api.interop.ArityException; import com.oracle.truffle.api.interop.ForeignAccess; import com.oracle.truffle.api.interop.Message; import com.oracle.truffle.api.interop.TruffleObject; -import com.oracle.truffle.api.interop.UnsupportedMessageException; -import com.oracle.truffle.api.interop.UnsupportedTypeException; import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.test.generate.FastRSession; -import org.graalvm.polyglot.Source; -import org.graalvm.polyglot.Value; public class RFunctionMRTest extends AbstractMRTest { @Test - public void testExecute() throws UnsupportedTypeException, ArityException, UnsupportedMessageException { + public void testExecute() { execInContext(() -> { RFunction f = create("function() {}"); assertTrue(ForeignAccess.sendIsExecutable(Message.IS_EXECUTABLE.createNode(), f)); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java index d232a891eb..a48f99ef13 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java @@ -1558,18 +1558,6 @@ public class TestJavaInterop extends TestBase { return sb.toString(); } - private String getRValuesAsString(Object... values) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < values.length; i++) { - Object v = values[i]; - sb.append(getRValue(v)); - if (i < values.length - 1) { - sb.append(","); - } - } - return sb.toString(); - } - private static String getBooleanPrefix(Object array, int i) { Object element = Array.get(array, i); if (element == null) { -- GitLab