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 9ea740469f754190b491e7250c80116e363ab2b4..52dd4f23b3776d046974c127c0aeb4970376fb79 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 e551bd71487c301541e4e1a2c9a3e800f11d7453..4af701bbecf95d302ed5f309cfbdb55e46575df1 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 e40dcb1c72c6843c17952ad2ae836baaf95c6f79..f38d6a838cd6592850bcadf0d0ca6b67662d81f9 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 722f0a242cc963a2ee2a412ca4562e7c409ed212..8600debf0f56ffc56e005d085e839bc0343a2170 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 5276e0615970956356027f27cb8ec74fd383ecaf..f2141a851ceeab75ffd2acef3efb666986e85a3e 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 eaeb8c8b05ff93e3a9e6b27eb7b730ed1e9d3734..ede11e852afc55a643e0a7d8279c4369306f58b8 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 b002c4884753b040aa1f819f1f955610cafbc587..b6f64538766fe56e84e112b60abd74fd3efda32a 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 c54cca485f6a5db8e33ef0cbc90c815430c5c7c5..2481ed6657941b672b67d362ee2813b70fc1b41b 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 fe2516186b964aedba1c7f43c913dfc0f4da7993..a6d0515c5166861b7f7047f7142942b638e96445 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 1b2b55205c58fd9e3de6a7f9463a2ea1a1d20cd1..c7259e65589b01a8b4b0b5d128386b69e8c5b6e2 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 4b795471d4427658e9c5ea5a0f73e1015fcdf12d..a3dd1b686b35e0e3b06c884c2855745ce61812df 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 5cd71fdfe952d7807f23069e77acf9ce619957ca..6e73843f7b4bea548187d329a4859a74ef0979fc 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 54f4d5fa3367d07ad73599aae93d2a5d6e9c9620..ae47a2ce3f87f5ad4231c981663d678c2c3dad53 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 4548d0e625c3eca89033c5ad78fcb9d59413a531..8e105b3f70ec82a45fddda44eb816ba00b1b5c1b 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 77cd59a19da1778978cc5499701e667e8b651d98..9558c56840ffc009159cf58c23670e17ab3fec2a 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 23a7f92db67eb6c30eff8b842730e90b8bbf7ab7..e70b7b641f45d59eff769c0d28b7fd1e88fd3864 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 6cc23c226a396e2fb1db655a32f9065dec28bc82..bafb494bc00592f463fa79b6f74af58260837ae1 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 2aa4664219aa997fd89d5d1b6c14d45f4038ce85..413d1c638de09fd1196147c76afa752231cb8a39 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 c334bab4857d693959a0820907d55b3a1f80ab7d..806ed306b251caef8c9a6d6e15b6d4524606b3ef 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 2dd4e5a5b0a01889ea5e73e59f7b09826dd6ceef..06688ca961b4a77734e5f3b8b17ba0e26e7e9170 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 3307dd77efb932a6d360932c564a1757a1c31b0c..4fe0972db41404e79ef59ff3e595ae28c64f3814 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 b62147da84a016d7f4cd51f1ab5090db514cc0a9..2e54572883daa228cad7d64d447a8a1703bc5469 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 9f8a0e01094bf9ea30cbb00d05c7276aa1dee70b..21250f4c7bff8db251cdf36c9086c102c23bb88e 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 c67e53a67541901595fcd9967e20eeb2a8d6804b..1aec1a232ca6b819777c2b14d0b1f94f354a960f 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 dd35239badd6926d5752e2991c11e175a68fd6f6..f165604b379ef0e8da159970c8d0e9dfa643a9de 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 9ac6720898a184d9d292d66af8368b24546e12d1..428abc7bdb996d1257d01ecee3d3ab2a4451f6d2 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 4cbfd06eec2158522d899cf2380d7c8792dfa3c0..c67f195568f87887e16278c1827f7472ef09b915 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 b84f42df004c7122f61848ed0beb534b3eddaa38..66c49f3c0a52f161265f6f622a32b9430d595d1d 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 45461997df5e49761b91fe8ffce544761b4cac25..40e244346f559d36e8638447cabec46183141d31 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 149ee82320863105c60f82dc564a567295d27202..a5029b6c6cc93b94070765d5785bcd3d18431f03 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 89c5c092bf28c170e140c0bd228d38b14e200906..471046352716407535eac2d8d2435d0bc16026b1 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 6e2f7dda034d4056c45c345461a5f00d5ab29686..57731e227b22dd8f2276bab6d1ef293444526e7a 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 88be8006f564bec1b90e79cc09baa2c0d40963b2..1a19c3ea05b608473fc20e9527a1d358eb5ba4a1 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 4b7a5d24b23c20640083835a003cd38c255a7448..6e3a30e828272d12eedca5addb15d1565ae57459 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 1e1194bbfc6eafdce215b24b087809cd5aaf806d..df9b8b45095e425793fcc862d9c7e00ec05239be 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 a560f8f4a05a57ff7a664ac4c59e5f3c68d12f05..03a083f18a546b2e990648693ac6580bae5a8d45 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 8251eb1da6de0ef5e3fb352da5b2eba3d5f72bb2..a7e9cde29440df9768296811fb32020428499143 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 0393807fe66776526f373373691c8a26c274be1f..2aedfac0707be8acaf0258d75038cc5142210fd5 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 a7879e7a0c3589ecca41ff7087dca78b32b651c8..4f8eccbddde2caddc2f6253a6aa9040d31cc7016 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 1e5a320d89dcebbaaa0b5174eb2dd3b9e6e3c1af..c853bf84558ddd1f4807669b390891a4f2da839e 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 107b02ea74c06e5f4d067ab9738cbe24d8cf4225..0c51ea27ed2d91ed93cb2f1b86aee8fa3662940a 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 8da59509fff8f7523de4d3ad3a3ff33a0de82738..adc76dc605830af8f794d21d417b2936c10c2aa2 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 802b049011e4aa701e472058bccfd5a4b60ffa30..831dfe285317a27219cef509331f2852c94a3476 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 9179838da5c2224a0844e393344184772dbe981c..7db239af4e42401fe278380fc3824c4d75c79d6e 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 5e3eac7f322bee7d3c639aea2071363f519d7639..b52c435d98a4270d1ab274a864877cb04eeb6a96 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 8dc15dad451a705e1337dc30982b7f5e121ccd0e..5239122f775597c40faa204e46a803e2b5b54107 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 fda59988b92dd86d2a049a7d8f417642bbde717b..f29e0c1400098cd021e1ab6cdbc77434a90cdfb7 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 7318fc93e76a730860ec878c60f210eab449b95e..7048b7a331249a9ef36c80779eb89a56a12bd26a 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 1010da72fc1e83aaf3baa3dff5bacc0eb630d277..3003dad63a279fa7273b797013f8bab56d874feb 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 3c4af86bd295b172d3a136aa00d3805762b258f8..0b4a296297a4d83a7ec0e04e779b54102b41d504 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 18892d089c7ab135eae636fb4987866448547f93..2adbdc699b35da9b5e02328daa83978848b89403 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 14bd617b1b75f74da392ed22cf4cf50f1c1469ca..e5112aec298186eea4ff941e82ada0a89fd1a3ed 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 c912a44eec2ccaefed18d5abbbeb099ed57300ee..bea8d310858437be10b4c926572d88b8a86a46b2 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 ef47ee3c2416d3e4aa7988a97c554a6ec26c3a41..c1c7c48766441c3e694f4b0c5d2ec82c425ea7ae 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 e19e652678ef3909ff9129e9dec30b32fc186e1f..d52436f13ffcd2a8cfbc91a5a16d5ed68538cb99 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 4a644f967f71829869af582ee5f85017766acb47..337b56f08e1dee53ede2433113e49a02ea5a1b29 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 037b7b409d29b3cb39e93ba4cd6dba9da5156f9f..c368d4016558b688491779716f26e2f346d63b46 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 f6a7f0db7d59992d0a2e306febecd6b53d6d05b5..3708337af763822520b3be20f3ca3409f81e0b3a 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 7a3866e37c07060d7d91c0874338fefd8e6f67b0..9a2f65bb077817edefc2137ce4eb1550ac4b9f05 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 ce7183dbc7947c5153657234906ea74a71055fe7..fbb1754702a62025866fb7a5f843c0f22ddce9ef 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 b42898c63e0cb8070e1c27b4dc41ae07c29cae56..f677a2ecfd1eafa8d83508c7a005c345d7ae131d 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 16ba409614756338d6683f0af586e408ccc5eff2..bc87ff97fcb7c3947407f3a5c23c5f93d44f0967 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 7d56657deccb7d9132450e7ce132c4dc33eea7aa..34dbaafbe58523b337c5df400c84910fa3ec88cc 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 ca459c41a3a4019e2475eff38382941e03f6a3ce..1ede1d748c1ee6ecb03f1fb779e3d8ae87756721 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 b198081c7e6f0dec794ce242905b1fe067247140..8df91e8627608a45b6875e452dd81e057981c25e 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 d2702020918fe1a8aa6d4f610efa86cabc123339..361383031470940faba47fde77d7cd07f19587c7 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 d3cb285c7c354f12e3781ece0f1f997b6213e1f9..8515ffef861c03f83bd5e7e310f4c4d91dbc5a81 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 8d9a196593dcbc57fbbe798bdc4323ab6d62daaf..b5a050a2d94f23b09e944be192d65a7bed8d3615 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 aa6ee73ec427c41d2fc45fa5a705419b78c25421..9615cb547d255838334d69655597c652df347a61 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 61ddc58a29f36f818353ceb8ad4264d102d68ce8..17b2a0cdd2e1b679f46aae2fa69f3507767c365b 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 9c04e55fe45ece31a5d914e6c135a75f40f65b4d..a4cc7250eb6f3bc3bf9fd94fa9592e862351bd29 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 ee28563e943c83ab9b5e032585bd83a8d8988f83..7289839a040ab3c413fa47aa2ae85ec5e8ad6f5e 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 18e74dc486654fc7ec677b7bf7906ea82c453c5e..66eb80b63abe747f0816b60b3f6c1883106940aa 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 002526c7f6f1e4ece87216d1f3bdfb0ff1062417..ef11fec1bc08ab328e32ad98c4aa3be631767192 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 a6589707125cfd506561878dc0a2874844a8c0db..42ad63917c2df2737a102a5318d53a5367d38956 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 af484e9aeee40bfe2225c722bcae3ca0569b6dfd..c6907f7bd3e719f603ded3380f9efb233074361a 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 ff82db0fafbdbdfb456ba01b51c91b66a6835652..9c4beb34f0d7d3bced838a607c7e9c9d770bb6ae 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 4bc7d2fc40c411c98f1ecbfd3bdc405ed638fdeb..ce118468cb4ea2576ae5a289c4854197483fa60d 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 c5de3d2ae536710aa313255f05c5a950ddef56d7..cd0f4118da5b656f164fd6d4fc5964f557d1d22e 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 34ef4a966a9d902205ce7a03b932b5fe1b5d8b69..2c49b3677a6c3a457a8f50eac8cf388bb1aeccd8 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 a42e1133dc9f28558d8e186774bf7c0e3586fdc1..0b113e2711af7b0cae6a9c4c3c5d4e61e1e784df 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 4505048c89b3039cbbe79f65fc6d91ed7fff5648..c8cd0dfc9798d81dcc5e2f8be1e6a3b51461d942 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 16ace45dfb338c7f2bf2d049c5699ccd91c0209e..2cd826b8689a3a24251aa967c053f58ca022fa80 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 c42a6dbd1eece79cc3d085fc7fbb8901d62a8ed8..694a5de17e9537f7086c2f69b57c029243c7d1c3 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 333fbe9f21a37cc6b34b24ee6b7d8d5bce7b3fa2..1e3ad2a9a8fc5ef2c047639410de6cfd086b3c64 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 3e46568e4f5c12099da298eb3c7af44c23ce9764..cf1870d917f8e864e10595f84d29df46ad3d391a 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 db917705ada773c565d14e55c4db64f311641347..9fcf40ab9e89f21c660e35e441c8bafffc5b9d14 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 fa4893330d078656cb9cba1f07c66baf7d0bd45b..29d48191b221e2143876dce368f6e3935e2f09af 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 deb0bbd2029a62e31d00f9343828b91749f772fd..a6ce7ce890d7fa8de67873e722c4fea74942cefc 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 d232a891eb95bd3ecd01371eaadc88e6dd457806..a48f99ef1321e44a58d58491625b9420d9f1818e 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) {