diff --git a/.hgtags b/.hgtags index 4cf0714831f4ee03da282608152e000bcf6f72f4..4346847fec507cd1c84deb57fb600a27e995e210 100644 --- a/.hgtags +++ b/.hgtags @@ -1 +1,2 @@ cd6299d53b7ffa10752111cb90c4eec9958cc0f8 before_promises +e5aa9761f361e2e8e74e41169640111bd44011f3 package_loading_ok 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 9736769738143daaf855de86da4fa6450b195851..a3041d508482dc0913ce2c3fa29c764357541b9e 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 @@ -71,7 +71,7 @@ public final class REngine implements RContext.Engine { * @param crashOnFatalErrorArg if {@code true} any unhandled exception will terminate the * process. * @return a {@link VirtualFrame} that can be passed to - * {@link #parseAndEval(String, VirtualFrame, REnvironment, boolean)} + * {@link #parseAndEval(String, VirtualFrame, REnvironment, boolean, boolean)} */ public static VirtualFrame initialize(String[] commandArgs, ConsoleHandler consoleHandler, boolean crashOnFatalErrorArg, boolean headless) { startTime = System.nanoTime(); @@ -96,16 +96,16 @@ public final class REngine implements RContext.Engine { ROptions.initialize(); RProfile.initialize(); // eval the system profile - singleton.parseAndEval(RProfile.systemProfile(), baseFrame, REnvironment.baseEnv(), false); + singleton.parseAndEval(RProfile.systemProfile(), baseFrame, REnvironment.baseEnv(), false, false); REnvironment.packagesInitialize(RPackages.initialize()); RPackageVariables.initialize(); // TODO replace with R code String siteProfile = RProfile.siteProfile(); if (siteProfile != null) { - singleton.parseAndEval(siteProfile, baseFrame, REnvironment.baseEnv(), false); + singleton.parseAndEval(siteProfile, baseFrame, REnvironment.baseEnv(), false, false); } String userProfile = RProfile.userProfile(); if (userProfile != null) { - singleton.parseAndEval(userProfile, globalFrame, REnvironment.globalEnv(), false); + singleton.parseAndEval(userProfile, globalFrame, REnvironment.globalEnv(), false, false); } return globalFrame; } @@ -130,14 +130,14 @@ public final class REngine implements RContext.Engine { return childTimes; } - public Object parseAndEval(String rscript, VirtualFrame frame, REnvironment envForFrame, boolean printResult) { - return parseAndEvalImpl(new ANTLRStringStream(rscript), Source.asPseudoFile(rscript, "<shell_input>"), frame, printResult); + public Object parseAndEval(String rscript, VirtualFrame frame, REnvironment envForFrame, boolean printResult, boolean allowIncompleteSource) { + return parseAndEvalImpl(new ANTLRStringStream(rscript), Source.asPseudoFile(rscript, "<shell_input>"), frame, printResult, allowIncompleteSource); } public Object parseAndEvalTest(String rscript, boolean printResult) { VirtualFrame frame = RRuntime.createNonFunctionFrame(); REnvironment.resetForTest(frame); - return parseAndEvalImpl(new ANTLRStringStream(rscript), Source.asPseudoFile(rscript, "<test_input>"), frame, printResult); + return parseAndEvalImpl(new ANTLRStringStream(rscript), Source.asPseudoFile(rscript, "<test_input>"), frame, printResult, false); } public class ParseException extends Exception { @@ -151,7 +151,7 @@ public final class REngine implements RContext.Engine { public RExpression parse(String rscript) throws RContext.Engine.ParseException { try { Sequence seq = (Sequence) ParseUtil.parseAST(new ANTLRStringStream(rscript), Source.asPseudoFile(rscript, "<parse_input>")); - ASTNode[] exprs = seq.getExprs(); + ASTNode[] exprs = seq.getExpressions(); Object[] data = new Object[exprs.length]; for (int i = 0; i < exprs.length; i++) { data[i] = RDataFactory.createLanguage(transform(exprs[i], REnvironment.emptyEnv())); @@ -302,9 +302,20 @@ public final class REngine implements RContext.Engine { } } - private static Object parseAndEvalImpl(ANTLRStringStream stream, Source source, VirtualFrame frame, boolean printResult) { + private static Object parseAndEvalImpl(ANTLRStringStream stream, Source source, VirtualFrame frame, boolean printResult, boolean allowIncompleteSource) { try { - return runCall(makeCallTarget(parseToRNode(stream, source)), frame, printResult, true); + RootCallTarget callTarget = makeCallTarget(parseToRNode(stream, source)); + Object result = runCall(callTarget, frame, printResult, true); + return result; + } catch (NoViableAltException | MismatchedTokenException e) { + if (e.token.getType() == Token.EOF && allowIncompleteSource) { + // the parser got stuck at the eof, request another line + return INCOMPLETE_SOURCE; + } + String line = source.getCode(e.line); + String message = "Error: unexpected '" + e.token.getText() + "' in \"" + line.substring(0, e.charPositionInLine + 1) + "\""; + context.getConsoleHandler().println(source.getLineCount() == 1 ? message : (message + " (line " + e.line + ")")); + return null; } catch (RecognitionException | RuntimeException e) { context.getConsoleHandler().println("Exception while parsing: " + e); e.printStackTrace(); @@ -393,7 +404,8 @@ public final class REngine implements RContext.Engine { Object result = null; try { try { - result = callTarget.call(frame); + // FIXME: callTargets should only be called via Direct/IndirectCallNode + result = callTarget.call(frame.materialize()); } catch (ControlFlowException cfe) { throw RError.error(frame, RError.Message.NO_LOOP_FOR_BREAK_NEXT); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackage.java index 7dda42518f13d30dada9e45cb51eaff9db8f234d..79c529862e275425d600146e7b3f92a4a6ad7062 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackage.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackage.java @@ -54,11 +54,11 @@ import com.oracle.truffle.r.runtime.*; */ public abstract class RBuiltinPackage { - public static class Component { - final String libContents; - final String libName; + private static class Component { + public final String libContents; + public final String libName; - Component(String libName, String libContents) { + public Component(String libName, String libContents) { this.libContents = libContents; this.libName = libName; } @@ -137,7 +137,7 @@ public abstract class RBuiltinPackage { ArrayList<Component> sources = rSources.get(getName()); if (sources != null) { for (Component src : sources) { - RContext.getEngine().parseAndEval(src.libContents, frame, envForFrame, false); + RContext.getEngine().parseAndEval(src.libContents, frame, envForFrame, false, false); } } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/APerm.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/APerm.java index 113b8094f37a71de31822ad2ebc8deaba74ccf72..da884f08fe292f34f90e2b4f906ec791da00f4c8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/APerm.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/APerm.java @@ -40,7 +40,7 @@ public abstract class APerm extends RBuiltinNode { } @Specialization - public RAbstractVector aPerm(VirtualFrame frame, RAbstractVector vector, RAbstractIntVector permVector, byte resize) { + protected RAbstractVector aPerm(VirtualFrame frame, RAbstractVector vector, RAbstractIntVector permVector, byte resize) { controlVisibility(); if (!vector.isArray()) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Abs.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Abs.java index dfc1571982119c8bca72517c414b14fbc9a5bb58..3cb2d513c373acce2c51a83d2eb44b68abbda713 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Abs.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Abs.java @@ -40,20 +40,20 @@ public abstract class Abs extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull abs(VirtualFrame frame, RNull x) { + protected RNull abs(VirtualFrame frame, RNull x) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_ARGUMENT_FUNCTION); } @Specialization - public int abs(int value) { + protected int abs(int value) { controlVisibility(); check.enable(value); return performInt(value); } @Specialization - public int abs(byte value) { + protected int abs(byte value) { controlVisibility(); check.enable(value); if (check.check(value)) { @@ -63,14 +63,14 @@ public abstract class Abs extends RBuiltinNode { } @Specialization - public double abs(double value) { + protected double abs(double value) { controlVisibility(); check.enable(value); return performDouble(value); } @Specialization - public double abs(RComplex value) { + protected double abs(RComplex value) { controlVisibility(); check.enable(value); return performComplex(value); @@ -78,27 +78,27 @@ public abstract class Abs extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object abs(VirtualFrame frame, RRaw vector) { + protected Object abs(VirtualFrame frame, RRaw vector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_MATH); } @SuppressWarnings("unused") @Specialization - public Object abs(VirtualFrame frame, String vector) { + protected Object abs(VirtualFrame frame, String vector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_MATH); } @Specialization - public RIntVector abs(RLogicalVector value) { + protected RIntVector abs(RLogicalVector value) { controlVisibility(); check.enable(value); return doAbs(RClosures.createLogicalToIntVector(value, check)); } @Specialization - public RIntVector abs(RIntVector vector) { + protected RIntVector abs(RIntVector vector) { controlVisibility(); return doAbs(vector); } @@ -115,7 +115,7 @@ public abstract class Abs extends RBuiltinNode { } @Specialization - public RDoubleVector abs(RDoubleVector vector) { + protected RDoubleVector abs(RDoubleVector vector) { controlVisibility(); check.enable(vector); double[] doubleVector = new double[vector.getLength()]; @@ -128,7 +128,7 @@ public abstract class Abs extends RBuiltinNode { } @Specialization - public RDoubleVector abs(RComplexVector vector) { + protected RDoubleVector abs(RComplexVector vector) { controlVisibility(); check.enable(vector); double[] doubleVector = new double[vector.getLength()]; @@ -142,14 +142,14 @@ public abstract class Abs extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object abs(VirtualFrame frame, RStringVector vector) { + protected Object abs(VirtualFrame frame, RStringVector vector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_MATH); } @SuppressWarnings("unused") @Specialization - public Object abs(VirtualFrame frame, RRawVector vector) { + protected Object abs(VirtualFrame frame, RRawVector vector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_MATH); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/All.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/All.java index 78bc6b275322ed5734fcf672d031c5b3bc7ef684..6d74b408da7e20b37c2bbc082b45f09d2f253b8e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/All.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/All.java @@ -58,53 +58,53 @@ public abstract class All extends RBuiltinNode { } @Specialization - public byte all(byte value) { + protected byte all(byte value) { controlVisibility(); return value; } @Specialization - public byte all(int value) { + protected byte all(int value) { controlVisibility(); check.enable(value); return check.convertIntToLogical(value); } @Specialization - public byte all(double value) { + protected byte all(double value) { controlVisibility(); check.enable(value); return check.convertDoubleToLogical(value); } @Specialization - public byte all(RComplex value) { + protected byte all(RComplex value) { controlVisibility(); check.enable(value); return check.convertComplexToLogical(value); } @Specialization - public byte all(VirtualFrame frame, String value) { + protected byte all(VirtualFrame frame, String value) { controlVisibility(); check.enable(value); return check.convertStringToLogical(value); } @Specialization - public byte all(RNull vector) { + protected byte all(RNull vector) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte all(RMissing vector) { + protected byte all(RMissing vector) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte all(RLogicalVector vector) { + protected byte all(RLogicalVector vector) { controlVisibility(); for (int i = 0; i < vector.getLength(); i++) { byte b = vector.getDataAt(i); @@ -116,49 +116,49 @@ public abstract class All extends RBuiltinNode { } @Specialization - public byte all(VirtualFrame frame, RIntVector vector) { + protected byte all(VirtualFrame frame, RIntVector vector) { controlVisibility(); return all(castLogicalVector(frame, vector)); } @Specialization - public byte all(VirtualFrame frame, RStringVector vector) { + protected byte all(VirtualFrame frame, RStringVector vector) { controlVisibility(); return all(castLogicalVector(frame, vector)); } @Specialization - public byte all(VirtualFrame frame, RDoubleVector vector) { + protected byte all(VirtualFrame frame, RDoubleVector vector) { controlVisibility(); return all(castLogicalVector(frame, vector)); } @Specialization - public byte all(VirtualFrame frame, RComplexVector vector) { + protected byte all(VirtualFrame frame, RComplexVector vector) { controlVisibility(); return all(castLogicalVector(frame, vector)); } @Specialization - public byte all(VirtualFrame frame, RDoubleSequence sequence) { + protected byte all(VirtualFrame frame, RDoubleSequence sequence) { controlVisibility(); return all(castLogicalVector(frame, sequence)); } @Specialization - public byte all(VirtualFrame frame, RIntSequence sequence) { + protected byte all(VirtualFrame frame, RIntSequence sequence) { controlVisibility(); return all(castLogicalVector(frame, sequence)); } @Specialization - public byte all(VirtualFrame frame, RRawVector vector) { + protected byte all(VirtualFrame frame, RRawVector vector) { controlVisibility(); return all(castLogicalVector(frame, vector)); } @Specialization - public byte all(VirtualFrame frame, Object[] args) { + protected byte all(VirtualFrame frame, Object[] args) { controlVisibility(); for (int i = 0; i < args.length; i++) { byte result; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Any.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Any.java index d94ffd591fda18eaf0b8d7968e1be6589cd9c7ed..5212dcbb0dd5d28d4220c0b88c751c8c57a15e85 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Any.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Any.java @@ -60,53 +60,53 @@ public abstract class Any extends RBuiltinNode { } @Specialization - public byte any(byte value) { + protected byte any(byte value) { controlVisibility(); return value; } @Specialization - public byte any(int value) { + protected byte any(int value) { controlVisibility(); check.enable(value); return check.convertIntToLogical(value); } @Specialization - public byte any(double value) { + protected byte any(double value) { controlVisibility(); check.enable(value); return check.convertDoubleToLogical(value); } @Specialization - public byte any(RComplex value) { + protected byte any(RComplex value) { controlVisibility(); check.enable(value); return check.convertComplexToLogical(value); } @Specialization - public byte any(VirtualFrame frame, String value) { + protected byte any(VirtualFrame frame, String value) { controlVisibility(); check.enable(value); return check.convertStringToLogical(value); } @Specialization - public byte any(RNull vector) { + protected byte any(RNull vector) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte any(RMissing vector) { + protected byte any(RMissing vector) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte any(RLogicalVector vector) { + protected byte any(RLogicalVector vector) { controlVisibility(); check.enable(vector); boolean seenNA = false; @@ -122,49 +122,49 @@ public abstract class Any extends RBuiltinNode { } @Specialization - public byte any(VirtualFrame frame, RIntVector vector) { + protected byte any(VirtualFrame frame, RIntVector vector) { controlVisibility(); return any(castLogicalVector(frame, vector)); } @Specialization - public byte any(VirtualFrame frame, RStringVector vector) { + protected byte any(VirtualFrame frame, RStringVector vector) { controlVisibility(); return any(castLogicalVector(frame, vector)); } @Specialization - public byte any(VirtualFrame frame, RDoubleVector vector) { + protected byte any(VirtualFrame frame, RDoubleVector vector) { controlVisibility(); return any(castLogicalVector(frame, vector)); } @Specialization - public byte any(VirtualFrame frame, RComplexVector vector) { + protected byte any(VirtualFrame frame, RComplexVector vector) { controlVisibility(); return any(castLogicalVector(frame, vector)); } @Specialization - public byte any(VirtualFrame frame, RDoubleSequence sequence) { + protected byte any(VirtualFrame frame, RDoubleSequence sequence) { controlVisibility(); return any(castLogicalVector(frame, sequence)); } @Specialization - public byte any(VirtualFrame frame, RIntSequence sequence) { + protected byte any(VirtualFrame frame, RIntSequence sequence) { controlVisibility(); return any(castLogicalVector(frame, sequence)); } @Specialization - public byte any(VirtualFrame frame, RRawVector vector) { + protected byte any(VirtualFrame frame, RRawVector vector) { controlVisibility(); return any(castLogicalVector(frame, vector)); } @Specialization - public byte any(VirtualFrame frame, Object[] args) { + protected byte any(VirtualFrame frame, Object[] args) { controlVisibility(); boolean seenNA = false; check.enable(true); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyDuplicated.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyDuplicated.java index 64d2f8137e32380180c58244e67d679925159193..8a730913319ab8a4ce8719eb23ce4a4d7628ef99 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyDuplicated.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyDuplicated.java @@ -46,19 +46,19 @@ public abstract class AnyDuplicated extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"!isIncomparable", "!isFromLast", "!empty"}) - public int anyDuplicatedFalseIncomparablesFromStart(RAbstractVector x, byte incomparables, byte fromLast) { + protected int anyDuplicatedFalseIncomparablesFromStart(RAbstractVector x, byte incomparables, byte fromLast) { return getIndexFromStart(x); } @SuppressWarnings("unused") @Specialization(guards = {"!isIncomparable", "isFromLast", "!empty"}) - public int anyDuplicatedFalseIncomparablesFromLast(RAbstractVector x, byte incomparables, byte fromLast) { + protected int anyDuplicatedFalseIncomparablesFromLast(RAbstractVector x, byte incomparables, byte fromLast) { return getIndexFromLast(x); } @SuppressWarnings("unused") @Specialization(guards = {"isIncomparable", "!isFromLast", "!empty"}) - public int anyDuplicatedTrueIncomparablesFromStart(VirtualFrame frame, RAbstractVector x, byte incomparables, byte fromLast) { + protected int anyDuplicatedTrueIncomparablesFromStart(VirtualFrame frame, RAbstractVector x, byte incomparables, byte fromLast) { initTypeof(); initCastTypeNode(); final String xType = typeof.execute(frame, x); @@ -67,7 +67,7 @@ public abstract class AnyDuplicated extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isIncomparable", "isFromLast", "!empty"}) - public int anyDuplicatedTrueIncomparablesFromLast(VirtualFrame frame, RAbstractVector x, byte incomparables, byte fromLast) { + protected int anyDuplicatedTrueIncomparablesFromLast(VirtualFrame frame, RAbstractVector x, byte incomparables, byte fromLast) { initTypeof(); initCastTypeNode(); String xType = typeof.execute(frame, x); @@ -75,7 +75,7 @@ public abstract class AnyDuplicated extends RBuiltinNode { } @Specialization(guards = {"!isFromLast", "!empty"}) - public int anyDuplicatedFromStart(VirtualFrame frame, RAbstractVector x, RAbstractVector incomparables, @SuppressWarnings("unused") byte fromLast) { + protected int anyDuplicatedFromStart(VirtualFrame frame, RAbstractVector x, RAbstractVector incomparables, @SuppressWarnings("unused") byte fromLast) { initTypeof(); initCastTypeNode(); String xType = typeof.execute(frame, x); @@ -83,7 +83,7 @@ public abstract class AnyDuplicated extends RBuiltinNode { } @Specialization(guards = {"isFromLast", "!empty"}) - public int anyDuplicatedFromLast(VirtualFrame frame, RAbstractVector x, RAbstractVector incomparables, @SuppressWarnings("unused") byte fromLast) { + protected int anyDuplicatedFromLast(VirtualFrame frame, RAbstractVector x, RAbstractVector incomparables, @SuppressWarnings("unused") byte fromLast) { initTypeof(); initCastTypeNode(); String xType = typeof.execute(frame, x); @@ -92,7 +92,7 @@ public abstract class AnyDuplicated extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "empty") - public int anyDuplicatedEmpty(VirtualFrame frame, RAbstractVector x, RAbstractVector incomparables, byte fromLast) { + protected int anyDuplicatedEmpty(VirtualFrame frame, RAbstractVector x, RAbstractVector incomparables, byte fromLast) { return 0; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyNA.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyNA.java index b5b18f574d97e68fae5292add819f5f5f3c8adae..81f9616cf408eca15ac7a1883fdeb279f7706e4e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyNA.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AnyNA.java @@ -43,7 +43,7 @@ public abstract class AnyNA extends RBuiltinNode { @Specialization // TODO recursive == TRUE - public Object anyNA(VirtualFrame frame, Object x, byte recursive) { + protected Object anyNA(VirtualFrame frame, Object x, byte recursive) { if (RRuntime.fromLogical(recursive)) { throw RError.nyi(getEncapsulatingSourceSection(), "recursive = TRUE not implemented"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Apply.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Apply.java index 680cacac8d5b745555937382e174deff4c727fd3..31991a7f7f8e0fbcb56def41b16bc2e0a34b7161 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Apply.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Apply.java @@ -48,7 +48,7 @@ public abstract class Apply extends RBuiltinNode { @Specialization(guards = "rowMargin") @SuppressWarnings("unused") - public Object applyRows(VirtualFrame frame, RDoubleVector x, double margin, RFunction fun, Object args) { + protected Object applyRows(VirtualFrame frame, RDoubleVector x, double margin, RFunction fun, Object args) { controlVisibility(); int[] xdim = x.getDimensions(); final int rows = xdim == null ? x.getLength() : xdim[0]; @@ -67,7 +67,7 @@ public abstract class Apply extends RBuiltinNode { @Specialization(guards = "colMargin") @SuppressWarnings("unused") - public Object applyCols(VirtualFrame frame, RDoubleVector x, double margin, RFunction fun, Object args) { + protected Object applyCols(VirtualFrame frame, RDoubleVector x, double margin, RFunction fun, Object args) { controlVisibility(); int[] xdim = x.getDimensions(); final int rows = xdim == null ? x.getLength() : xdim[0]; @@ -86,7 +86,7 @@ public abstract class Apply extends RBuiltinNode { @Specialization(guards = "rowMarginInt") @SuppressWarnings("unused") - public Object applyRows(VirtualFrame frame, RLogicalVector x, int margin, RFunction fun, Object args) { + protected Object applyRows(VirtualFrame frame, RLogicalVector x, int margin, RFunction fun, Object args) { controlVisibility(); int[] xdim = x.getDimensions(); final int rows = xdim == null ? x.getLength() : xdim[0]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Array.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Array.java index 26a33c90423208138e54173612de5f7099692513..6fa3e49e63fb3578e68db4fb0f0cd29243e3646f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Array.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Array.java @@ -89,13 +89,13 @@ public abstract class Array extends RBuiltinNode { } @Specialization - public RIntVector doArrayNoDimNames(VirtualFrame frame, RAbstractIntVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { + protected RIntVector doArrayNoDimNames(VirtualFrame frame, RAbstractIntVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { controlVisibility(); return doArrayInt(frame, vec, dim); } @Specialization - public RIntVector doArray(VirtualFrame frame, RAbstractIntVector vec, RAbstractIntVector dim, RList dimnames) { + protected RIntVector doArray(VirtualFrame frame, RAbstractIntVector vec, RAbstractIntVector dim, RList dimnames) { controlVisibility(); RIntVector ret = doArrayInt(frame, vec, dim); ret.setDimNames(frame, dimnames, getEncapsulatingSourceSection()); @@ -113,13 +113,13 @@ public abstract class Array extends RBuiltinNode { } @Specialization - public RDoubleVector doArrayNoDimNames(VirtualFrame frame, RAbstractDoubleVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { + protected RDoubleVector doArrayNoDimNames(VirtualFrame frame, RAbstractDoubleVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { controlVisibility(); return doArrayDouble(frame, vec, dim); } @Specialization - public RDoubleVector doArray(VirtualFrame frame, RAbstractDoubleVector vec, RAbstractIntVector dim, RList dimnames) { + protected RDoubleVector doArray(VirtualFrame frame, RAbstractDoubleVector vec, RAbstractIntVector dim, RList dimnames) { controlVisibility(); RDoubleVector ret = doArrayDouble(frame, vec, dim); ret.setDimNames(frame, dimnames, getEncapsulatingSourceSection()); @@ -137,13 +137,13 @@ public abstract class Array extends RBuiltinNode { } @Specialization - public RLogicalVector doArrayNoDimNames(VirtualFrame frame, RAbstractLogicalVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { + protected RLogicalVector doArrayNoDimNames(VirtualFrame frame, RAbstractLogicalVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { controlVisibility(); return doArrayLogical(frame, vec, dim); } @Specialization - public RLogicalVector doArray(VirtualFrame frame, RAbstractLogicalVector vec, RAbstractIntVector dim, RList dimnames) { + protected RLogicalVector doArray(VirtualFrame frame, RAbstractLogicalVector vec, RAbstractIntVector dim, RList dimnames) { controlVisibility(); RLogicalVector ret = doArrayLogical(frame, vec, dim); ret.setDimNames(frame, dimnames, getEncapsulatingSourceSection()); @@ -161,13 +161,13 @@ public abstract class Array extends RBuiltinNode { } @Specialization - public RStringVector doArrayNoDimNames(VirtualFrame frame, RAbstractStringVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { + protected RStringVector doArrayNoDimNames(VirtualFrame frame, RAbstractStringVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { controlVisibility(); return doArrayString(frame, vec, dim); } @Specialization - public RStringVector doArray(VirtualFrame frame, RAbstractStringVector vec, RAbstractIntVector dim, RList dimnames) { + protected RStringVector doArray(VirtualFrame frame, RAbstractStringVector vec, RAbstractIntVector dim, RList dimnames) { controlVisibility(); RStringVector ret = doArrayString(frame, vec, dim); ret.setDimNames(frame, dimnames, getEncapsulatingSourceSection()); @@ -188,13 +188,13 @@ public abstract class Array extends RBuiltinNode { } @Specialization - public RComplexVector doArrayNoDimNames(VirtualFrame frame, RAbstractComplexVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { + protected RComplexVector doArrayNoDimNames(VirtualFrame frame, RAbstractComplexVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { controlVisibility(); return doArrayComplex(frame, vec, dim); } @Specialization - public RComplexVector doArray(VirtualFrame frame, RAbstractComplexVector vec, RAbstractIntVector dim, RList dimnames) { + protected RComplexVector doArray(VirtualFrame frame, RAbstractComplexVector vec, RAbstractIntVector dim, RList dimnames) { controlVisibility(); RComplexVector ret = doArrayComplex(frame, vec, dim); ret.setDimNames(frame, dimnames, getEncapsulatingSourceSection()); @@ -212,13 +212,13 @@ public abstract class Array extends RBuiltinNode { } @Specialization - public RRawVector doArrayNoDimNames(VirtualFrame frame, RAbstractRawVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { + protected RRawVector doArrayNoDimNames(VirtualFrame frame, RAbstractRawVector vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { controlVisibility(); return doArrayRaw(frame, vec, dim); } @Specialization - public RRawVector doArray(VirtualFrame frame, RAbstractRawVector vec, RAbstractIntVector dim, RList dimnames) { + protected RRawVector doArray(VirtualFrame frame, RAbstractRawVector vec, RAbstractIntVector dim, RList dimnames) { controlVisibility(); RRawVector ret = doArrayRaw(frame, vec, dim); ret.setDimNames(frame, dimnames, getEncapsulatingSourceSection()); @@ -236,13 +236,13 @@ public abstract class Array extends RBuiltinNode { } @Specialization - public RList doArrayNoDimeNames(VirtualFrame frame, RList vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { + protected RList doArrayNoDimeNames(VirtualFrame frame, RList vec, RAbstractIntVector dim, @SuppressWarnings("unused") RNull dimnames) { controlVisibility(); return doArrayList(frame, vec, dim); } @Specialization - public RList doArray(VirtualFrame frame, RList vec, RAbstractIntVector dim, RList dimnames) { + protected RList doArray(VirtualFrame frame, RList vec, RAbstractIntVector dim, RList dimnames) { controlVisibility(); RList ret = doArrayList(frame, vec, dim); ret.setDimNames(frame, dimnames, getEncapsulatingSourceSection()); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsCharacter.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsCharacter.java index a367191ae1ac83dd23422b30dd2aaa727087b51d..82e375960140e1893ef02c2023fbe686c6a8d502 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsCharacter.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsCharacter.java @@ -74,61 +74,61 @@ public abstract class AsCharacter extends RBuiltinNode { } @Specialization - public String doInt(VirtualFrame frame, int value) { + protected String doInt(VirtualFrame frame, int value) { controlVisibility(); return castString(frame, value); } @Specialization - public String doDouble(VirtualFrame frame, double value) { + protected String doDouble(VirtualFrame frame, double value) { controlVisibility(); return castString(frame, value); } @Specialization - public String doLogical(VirtualFrame frame, byte value) { + protected String doLogical(VirtualFrame frame, byte value) { controlVisibility(); return castString(frame, value); } @Specialization - public String doString(VirtualFrame frame, String value) { + protected String doString(VirtualFrame frame, String value) { controlVisibility(); return value; } @Specialization - public String doSymbol(VirtualFrame frame, RSymbol value) { + protected String doSymbol(VirtualFrame frame, RSymbol value) { controlVisibility(); return value.getName(); } @Specialization - public RStringVector doNull(RNull value) { + protected RStringVector doNull(RNull value) { controlVisibility(); return RDataFactory.createStringVector(0); } @Specialization(guards = "!isObject") - public RStringVector doStringVector(VirtualFrame frame, RStringVector vector) { + protected RStringVector doStringVector(VirtualFrame frame, RStringVector vector) { controlVisibility(); return RDataFactory.createStringVector(vector.getDataCopy(), vector.isComplete()); } @Specialization - public RStringVector doList(VirtualFrame frame, RList list) { + protected RStringVector doList(VirtualFrame frame, RList list) { controlVisibility(); throw new UnsupportedOperationException("list type not supported for as.character - requires deparsing"); } @Specialization(guards = "!isObject") - public RStringVector doVector(VirtualFrame frame, RAbstractVector vector) { + protected RStringVector doVector(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); return castStringVector(frame, vector); } @Specialization(guards = "isObject") - public Object doObject(VirtualFrame frame, RAbstractVector vector) { + protected Object doObject(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); if (dcn == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsComplex.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsComplex.java index 869758d3458883f96b65ccfb67305e481ebf68ed..c8e57c5486a0e0652fb38f7e82ba45e165aabe14 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsComplex.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsComplex.java @@ -75,49 +75,49 @@ public abstract class AsComplex extends RBuiltinNode { } @Specialization - public RComplex doComplex(RComplex value) { + protected RComplex doComplex(RComplex value) { controlVisibility(); return value; } @Specialization - public RComplex doInt(VirtualFrame frame, int value) { + protected RComplex doInt(VirtualFrame frame, int value) { controlVisibility(); return castComplex(frame, value); } @Specialization - public RComplex doDouble(VirtualFrame frame, double value) { + protected RComplex doDouble(VirtualFrame frame, double value) { controlVisibility(); return castComplex(frame, value); } @Specialization - public RComplex doLogical(VirtualFrame frame, byte value) { + protected RComplex doLogical(VirtualFrame frame, byte value) { controlVisibility(); return castComplex(frame, value); } @Specialization - public RComplex doString(VirtualFrame frame, String value) { + protected RComplex doString(VirtualFrame frame, String value) { controlVisibility(); return castComplex(frame, value); } @Specialization - public RComplexVector doNull(RNull value) { + protected RComplexVector doNull(RNull value) { controlVisibility(); return RDataFactory.createComplexVector(0); } @Specialization - public RComplexVector doComplexVector(VirtualFrame frame, RComplexVector vector) { + protected RComplexVector doComplexVector(VirtualFrame frame, RComplexVector vector) { controlVisibility(); return RDataFactory.createComplexVector(vector.getDataCopy(), vector.isComplete()); } @Specialization - public RComplexVector doIntVector(VirtualFrame frame, RAbstractVector vector) { + protected RComplexVector doIntVector(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); return castComplexVector(frame, vector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsDouble.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsDouble.java index cd8e7c875c2f24b42fdeb5891eebd09d610140cd..c40c84b3b4ddea9c2cff4103376053659f693f32 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsDouble.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsDouble.java @@ -73,55 +73,55 @@ public abstract class AsDouble extends RBuiltinNode { } @Specialization - public double asDouble(double value) { + protected double asDouble(double value) { controlVisibility(); return value; } @Specialization - public double asDoubleInt(VirtualFrame frame, int value) { + protected double asDoubleInt(VirtualFrame frame, int value) { controlVisibility(); return castDouble(frame, value); } @Specialization - public double asDouble(VirtualFrame frame, byte value) { + protected double asDouble(VirtualFrame frame, byte value) { controlVisibility(); return castDouble(frame, value); } @Specialization - public double asDouble(VirtualFrame frame, RComplex value) { + protected double asDouble(VirtualFrame frame, RComplex value) { controlVisibility(); return castDouble(frame, value); } @Specialization - public double asDouble(VirtualFrame frame, String value) { + protected double asDouble(VirtualFrame frame, String value) { controlVisibility(); return castDouble(frame, value); } @Specialization - public RDoubleVector asDouble(RNull vector) { + protected RDoubleVector asDouble(RNull vector) { controlVisibility(); return RDataFactory.createDoubleVector(0); } @Specialization - public RDoubleVector asDouble(RDoubleVector vector) { + protected RDoubleVector asDouble(RDoubleVector vector) { controlVisibility(); return RDataFactory.createDoubleVector(vector.getDataCopy(), vector.isComplete()); } @Specialization - public RDoubleVector asDouble(RDoubleSequence sequence) { + protected RDoubleVector asDouble(RDoubleSequence sequence) { controlVisibility(); return (RDoubleVector) sequence.createVector(); } @Specialization - public RDoubleVector asDouble(VirtualFrame frame, RIntSequence sequence) { + protected RDoubleVector asDouble(VirtualFrame frame, RIntSequence sequence) { controlVisibility(); double current = sequence.getStart(); double[] result = new double[sequence.getLength()]; @@ -133,7 +133,7 @@ public abstract class AsDouble extends RBuiltinNode { } @Specialization - public RDoubleVector asDouble(VirtualFrame frame, RAbstractVector vector) { + protected RDoubleVector asDouble(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); return castDoubleVector(frame, vector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsInteger.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsInteger.java index 68b4a347f89f8baba7c2a1757271f06eadb2fb2a..8b6a0026de759d6a71f669761e986ee0756c2a4e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsInteger.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsInteger.java @@ -72,61 +72,61 @@ public abstract class AsInteger extends RBuiltinNode { } @Specialization - public int asInteger(int value) { + protected int asInteger(int value) { controlVisibility(); return value; } @Specialization - public int asInteger(VirtualFrame frame, double value) { + protected int asInteger(VirtualFrame frame, double value) { controlVisibility(); return castInt(frame, value); } @Specialization - public int asInteger(VirtualFrame frame, byte value) { + protected int asInteger(VirtualFrame frame, byte value) { controlVisibility(); return castInt(frame, value); } @Specialization - public int asInteger(VirtualFrame frame, RComplex value) { + protected int asInteger(VirtualFrame frame, RComplex value) { controlVisibility(); return castInt(frame, value); } @Specialization - public int asInteger(VirtualFrame frame, RRaw value) { + protected int asInteger(VirtualFrame frame, RRaw value) { controlVisibility(); return castInt(frame, value); } @Specialization - public int asInteger(VirtualFrame frame, String value) { + protected int asInteger(VirtualFrame frame, String value) { controlVisibility(); return castInt(frame, value); } @Specialization - public int asInteger(RNull vector) { + protected int asInteger(RNull vector) { controlVisibility(); return RRuntime.INT_NA; } @Specialization - public RIntVector asInteger(RIntVector vector) { + protected RIntVector asInteger(RIntVector vector) { controlVisibility(); return RDataFactory.createIntVector(vector.getDataCopy(), vector.isComplete()); } @Specialization - public RIntVector asInteger(RIntSequence sequence) { + protected RIntVector asInteger(RIntSequence sequence) { controlVisibility(); return (RIntVector) sequence.createVector(); } @Specialization - public RAbstractIntVector asInteger(VirtualFrame frame, RAbstractVector vector) { + protected RAbstractIntVector asInteger(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); return castIntVector(frame, vector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsLogical.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsLogical.java index 292cfd255bb47e0285958bca8bffbcb1bf326526..66d1b2a571efd4508fae79f1510841dad8ed3111 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsLogical.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsLogical.java @@ -59,49 +59,49 @@ public abstract class AsLogical extends RBuiltinNode { } @Specialization - public byte asLogical(byte value) { + protected byte asLogical(byte value) { controlVisibility(); return value; } @Specialization - public byte asLogical(VirtualFrame frame, int value) { + protected byte asLogical(VirtualFrame frame, int value) { controlVisibility(); return castLogical(frame, value); } @Specialization - public byte asLogical(VirtualFrame frame, double value) { + protected byte asLogical(VirtualFrame frame, double value) { controlVisibility(); return castLogical(frame, value); } @Specialization - public byte asLogical(VirtualFrame frame, RComplex value) { + protected byte asLogical(VirtualFrame frame, RComplex value) { controlVisibility(); return castLogical(frame, value); } @Specialization - public byte asLogical(VirtualFrame frame, String value) { + protected byte asLogical(VirtualFrame frame, String value) { controlVisibility(); return castLogical(frame, value); } @Specialization - public RLogicalVector asLogical(RNull vector) { + protected RLogicalVector asLogical(RNull vector) { controlVisibility(); return RDataFactory.createLogicalVector(0); } @Specialization - public RLogicalVector asLogical(RLogicalVector vector) { + protected RLogicalVector asLogical(RLogicalVector vector) { controlVisibility(); return RDataFactory.createLogicalVector(vector.getDataCopy(), vector.isComplete()); } @Specialization - public RLogicalVector asLogical(VirtualFrame frame, RAbstractVector vector) { + protected RLogicalVector asLogical(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); return castLogicalVector(frame, vector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsRaw.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsRaw.java index 73ce5a26ff5e2127b46c10fac7d2b45e644e52cf..920948839a9b46e0b2a95fa5e268cafb1287c01b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsRaw.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsRaw.java @@ -76,61 +76,61 @@ public abstract class AsRaw extends RBuiltinNode { public abstract RRaw executeRaw(VirtualFrame frame, Object o); @Specialization - public RRawVector asRaw(RNull vector) { + protected RRawVector asRaw(RNull vector) { controlVisibility(); return RDataFactory.createRawVector(0); } @Specialization - public RRaw asRaw(VirtualFrame frame, byte logical) { + protected RRaw asRaw(VirtualFrame frame, byte logical) { controlVisibility(); return castRaw(frame, logical); } @Specialization - public RRaw asRaw(VirtualFrame frame, int value) { + protected RRaw asRaw(VirtualFrame frame, int value) { controlVisibility(); return castRaw(frame, value); } @Specialization - public RRaw asRaw(VirtualFrame frame, double value) { + protected RRaw asRaw(VirtualFrame frame, double value) { controlVisibility(); return castRaw(frame, value); } @Specialization - public RRaw asRaw(VirtualFrame frame, RComplex value) { + protected RRaw asRaw(VirtualFrame frame, RComplex value) { controlVisibility(); return castRaw(frame, value); } @Specialization - public RRaw asRaw(VirtualFrame frame, String value) { + protected RRaw asRaw(VirtualFrame frame, String value) { controlVisibility(); return castRaw(frame, value); } @Specialization - public RRaw asRaw(RRaw value) { + protected RRaw asRaw(RRaw value) { controlVisibility(); return value; } @Specialization(guards = {"!isListVector", "!isRawVector"}) - public RRawVector asRaw(VirtualFrame frame, RAbstractVector vector) { + protected RRawVector asRaw(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); return castRawVector(frame, vector); } @Specialization - public RRawVector asRaw(RRawVector value) { + protected RRawVector asRaw(RRawVector value) { controlVisibility(); return RDataFactory.createRawVector(value.getDataCopy()); } @Specialization - public RRawVector asRaw(VirtualFrame frame, RList value) { + protected RRawVector asRaw(VirtualFrame frame, RList value) { controlVisibility(); int length = value.getLength(); RRawVector result = RDataFactory.createRawVector(length); 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 90c0322a0a6c99e5da2c4f92872ea5ab7b86999f..dce06b0103379adeefa7e3e1306f8d597e801359 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 @@ -118,61 +118,61 @@ public abstract class AsVector extends RBuiltinNode { } @Specialization - public Object asVector(RNull x, @SuppressWarnings("unused") RMissing mode) { + protected Object asVector(RNull x, @SuppressWarnings("unused") RMissing mode) { controlVisibility(); return x; } @Specialization(guards = "castToInt") - public RAbstractVector asVectorInt(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVectorInt(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castInteger(frame, x); } @Specialization(guards = "castToDouble") - public RAbstractVector asVectorDouble(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVectorDouble(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castDouble(frame, x); } @Specialization(guards = "castToComplex") - public RAbstractVector asVectorComplex(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVectorComplex(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castComplex(frame, x); } @Specialization(guards = "castToLogical") - public RAbstractVector asVectorLogical(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVectorLogical(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castLogical(frame, x); } @Specialization(guards = "castToString") - public RAbstractVector asVectorString(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVectorString(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castString(frame, x); } @Specialization(guards = "castToRaw") - public RAbstractVector asVectorRaw(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVectorRaw(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castRaw(frame, x); } @Specialization(guards = "castToList") - public RAbstractVector asVectorList(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVectorList(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castList(frame, x); } @Specialization(guards = "castToSymbol") - public RSymbol asVectorSymbol(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RSymbol asVectorSymbol(VirtualFrame frame, RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return castSymbol(frame, x); } @Specialization(guards = "isSymbol") - public RSymbol asVectorSymbol(RSymbol x, @SuppressWarnings("unused") String mode) { + protected RSymbol asVectorSymbol(RSymbol x, @SuppressWarnings("unused") String mode) { controlVisibility(); return RDataFactory.createSymbol(x.getName()); } @@ -182,7 +182,7 @@ public abstract class AsVector extends RBuiltinNode { } @Specialization - public RAbstractVector asVector(RList x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVector(RList x, @SuppressWarnings("unused") String mode) { controlVisibility(); RList result = x.copyWithNewDimensions(null); result.copyNamesFrom(x); @@ -190,14 +190,14 @@ public abstract class AsVector extends RBuiltinNode { } @Specialization(guards = "modeIsAnyOrMatches") - public RAbstractVector asVector(RAbstractVector x, @SuppressWarnings("unused") String mode) { + protected RAbstractVector asVector(RAbstractVector x, @SuppressWarnings("unused") String mode) { controlVisibility(); return x.copyWithNewDimensions(null); } @SuppressWarnings("unused") @Specialization(guards = "invalidMode") - public RAbstractVector asVectorWrongMode(VirtualFrame frame, RAbstractVector x, String mode) { + protected RAbstractVector asVectorWrongMode(VirtualFrame frame, RAbstractVector x, String mode) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "mode"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java index d7b6ffa2b6a8c1a82e98efe78ef14b36aa273e98..f3cb4b78c8d289a6525da5cd7f918cd5a9b18da9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java @@ -69,7 +69,7 @@ public abstract class Assign extends RInvisibleBuiltinNode { @Specialization(guards = {"noEnv", "!doesInheritS"}) @SuppressWarnings("unused") - public Object assignNoInherit(VirtualFrame frame, String x, Object value, Object pos, RMissing envir, byte inherits, byte immediate) { + protected Object assignNoInherit(VirtualFrame frame, String x, Object value, Object pos, RMissing envir, byte inherits, byte immediate) { controlVisibility(); ensureWrite(x); writeVariableNode.execute(frame, value); @@ -79,7 +79,7 @@ public abstract class Assign extends RInvisibleBuiltinNode { @ExplodeLoop @Specialization(guards = {"noEnv", "doesInheritS"}) @SuppressWarnings("unused") - public Object assignInherit(VirtualFrame virtualFrame, String variableName, Object variableValue, Object pos, RMissing environment, byte inherits, byte immediate) { + protected Object assignInherit(VirtualFrame virtualFrame, String variableName, Object variableValue, Object pos, RMissing environment, byte inherits, byte immediate) { controlVisibility(); MaterializedFrame materializedFrame = virtualFrame.materialize(); FrameSlot slot = materializedFrame.getFrameDescriptor().findFrameSlot(variableName); @@ -122,7 +122,7 @@ public abstract class Assign extends RInvisibleBuiltinNode { @Specialization(guards = "!doesInherit") @SuppressWarnings("unused") - public Object assignNoInherit(VirtualFrame frame, String x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { + protected Object assignNoInherit(VirtualFrame frame, String x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { controlVisibility(); if (pos == REnvironment.emptyEnv()) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.CANNOT_ASSIGN_IN_EMPTY_ENV); @@ -137,13 +137,13 @@ public abstract class Assign extends RInvisibleBuiltinNode { @Specialization(guards = "!doesInheritX") @SuppressWarnings("unused") - public Object assignNoInherit(VirtualFrame frame, String x, Object value, int pos, REnvironment envir, byte inherits, byte immediate) { + protected Object assignNoInherit(VirtualFrame frame, String x, Object value, int pos, REnvironment envir, byte inherits, byte immediate) { return assignNoInherit(frame, x, value, envir, RMissing.instance, inherits, immediate); } @Specialization(guards = "doesInherit") @SuppressWarnings("unused") - public Object assignInherit(VirtualFrame frame, String x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { + protected Object assignInherit(VirtualFrame frame, String x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { controlVisibility(); REnvironment env = pos; while (env != null) { @@ -165,19 +165,19 @@ public abstract class Assign extends RInvisibleBuiltinNode { } @Specialization(guards = "!doesInherit") - public Object assignNoInherit(VirtualFrame frame, RStringVector x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { + protected Object assignNoInherit(VirtualFrame frame, RStringVector x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { controlVisibility(); return assignNoInherit(frame, x.getDataAt(0), value, pos, envir, inherits, immediate); } @Specialization(guards = "doesInherit") - public Object assignInherit(VirtualFrame frame, RStringVector x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { + protected Object assignInherit(VirtualFrame frame, RStringVector x, Object value, REnvironment pos, RMissing envir, byte inherits, byte immediate) { controlVisibility(); return assignInherit(frame, x.getDataAt(0), value, pos, envir, inherits, immediate); } @Specialization(guards = "doesInheritX") - public Object assignInherit(VirtualFrame frame, RStringVector x, Object value, @SuppressWarnings("unused") int pos, REnvironment envir, byte inherits, byte immediate) { + protected Object assignInherit(VirtualFrame frame, RStringVector x, Object value, @SuppressWarnings("unused") int pos, REnvironment envir, byte inherits, byte immediate) { controlVisibility(); return assignInherit(frame, x.getDataAt(0), value, envir, RMissing.instance, inherits, immediate); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AttachFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AttachFunctions.java index 88c79bb27894b465c84d59a8765b3e53c304ceb2..ef67fd2a10ccd0d050214d0131ec1b90757f7778 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AttachFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AttachFunctions.java @@ -50,7 +50,7 @@ public class AttachFunctions { } @Specialization - public REnvironment doAttach(@SuppressWarnings("unused") RNull what, int pos, String name) { + protected REnvironment doAttach(@SuppressWarnings("unused") RNull what, int pos, String name) { controlVisibility(); REnvironment env = new REnvironment.NewEnv(name); doAttachEnv(pos, env); @@ -58,24 +58,24 @@ public class AttachFunctions { } @Specialization - public REnvironment doAttach(RNull what, double pos, RAbstractStringVector name) { + protected REnvironment doAttach(RNull what, double pos, RAbstractStringVector name) { return doAttach(what, (int) pos, name.getDataAt(0)); } @Specialization - public REnvironment doAttach(REnvironment what, String name, @SuppressWarnings("unused") String unused) { + protected REnvironment doAttach(REnvironment what, String name, @SuppressWarnings("unused") String unused) { controlVisibility(); return doAttachEnv(what, 2, name); } @Specialization - public REnvironment doAttach(REnvironment what, int pos, String name) { + protected REnvironment doAttach(REnvironment what, int pos, String name) { controlVisibility(); return doAttachEnv(what, pos, name); } @Specialization - public REnvironment doAttach(REnvironment what, double pos, String name) { + protected REnvironment doAttach(REnvironment what, double pos, String name) { controlVisibility(); return doAttachEnv(what, (int) pos, name); } @@ -95,19 +95,19 @@ public class AttachFunctions { } @Specialization - public REnvironment doAttach(RList what, String name, @SuppressWarnings("unused") String unused) { + protected REnvironment doAttach(RList what, String name, @SuppressWarnings("unused") String unused) { controlVisibility(); return doAttachList(what, 2, name); } @Specialization - public REnvironment doAttach(RList what, int pos, String name) { + protected REnvironment doAttach(RList what, int pos, String name) { controlVisibility(); return doAttachList(what, pos, name); } @Specialization - public REnvironment doAttach(RList what, double pos, String name) { + protected REnvironment doAttach(RList what, double pos, String name) { controlVisibility(); return doAttachList(what, (int) pos, name); } @@ -148,19 +148,19 @@ public class AttachFunctions { @SuppressWarnings("unused") @Specialization - public Object doDetach1(VirtualFrame frame, int name, int pos, byte unload, byte characterOnly, byte force) { + protected Object doDetach1(VirtualFrame frame, int name, int pos, byte unload, byte characterOnly, byte force) { controlVisibility(); return doDetach3(frame, name, unload == RRuntime.LOGICAL_TRUE, force == RRuntime.LOGICAL_TRUE); } @Specialization - public Object doDetach(VirtualFrame frame, double name, int pos, byte unload, byte characterOnly, byte force) { + protected Object doDetach(VirtualFrame frame, double name, int pos, byte unload, byte characterOnly, byte force) { return doDetach1(frame, (int) name, pos, unload, characterOnly, force); } @SuppressWarnings("unused") @Specialization - public Object doDetach2(VirtualFrame frame, String name, int pos, byte unload, byte characterOnly, byte force) { + protected Object doDetach2(VirtualFrame frame, String name, int pos, byte unload, byte characterOnly, byte force) { controlVisibility(); int ix = REnvironment.lookupIndexOnSearchPath(name); if (ix <= 0) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attr.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attr.java index 7ffc55d2432aa1c73d7611c7c817f9126813a4e5..eb5895b7b017baeac95b3fd68551f11ce58ba09e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attr.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attr.java @@ -51,7 +51,7 @@ public abstract class Attr extends RBuiltinNode { } @Specialization(guards = "!isRowNamesAttr") - public Object attr(RAbstractContainer container, String name) { + protected Object attr(RAbstractContainer container, String name) { controlVisibility(); RAttributes attributes = container.getAttributes(); if (attributes == null) { @@ -76,7 +76,7 @@ public abstract class Attr extends RBuiltinNode { } @Specialization(guards = "isRowNamesAttr") - public Object attrRowNames(RAbstractContainer container, @SuppressWarnings("unused") String name) { + protected Object attrRowNames(RAbstractContainer container, @SuppressWarnings("unused") String name) { controlVisibility(); RAttributes attributes = container.getAttributes(); if (attributes == null) { @@ -87,18 +87,18 @@ public abstract class Attr extends RBuiltinNode { } @Specialization(guards = {"!emptyName", "isRowNamesAttr"}) - public Object attrRowNames(RAbstractContainer container, RStringVector name) { + protected Object attrRowNames(RAbstractContainer container, RStringVector name) { return attrRowNames(container, name.getDataAt(0)); } @Specialization(guards = {"!emptyName", "!isRowNamesAttr"}) - public Object attr(RAbstractContainer container, RStringVector name) { + protected Object attr(RAbstractContainer container, RStringVector name) { return attr(container, name.getDataAt(0)); } @SuppressWarnings("unused") @Specialization(guards = "emptyName") - public Object attrEmtpyName(VirtualFrame frame, RAbstractContainer container, RStringVector name) { + protected Object attrEmtpyName(VirtualFrame frame, RAbstractContainer container, RStringVector name) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.EXACTLY_ONE_WHICH); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java index f177cf19c3dcb5ce450e8e88dcb587d09936321a..aaa49470a7ab2f49f7e17172c97bfe8cd24cb70a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java @@ -35,13 +35,13 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class Attributes extends RBuiltinNode { @Specialization(guards = "!hasAttributes") - public RNull attributesNull(@SuppressWarnings("unused") RAbstractVector vector) { + protected RNull attributesNull(@SuppressWarnings("unused") RAbstractVector vector) { controlVisibility(); return RNull.instance; } @Specialization(guards = "hasAttributes") - public RList attributes(RAbstractContainer container) { + protected RList attributes(RAbstractContainer container) { controlVisibility(); RAttributes attributes = container.getAttributes(); int size = attributes.size(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java index 0f6f9116dc337edd876205d504c7295b9c325443..50a01ac23ac0777477a95d7cfab8dd28c3e87a62 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java @@ -60,7 +60,7 @@ public class BrowserFunctions { @SuppressWarnings("unused") @Specialization - public RNull browser(VirtualFrame frame, String text, RNull condition, byte expr, int skipCalls) { + protected RNull browser(VirtualFrame frame, String text, RNull condition, byte expr, int skipCalls) { controlVisibility(); if (RRuntime.fromLogical(expr)) { try { @@ -115,7 +115,7 @@ public class BrowserFunctions { } default: - RContext.getEngine().parseAndEval(input, frame, callerEnv, true); + RContext.getEngine().parseAndEval(input, frame, callerEnv, true, false); break; } } @@ -160,13 +160,13 @@ public class BrowserFunctions { @RBuiltin(name = "browserText", kind = RBuiltinKind.INTERNAL, parameterNames = {"n"}) public abstract static class BrowserText extends RetrieveAdapter { @Specialization - public String browserText(VirtualFrame frame, int n) { + protected String browserText(VirtualFrame frame, int n) { controlVisibility(); return getHelperState(frame, n).text; } @Specialization - public String browserText(VirtualFrame frame, double n) { + protected String browserText(VirtualFrame frame, double n) { controlVisibility(); return getHelperState(frame, (int) n).text; } @@ -175,13 +175,13 @@ public class BrowserFunctions { @RBuiltin(name = "browserCondition", kind = RBuiltinKind.INTERNAL, parameterNames = {"n"}) public abstract static class BrowserCondition extends RetrieveAdapter { @Specialization - public Object browserCondition(VirtualFrame frame, int n) { + protected Object browserCondition(VirtualFrame frame, int n) { controlVisibility(); return getHelperState(frame, n).condition; } @Specialization - public Object browserCondition(VirtualFrame frame, double n) { + protected Object browserCondition(VirtualFrame frame, double n) { controlVisibility(); return getHelperState(frame, (int) n).condition; } @@ -190,7 +190,7 @@ public class BrowserFunctions { @RBuiltin(name = "browserSetDebug", kind = RBuiltinKind.INTERNAL, parameterNames = {"n"}) public abstract static class BrowserSetDebug extends RetrieveAdapter { @Specialization - public RNull browserSetDebug(@SuppressWarnings("unused") int n) { + protected RNull browserSetDebug(@SuppressWarnings("unused") int n) { // TODO implement controlVisibility(); return RNull.instance; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cat.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cat.java index 350e6739268d357235158ea8be58dd572968f4d8..25991ad6267603321272a216f0c4de9d51ecf625 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cat.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cat.java @@ -62,19 +62,19 @@ public abstract class Cat extends RInvisibleBuiltinNode { } @Specialization - public Object cat(RNull arg, String file, String sep, byte fill, Object labels, byte append) { + protected Object cat(RNull arg, String file, String sep, byte fill, Object labels, byte append) { controlVisibility(); return RNull.instance; } @Specialization - public Object cat(RMissing arg, String file, String sep, byte fill, Object labels, byte append) { + protected Object cat(RMissing arg, String file, String sep, byte fill, Object labels, byte append) { controlVisibility(); return RNull.instance; } @Specialization - public Object cat(VirtualFrame frame, RAbstractVector arg, String file, String sep, byte fill, Object labels, byte append) { + protected Object cat(VirtualFrame frame, RAbstractVector arg, String file, String sep, byte fill, Object labels, byte append) { ensureToString(sep); catIntl(toString.executeString(frame, arg)); controlVisibility(); @@ -82,7 +82,7 @@ public abstract class Cat extends RInvisibleBuiltinNode { } @Specialization - public Object cat(VirtualFrame frame, Object[] args, String file, String sep, byte fill, Object labels, byte append) { + protected Object cat(VirtualFrame frame, Object[] args, String file, String sep, byte fill, Object labels, byte append) { ensureToString(sep); for (int i = 0; i < args.length; ++i) { if (args[i] instanceof Object[]) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharacterBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharacterBuiltin.java index 4d5b772b469d4d687e784488c5597a31365bd744..779911f67b88c794f0b3cb3b7554b5583feec0e3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharacterBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CharacterBuiltin.java @@ -42,32 +42,32 @@ public abstract class CharacterBuiltin extends RBuiltinNode { } @Specialization - public Object createCharacterVector(int length) { + protected Object createCharacterVector(int length) { controlVisibility(); return RDataFactory.createStringVector(length); } @Specialization - public Object createCharacterVector(double length) { + protected Object createCharacterVector(double length) { controlVisibility(); return RDataFactory.createStringVector((int) length); } @Specialization - public Object createCharacterVector(RAbstractIntVector length) { + protected Object createCharacterVector(RAbstractIntVector length) { controlVisibility(); return createCharacterVector(length.getDataAt(0)); } @Specialization - public Object createCharacterVector(RAbstractDoubleVector length) { + protected Object createCharacterVector(RAbstractDoubleVector length) { controlVisibility(); return createCharacterVector(length.getDataAt(0)); } @SuppressWarnings("unused") @Specialization - public Object createCharacterVector(RMissing length) { + protected Object createCharacterVector(RMissing length) { controlVisibility(); return RDataFactory.createStringVector(0); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ClassHierarchyNode.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ClassHierarchyNode.java index 826083f68150472abc82a94d8cf28cb515ad5952..8ec58210ac6162b26aba60be6f4805a72d103db9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ClassHierarchyNode.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ClassHierarchyNode.java @@ -37,63 +37,62 @@ public abstract class ClassHierarchyNode extends UnaryNode { public abstract RStringVector execute(VirtualFrame frame, Object arg); @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") byte arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") byte arg) { return RDataFactory.createStringVector(RRuntime.TYPE_LOGICAL); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") String arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") String arg) { return RDataFactory.createStringVector(RRuntime.TYPE_CHARACTER); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") int arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") int arg) { return RDataFactory.createStringVector(RRuntime.TYPE_INTEGER); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") double arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") double arg) { return RDataFactory.createStringVector(RRuntime.CLASS_DOUBLE, RDataFactory.COMPLETE_VECTOR); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") RComplex arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") RComplex arg) { return RDataFactory.createStringVector(RRuntime.TYPE_COMPLEX); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") RFunction arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") RFunction arg) { return RDataFactory.createStringVector(RRuntime.TYPE_FUNCTION); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") RNull arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") RNull arg) { return RDataFactory.createStringVector(RRuntime.NULL); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") RSymbol arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") RSymbol arg) { return RDataFactory.createStringVector(RRuntime.CLASS_SYMBOL); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") REnvironment arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") REnvironment arg) { return RDataFactory.createStringVector(RRuntime.TYPE_ENVIRONMENT); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") RPairList arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") RPairList arg) { return RDataFactory.createStringVector(RRuntime.TYPE_PAIR_LIST); } @Specialization - public RStringVector getClassHr(@SuppressWarnings("unused") RLanguage arg) { + protected RStringVector getClassHr(@SuppressWarnings("unused") RLanguage arg) { return RDataFactory.createStringVector(RRuntime.CLASS_LANGUAGE); } - @Specialization() - public RStringVector getClassHr(RAbstractContainer arg) { + @Specialization + protected RStringVector getClassHr(RAbstractContainer arg) { return arg.getClassHierarchy(); } - } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColMeans.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColMeans.java index c9a8b2931730069488cd4a11f5df4c20915f7c0d..782e8686b52b582ac501f49e3f8631d2292790f6 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColMeans.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColMeans.java @@ -43,7 +43,7 @@ public abstract class ColMeans extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector colMeansNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colMeansNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; boolean isComplete = true; @@ -69,7 +69,7 @@ public abstract class ColMeans extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector colMeansNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colMeansNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; boolean isComplete = true; @@ -95,7 +95,7 @@ public abstract class ColMeans extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector colMeansNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colMeansNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; na.enable(x); @@ -115,7 +115,7 @@ public abstract class ColMeans extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector colMeansNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colMeansNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; boolean isComplete = true; @@ -141,7 +141,7 @@ public abstract class ColMeans extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector colMeansNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colMeansNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; na.enable(x); @@ -161,7 +161,7 @@ public abstract class ColMeans extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector colMeansNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colMeansNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; boolean isComplete = true; @@ -188,7 +188,7 @@ public abstract class ColMeans extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RDoubleVector colMeans(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { + protected RDoubleVector colMeans(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.X_NUMERIC); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColSums.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColSums.java index 141759cdeea83ee506229c4ddf96b68576c21c66..95af247857595db38023c850dfd58cd30dbabea8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColSums.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ColSums.java @@ -55,7 +55,7 @@ public abstract class ColSums extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector colSumsNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colSumsNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; boolean isComplete = true; @@ -81,7 +81,7 @@ public abstract class ColSums extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector colSumsNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colSumsNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; na.enable(x); @@ -99,7 +99,7 @@ public abstract class ColSums extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector colSumsNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colSumsNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; na.enable(x); @@ -119,7 +119,7 @@ public abstract class ColSums extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector colSumsNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colSumsNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; na.enable(x); @@ -137,7 +137,7 @@ public abstract class ColSums extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector colSumsNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colSumsNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; na.enable(x); @@ -157,7 +157,7 @@ public abstract class ColSums extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector colSumsNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector colSumsNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[colNum]; na.enable(x); @@ -176,7 +176,7 @@ public abstract class ColSums extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RDoubleVector colSums(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { + protected RDoubleVector colSums(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.X_NUMERIC); } 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 ec837065368d1260254a434503f458666808fc7c..cb7f5769968f1f4536626ac80c916e4546a9de3d 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 @@ -87,19 +87,19 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RNull pass(RMissing vector) { + protected RNull pass(RMissing vector) { controlVisibility(); return RNull.instance; } @Specialization - public RNull pass(RNull vector) { + protected RNull pass(RNull vector) { controlVisibility(); return RNull.instance; } @Specialization - public RIntVector pass(RIntVector vector) { + protected RIntVector pass(RIntVector vector) { controlVisibility(); RIntVector result = (RIntVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -107,7 +107,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RDoubleVector pass(RDoubleVector vector) { + protected RDoubleVector pass(RDoubleVector vector) { controlVisibility(); RDoubleVector result = (RDoubleVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -115,7 +115,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RComplexVector pass(RComplexVector vector) { + protected RComplexVector pass(RComplexVector vector) { controlVisibility(); RComplexVector result = (RComplexVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -123,7 +123,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RStringVector pass(RStringVector vector) { + protected RStringVector pass(RStringVector vector) { controlVisibility(); RStringVector result = (RStringVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -131,7 +131,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RRawVector pass(RRawVector vector) { + protected RRawVector pass(RRawVector vector) { controlVisibility(); RRawVector result = (RRawVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -139,7 +139,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RLogicalVector pass(RLogicalVector vector) { + protected RLogicalVector pass(RLogicalVector vector) { controlVisibility(); RLogicalVector result = (RLogicalVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -147,7 +147,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RIntVector pass(RIntSequence vector) { + protected RIntVector pass(RIntSequence vector) { controlVisibility(); RIntVector result = (RIntVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -155,7 +155,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RDoubleVector pass(RDoubleSequence vector) { + protected RDoubleVector pass(RDoubleSequence vector) { controlVisibility(); RDoubleVector result = (RDoubleVector) vector.copyDropAttributes(); result.copyNamesFrom(vector); @@ -163,7 +163,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization - public RList pass(RList list) { + protected RList pass(RList list) { controlVisibility(); RList result = (RList) list.copyDropAttributes(); result.copyNamesFrom(list); @@ -171,73 +171,73 @@ public abstract class Combine extends RBuiltinNode { } @Specialization(guards = "noArgNames") - public int pass(int value) { + protected int pass(int value) { controlVisibility(); return value; } @Specialization(guards = "hasArgNames") - public RIntVector passArgs(int value) { + protected RIntVector passArgs(int value) { controlVisibility(); return RDataFactory.createIntVector(new int[]{value}, true, RDataFactory.createStringVector(getSuppliedArgsNames(), true)); } @Specialization(guards = "noArgNames") - public double pass(double value) { + protected double pass(double value) { controlVisibility(); return value; } @Specialization(guards = "hasArgNames") - public RDoubleVector passArgs(double value) { + protected RDoubleVector passArgs(double value) { controlVisibility(); return RDataFactory.createDoubleVector(new double[]{value}, true, RDataFactory.createStringVector(getSuppliedArgsNames(), true)); } @Specialization(guards = "noArgNames") - public byte pass(byte value) { + protected byte pass(byte value) { controlVisibility(); return value; } @Specialization(guards = "hasArgNames") - public RLogicalVector passArgs(byte value) { + protected RLogicalVector passArgs(byte value) { controlVisibility(); return RDataFactory.createLogicalVector(new byte[]{value}, true, RDataFactory.createStringVector(getSuppliedArgsNames(), true)); } @Specialization(guards = "noArgNames") - public String pass(String value) { + protected String pass(String value) { controlVisibility(); return value; } @Specialization(guards = "hasArgNames") - public RStringVector passArgs(String value) { + protected RStringVector passArgs(String value) { controlVisibility(); return RDataFactory.createStringVector(new String[]{value}, true, RDataFactory.createStringVector(getSuppliedArgsNames(), true)); } @Specialization(guards = "noArgNames") - public RRaw pass(RRaw value) { + protected RRaw pass(RRaw value) { controlVisibility(); return value; } @Specialization(guards = "hasArgNames") - public RRawVector passArgs(RRaw value) { + protected RRawVector passArgs(RRaw value) { controlVisibility(); return RDataFactory.createRawVector(new byte[]{value.getValue()}, RDataFactory.createStringVector(getSuppliedArgsNames(), true)); } @Specialization(guards = "noArgNames") - public RComplex pass(RComplex value) { + protected RComplex pass(RComplex value) { controlVisibility(); return value; } @Specialization(guards = "hasArgNames") - public RComplexVector passArgs(RComplex value) { + protected RComplexVector passArgs(RComplex value) { controlVisibility(); return RDataFactory.createComplexVector(new double[]{value.getRealPart(), value.getImaginaryPart()}, true, RDataFactory.createStringVector(getSuppliedArgsNames(), true)); } @@ -396,14 +396,14 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = "isNullPrecedence") @ExplodeLoop - public RNull allNull(VirtualFrame frame, Object[] array) { + protected RNull allNull(VirtualFrame frame, Object[] array) { controlVisibility(); return RNull.instance; } @Specialization(guards = {"isLogicalPrecedence", "noArgNames"}) @ExplodeLoop - public Object allLogical(VirtualFrame frame, Object[] array) { + protected Object allLogical(VirtualFrame frame, Object[] array) { controlVisibility(); Object current = castLogical(frame, array[0]); for (int i = 1; i < array.length; i++) { @@ -415,7 +415,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isLogicalPrecedence", "hasArgNames"}) @ExplodeLoop - public Object allLogicalArgs(VirtualFrame frame, Object[] array) { + protected Object allLogicalArgs(VirtualFrame frame, Object[] array) { controlVisibility(); RAbstractVector currentVector = castVector(frame, array[0]); Object current = castLogical(frame, namesMerge(currentVector, getSuppliedArgsNames()[0])); @@ -429,7 +429,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isIntegerPrecedence", "noArgNames"}) @ExplodeLoop - public Object allInt(VirtualFrame frame, Object[] array) { + protected Object allInt(VirtualFrame frame, Object[] array) { controlVisibility(); Object current = castInteger(frame, array[0]); for (int i = 1; i < array.length; i++) { @@ -441,7 +441,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isIntegerPrecedence", "hasArgNames"}) @ExplodeLoop - public Object allIntArgs(VirtualFrame frame, Object[] array) { + protected Object allIntArgs(VirtualFrame frame, Object[] array) { controlVisibility(); RAbstractVector currentVector = castVector(frame, array[0]); Object current = castInteger(frame, namesMerge(currentVector, getSuppliedArgsNames()[0])); @@ -455,7 +455,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isDoublePrecedence", "noArgNames"}) @ExplodeLoop - public Object allDouble(VirtualFrame frame, Object[] array) { + protected Object allDouble(VirtualFrame frame, Object[] array) { controlVisibility(); Object current = castDouble(frame, array[0]); for (int i = 1; i < array.length; i++) { @@ -467,7 +467,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isDoublePrecedence", "hasArgNames"}) @ExplodeLoop - public Object allDoubleArgs(VirtualFrame frame, Object[] array) { + protected Object allDoubleArgs(VirtualFrame frame, Object[] array) { controlVisibility(); RAbstractVector currentVector = castVector(frame, array[0]); Object current = castDouble(frame, namesMerge(currentVector, getSuppliedArgsNames()[0])); @@ -481,7 +481,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isComplexPrecedence", "noArgNames"}) @ExplodeLoop - public Object allComplex(VirtualFrame frame, Object[] array) { + protected Object allComplex(VirtualFrame frame, Object[] array) { controlVisibility(); Object current = castComplex(frame, array[0]); for (int i = 1; i < array.length; i++) { @@ -493,7 +493,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isComplexPrecedence", "hasArgNames"}) @ExplodeLoop - public Object allComplexArgs(VirtualFrame frame, Object[] array) { + protected Object allComplexArgs(VirtualFrame frame, Object[] array) { controlVisibility(); RAbstractVector currentVector = castVector(frame, array[0]); Object current = castComplex(frame, namesMerge(currentVector, getSuppliedArgsNames()[0])); @@ -507,7 +507,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isStringPrecedence", "noArgNames"}) @ExplodeLoop - public Object allString(VirtualFrame frame, Object[] array) { + protected Object allString(VirtualFrame frame, Object[] array) { controlVisibility(); Object current = castString(frame, array[0]); for (int i = 1; i < array.length; i++) { @@ -519,7 +519,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isStringPrecedence", "hasArgNames"}) @ExplodeLoop - public Object allStringArgs(VirtualFrame frame, Object[] array) { + protected Object allStringArgs(VirtualFrame frame, Object[] array) { controlVisibility(); RAbstractVector currentVector = castVector(frame, array[0]); Object current = castString(frame, namesMerge(currentVector, getSuppliedArgsNames()[0])); @@ -533,7 +533,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isRawPrecedence", "noArgNames"}) @ExplodeLoop - public Object allRaw(VirtualFrame frame, Object[] array) { + protected Object allRaw(VirtualFrame frame, Object[] array) { controlVisibility(); Object current = castRaw(frame, array[0]); for (int i = 1; i < array.length; i++) { @@ -545,7 +545,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isRawPrecedence", "hasArgNames"}) @ExplodeLoop - public Object allRawArgs(VirtualFrame frame, Object[] array) { + protected Object allRawArgs(VirtualFrame frame, Object[] array) { controlVisibility(); RAbstractVector currentVector = castVector(frame, array[0]); Object current = castRaw(frame, namesMerge(currentVector, getSuppliedArgsNames()[0])); @@ -559,7 +559,7 @@ public abstract class Combine extends RBuiltinNode { @Specialization(guards = {"isListPrecedence", "noArgNames"}) @ExplodeLoop - public Object list(VirtualFrame frame, Object[] array) { + protected Object list(VirtualFrame frame, Object[] array) { controlVisibility(); RList current = RDataFactory.createList(); for (int i = 0; i < array.length; ++i) { @@ -570,7 +570,7 @@ public abstract class Combine extends RBuiltinNode { } @Specialization(guards = {"isListPrecedence", "hasArgNames"}) - public Object listArgs(VirtualFrame frame, Object[] array) { + protected Object listArgs(VirtualFrame frame, Object[] array) { controlVisibility(); RAbstractVector currentVector = castVector(frame, array[0]); Object current = castList(frame, namesMerge(currentVector, getSuppliedArgsNames()[0])); @@ -582,11 +582,11 @@ public abstract class Combine extends RBuiltinNode { return current; } - public boolean hasArgNames() { + protected boolean hasArgNames() { return getSuppliedArgsNames() != null; } - public boolean noArgNames() { + protected boolean noArgNames() { return !hasArgNames(); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CommandArgs.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CommandArgs.java index 0abdf9620b6bff9b14c6ef784ef9f7abc64e7b3c..471c88ce32e092e1e73b670e29f67a773ac8dfd4 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CommandArgs.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CommandArgs.java @@ -34,7 +34,7 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class CommandArgs extends RBuiltinNode { @Specialization - public RStringVector commandArgs() { + protected RStringVector commandArgs() { controlVisibility(); return getCommandArgs(); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Complex.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Complex.java index 6829ae09afecaeb975e3efa5fb3a415edad88238..fb26e7b12c854f1a893ebab755bf1ef829c2276f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Complex.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Complex.java @@ -51,14 +51,14 @@ public abstract class Complex extends RBuiltinNode { @Specialization(guards = "zeroLength") @SuppressWarnings("unused") - public RComplex complexZeroLength(int lengthOut, double real, double imaginary, int modulus, int argument) { + protected RComplex complexZeroLength(int lengthOut, double real, double imaginary, int modulus, int argument) { controlVisibility(); return RDataFactory.createComplex(real, imaginary); } @Specialization(guards = "!zeroLength") @SuppressWarnings("unused") - public RComplexVector complex(int lengthOut, double real, double imaginary, int modulus, int argument) { + protected RComplexVector complex(int lengthOut, double real, double imaginary, int modulus, int argument) { controlVisibility(); double[] data = new double[lengthOut << 1]; for (int i = 0; i < data.length; i += 2) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java index fb35ae7431e1f867eacf3b3bfe2e6a03f903a538..1fbfb12999bb92b045e7b4845ced5cb27756f29b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java @@ -71,7 +71,7 @@ public abstract class ConnectionFunctions { @RBuiltin(name = "stdin", kind = INTERNAL, parameterNames = {}) public abstract static class Stdin extends RInvisibleBuiltinNode { @Specialization - public RConnection stdin() { + protected RConnection stdin() { controlVisibility(); if (stdin == null) { stdin = new StdinConnection(); @@ -132,7 +132,7 @@ public abstract class ConnectionFunctions { public abstract static class File extends RInvisibleBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object file(VirtualFrame frame, RAbstractStringVector description, String open, byte blocking, RAbstractStringVector encoding, byte raw) { + protected Object file(VirtualFrame frame, RAbstractStringVector description, String open, byte blocking, RAbstractStringVector encoding, byte raw) { controlVisibility(); if (!open.equals("r")) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.UNIMPLEMENTED_OPEN_MODE, open); @@ -149,7 +149,7 @@ public abstract class ConnectionFunctions { @SuppressWarnings("unused") @Specialization - public Object file(VirtualFrame frame, Object description, Object open, Object blocking, Object encoding, Object raw) { + protected Object file(VirtualFrame frame, Object description, Object open, Object blocking, Object encoding, Object raw) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_UNNAMED_ARGUMENTS); } @@ -159,7 +159,7 @@ public abstract class ConnectionFunctions { public abstract static class GZFile extends RInvisibleBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object gzFile(VirtualFrame frame, RAbstractStringVector description, String open, RAbstractStringVector encoding, double compression) { + protected Object gzFile(VirtualFrame frame, RAbstractStringVector description, String open, RAbstractStringVector encoding, double compression) { controlVisibility(); String ePath = Utils.tildeExpand(description.getDataAt(0)); try { @@ -176,7 +176,7 @@ public abstract class ConnectionFunctions { // TODO Internal public abstract static class Close extends RInvisibleBuiltinNode { @Specialization - public Object close(@SuppressWarnings("unused") Object con) { + protected Object close(@SuppressWarnings("unused") Object con) { controlVisibility(); // TODO implement when on.exit doesn't evaluate it's argument return RNull.instance; @@ -186,7 +186,7 @@ public abstract class ConnectionFunctions { @RBuiltin(name = "readLines", kind = INTERNAL, parameterNames = {"con", "n", "ok", "warn", "encoding"}) public abstract static class ReadLines extends RBuiltinNode { @Specialization - public Object readLines(VirtualFrame frame, RConnection con, int n, byte ok, @SuppressWarnings("unused") byte warn, @SuppressWarnings("unused") String encoding) { + protected Object readLines(VirtualFrame frame, RConnection con, int n, byte ok, @SuppressWarnings("unused") byte warn, @SuppressWarnings("unused") String encoding) { controlVisibility(); try { String[] lines = con.readLines(n); @@ -201,7 +201,7 @@ public abstract class ConnectionFunctions { @SuppressWarnings("unused") @Specialization - public Object readLines(VirtualFrame frame, Object con, Object n, Object ok, Object warn, Object encoding) { + protected Object readLines(VirtualFrame frame, Object con, Object n, Object ok, Object warn, Object encoding) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_UNNAMED_ARGUMENTS); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Contributors.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Contributors.java index 7e9d4b3bd803c184ed862ef919f776a7582286e5..7cf3d12f60789012ed48056911ec714c6c5fa35a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Contributors.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Contributors.java @@ -35,7 +35,7 @@ public abstract class Contributors extends RInvisibleBuiltinNode { private static final String CONTRIBUTORS = Utils.getResourceAsString(Contributors.class, "CONTRIBUTORS", true); @Specialization - public Object contributors() { + protected Object contributors() { controlVisibility(); RContext.getInstance().getConsoleHandler().println(CONTRIBUTORS); return RNull.instance; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cor.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cor.java index a3ab5746fa8a38c82a05e44311fb1650884431c2..6689765b1e80c267c06ee2b2316f58fd4a9343dc 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cor.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cor.java @@ -41,21 +41,21 @@ public abstract class Cor extends Covcor { } @Specialization - public RDoubleVector dimWithDimensions(RDoubleVector vector1, RDoubleVector vector2, @SuppressWarnings("unused") String use, @SuppressWarnings("unused") RStringVector method) { + protected RDoubleVector dimWithDimensions(RDoubleVector vector1, RDoubleVector vector2, @SuppressWarnings("unused") String use, @SuppressWarnings("unused") RStringVector method) { controlVisibility(); return corcov(vector1, vector2, false, true); } @Specialization @SuppressWarnings("unused") - public RDoubleVector dimWithDimensions(RDoubleVector vector1, RMissing vector2, String use, RStringVector method) { + protected RDoubleVector dimWithDimensions(RDoubleVector vector1, RMissing vector2, String use, RStringVector method) { controlVisibility(); return corcov(vector1, null, false, true); } @Specialization @SuppressWarnings("unused") - public RDoubleVector dimWithDimensions(RDoubleVector vector1, RNull vector2, String use, RStringVector method) { + protected RDoubleVector dimWithDimensions(RDoubleVector vector1, RNull vector2, String use, RStringVector method) { controlVisibility(); return corcov(vector1, null, false, true); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cov.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cov.java index c6b4e717753d0dc197f07ba9ff9f031a9436747d..697b904270a019503535851ef0921e9bf1ddf424 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cov.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Cov.java @@ -42,14 +42,14 @@ public abstract class Cov extends Covcor { } @Specialization - public RDoubleVector dimWithDimensions(RDoubleVector vector1, RDoubleVector vector2) { + protected RDoubleVector dimWithDimensions(RDoubleVector vector1, RDoubleVector vector2) { controlVisibility(); return corcov(vector1, vector2, false, false); } @Specialization @SuppressWarnings("unused") - public RDoubleVector dimWithDimensions(RDoubleVector vector1, RMissing vector2) { + protected RDoubleVector dimWithDimensions(RDoubleVector vector1, RMissing vector2) { controlVisibility(); return corcov(vector1, null, false, false); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Crossprod.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Crossprod.java index c95754468841d8cb841393f55aeccdf91dab563f..56de8dc9c3d43fd4597ad83482b50da3132f1143 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Crossprod.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Crossprod.java @@ -46,7 +46,7 @@ public abstract class Crossprod extends RBuiltinNode { private Object matMult(VirtualFrame frame, Object op1, Object op2) { if (matMult == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - matMult = insert(MatMultFactory.create(new RNode[1], getBuiltin(), getSuppliedArgsNames())); + matMult = insert(MatMultFactory.create(new RNode[2], getBuiltin(), getSuppliedArgsNames())); } return matMult.executeObject(frame, op1, op2); } @@ -60,19 +60,19 @@ public abstract class Crossprod extends RBuiltinNode { } @Specialization - public Object crossprod(VirtualFrame frame, RAbstractVector a, RAbstractVector b) { + protected Object crossprod(VirtualFrame frame, RAbstractVector a, RAbstractVector b) { controlVisibility(); return matMult(frame, transpose(frame, a), b); } @Specialization(guards = "!matdouble") - public Object crossprod(VirtualFrame frame, RAbstractVector b, @SuppressWarnings("unused") RNull a) { + protected Object crossprod(VirtualFrame frame, RAbstractVector b, @SuppressWarnings("unused") RNull a) { controlVisibility(); return matMult(frame, transpose(frame, b), b); } @Specialization(guards = "matdouble") - public Object crossprodDoubleMatrix(RAbstractDoubleVector a, @SuppressWarnings("unused") RNull b) { + protected Object crossprodDoubleMatrix(RAbstractDoubleVector a, @SuppressWarnings("unused") RNull b) { controlVisibility(); final int aCols = a.getDimensions()[1]; final int bRows = a.getDimensions()[0]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMax.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMax.java index 46eff893a73063231e5b6ad7a4e737dbf5703bfa..ab2be742eb521b3c9f91f47b45e4bef734c94a8a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMax.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMax.java @@ -28,25 +28,25 @@ public abstract class CumMax extends RBuiltinNode { private final NACheck na = NACheck.create(); @Specialization - public double cummax(double arg) { + protected double cummax(double arg) { controlVisibility(); return arg; } @Specialization - public int cummax(int arg) { + protected int cummax(int arg) { controlVisibility(); return arg; } @Specialization - public Object cummax(VirtualFrame frame, String arg) { + protected Object cummax(VirtualFrame frame, String arg) { controlVisibility(); return CastDoubleNodeFactory.create(null, false, false, false).executeDouble(frame, arg); } @Specialization - public int cummax(byte arg) { + protected int cummax(byte arg) { controlVisibility(); na.enable(arg); if (na.check(arg)) { @@ -56,7 +56,7 @@ public abstract class CumMax extends RBuiltinNode { } @Specialization - public RIntVector cummax(RIntSequence v) { + protected RIntVector cummax(RIntSequence v) { controlVisibility(); int[] cmaxV = new int[v.getLength()]; @@ -74,7 +74,7 @@ public abstract class CumMax extends RBuiltinNode { } @Specialization - public RDoubleVector cummax(RDoubleVector v) { + protected RDoubleVector cummax(RDoubleVector v) { controlVisibility(); double[] cmaxV = new double[v.getLength()]; double max = v.getDataAt(0); @@ -97,7 +97,7 @@ public abstract class CumMax extends RBuiltinNode { } @Specialization - public RIntVector cummax(RIntVector v) { + protected RIntVector cummax(RIntVector v) { controlVisibility(); int[] cmaxV = new int[v.getLength()]; int max = v.getDataAt(0); @@ -120,7 +120,7 @@ public abstract class CumMax extends RBuiltinNode { } @Specialization - public RIntVector cummax(RLogicalVector v) { + protected RIntVector cummax(RLogicalVector v) { controlVisibility(); int[] cmaxV = new int[v.getLength()]; int max = v.getDataAt(0); @@ -143,13 +143,13 @@ public abstract class CumMax extends RBuiltinNode { } @Specialization - public RDoubleVector cummax(VirtualFrame frame, RStringVector v) { + protected RDoubleVector cummax(VirtualFrame frame, RStringVector v) { controlVisibility(); return cummax((RDoubleVector) CastDoubleNodeFactory.create(null, false, false, false).executeDouble(frame, v)); } @Specialization - public RComplexVector cummax(VirtualFrame frame, @SuppressWarnings("unused") RComplexVector v) { + protected RComplexVector cummax(VirtualFrame frame, @SuppressWarnings("unused") RComplexVector v) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.CUMMAX_UNDEFINED_FOR_COMPLEX); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMin.java index 533a0ed7006a63951bd7710db7d704fbc045fcc8..3e92dd53a5df888fa078ac4616e7a67aeb7ce222 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumMin.java @@ -28,19 +28,19 @@ public abstract class CumMin extends RBuiltinNode { private final NACheck na = NACheck.create(); @Specialization - public double cummin(double arg) { + protected double cummin(double arg) { controlVisibility(); return arg; } @Specialization - public int cummin(int arg) { + protected int cummin(int arg) { controlVisibility(); return arg; } @Specialization - public int cummin(byte arg) { + protected int cummin(byte arg) { controlVisibility(); na.enable(arg); if (na.check(arg)) { @@ -50,13 +50,13 @@ public abstract class CumMin extends RBuiltinNode { } @Specialization - public double cummax(String arg) { + protected double cummax(String arg) { controlVisibility(); return CastDoubleNodeFactory.create(null, false, false, false).doString(arg); } @Specialization - public RIntVector cumMin(RIntSequence v) { + protected RIntVector cumMin(RIntSequence v) { controlVisibility(); int[] cminV = new int[v.getLength()]; @@ -74,7 +74,7 @@ public abstract class CumMin extends RBuiltinNode { } @Specialization - public RDoubleVector cummin(RDoubleVector v) { + protected RDoubleVector cummin(RDoubleVector v) { controlVisibility(); double[] cminV = new double[v.getLength()]; double min = v.getDataAt(0); @@ -97,7 +97,7 @@ public abstract class CumMin extends RBuiltinNode { } @Specialization - public RIntVector cummin(RIntVector v) { + protected RIntVector cummin(RIntVector v) { controlVisibility(); int[] cminV = new int[v.getLength()]; int min = v.getDataAt(0); @@ -120,7 +120,7 @@ public abstract class CumMin extends RBuiltinNode { } @Specialization - public RIntVector cummin(RLogicalVector v) { + protected RIntVector cummin(RLogicalVector v) { controlVisibility(); int[] cminV = new int[v.getLength()]; int min = v.getDataAt(0); @@ -143,13 +143,13 @@ public abstract class CumMin extends RBuiltinNode { } @Specialization - public RDoubleVector cummin(VirtualFrame frame, RStringVector v) { + protected RDoubleVector cummin(VirtualFrame frame, RStringVector v) { controlVisibility(); return cummin((RDoubleVector) CastDoubleNodeFactory.create(null, false, false, false).executeDouble(frame, v)); } @Specialization - public RComplexVector cummin(VirtualFrame frame, @SuppressWarnings("unused") RComplexVector v) { + protected RComplexVector cummin(VirtualFrame frame, @SuppressWarnings("unused") RComplexVector v) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.CUMMIN_UNDEFINED_FOR_COMPLEX); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumProd.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumProd.java index f8f711126acd54250147914766f68692b8d9ee30..ddc8488ceeba7c0f5cd4686d6814be1161c16d65 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumProd.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumProd.java @@ -30,19 +30,19 @@ public abstract class CumProd extends RBuiltinNode { @Child private BinaryArithmetic mul = BinaryArithmetic.MULTIPLY.create(); @Specialization - public int cumprod(int arg) { + protected int cumprod(int arg) { controlVisibility(); return arg; } @Specialization - public double cumrpod(double arg) { + protected double cumrpod(double arg) { controlVisibility(); return arg; } @Specialization - public int cumprod(byte arg) { + protected int cumprod(byte arg) { controlVisibility(); na.enable(arg); if (na.check(arg)) { @@ -52,7 +52,7 @@ public abstract class CumProd extends RBuiltinNode { } @Specialization - public RIntVector cumprod(RAbstractIntVector arg) { + protected RIntVector cumprod(RAbstractIntVector arg) { controlVisibility(); int[] array = new int[arg.getLength()]; na.enable(arg); @@ -75,7 +75,7 @@ public abstract class CumProd extends RBuiltinNode { } @Specialization - public RDoubleVector cumprod(RDoubleVector arg) { + protected RDoubleVector cumprod(RDoubleVector arg) { controlVisibility(); double[] array = new double[arg.getLength()]; na.enable(arg); @@ -98,7 +98,7 @@ public abstract class CumProd extends RBuiltinNode { } @Specialization - public RIntVector cumprod(RLogicalVector arg) { + protected RIntVector cumprod(RLogicalVector arg) { controlVisibility(); int[] array = new int[arg.getLength()]; na.enable(arg); @@ -121,7 +121,7 @@ public abstract class CumProd extends RBuiltinNode { } @Specialization - public RDoubleVector cumprod(RStringVector arg) { + protected RDoubleVector cumprod(RStringVector arg) { controlVisibility(); double[] array = new double[arg.getLength()]; na.enable(arg); @@ -141,7 +141,7 @@ public abstract class CumProd extends RBuiltinNode { } @Specialization - public RComplexVector cumprod(RComplexVector arg) { + protected RComplexVector cumprod(RComplexVector arg) { controlVisibility(); double[] array = new double[arg.getLength() * 2]; na.enable(arg); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumSum.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumSum.java index 3d3ce9f0e1bc07b0c466af2e0a49f40f9d656611..2dd326e6e521f132003f54e9aa63dab1db311339 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumSum.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CumSum.java @@ -41,19 +41,19 @@ public abstract class CumSum extends RBuiltinNode { @Child private BinaryArithmetic add = BinaryArithmetic.ADD.create(); @Specialization - public double cumsum(double arg) { + protected double cumsum(double arg) { controlVisibility(); return arg; } @Specialization - public int cumsum(int arg) { + protected int cumsum(int arg) { controlVisibility(); return arg; } @Specialization - public int cumsum(byte arg) { + protected int cumsum(byte arg) { controlVisibility(); na.enable(arg); if (na.check(arg)) { @@ -63,7 +63,7 @@ public abstract class CumSum extends RBuiltinNode { } @Specialization - public RIntVector cumsum(RIntSequence arg) { + protected RIntVector cumsum(RIntSequence arg) { controlVisibility(); int[] res = new int[arg.getLength()]; int current = arg.getStart(); @@ -85,7 +85,7 @@ public abstract class CumSum extends RBuiltinNode { } @Specialization - public RDoubleVector cumsum(RDoubleVector arg) { + protected RDoubleVector cumsum(RDoubleVector arg) { controlVisibility(); double[] res = new double[arg.getLength()]; double prev = 0.0; @@ -105,7 +105,7 @@ public abstract class CumSum extends RBuiltinNode { } @Specialization - public RIntVector cumsum(RIntVector arg) { + protected RIntVector cumsum(RIntVector arg) { controlVisibility(); int[] res = new int[arg.getLength()]; int prev = 0; @@ -128,7 +128,7 @@ public abstract class CumSum extends RBuiltinNode { } @Specialization - public RIntVector cumsum(RLogicalVector arg) { + protected RIntVector cumsum(RLogicalVector arg) { controlVisibility(); int[] res = new int[arg.getLength()]; int prev = 0; @@ -148,7 +148,7 @@ public abstract class CumSum extends RBuiltinNode { } @Specialization - public RDoubleVector cumsum(RStringVector arg) { + protected RDoubleVector cumsum(RStringVector arg) { controlVisibility(); double[] res = new double[arg.getLength()]; double prev = 0.0; @@ -169,7 +169,7 @@ public abstract class CumSum extends RBuiltinNode { } @Specialization - public RComplexVector cumsum(RComplexVector arg) { + protected RComplexVector cumsum(RComplexVector arg) { controlVisibility(); double[] res = new double[arg.getLength() * 2]; RComplex prev = RDataFactory.createComplex(0.0, 0.0); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Date.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Date.java index 817701561bd917e75c6038cd5fc5cd05915933ee..ea9bdf005f30d42725b9a8bd72150cf0b9b5d9eb 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Date.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Date.java @@ -23,7 +23,7 @@ public abstract class Date extends RBuiltinNode { @Specialization @SlowPath - public String date() { + protected String date() { return RRuntime.toString(new SimpleDateFormat(RRuntime.SYSTEM_DATE_FORMAT).format(Calendar.getInstance().getTime())); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DebugFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DebugFunctions.java index 06cc08987474fa46f943ca00e936d15c8a04990c..092e98d1de1b7a3bf1e0928bc0fe2598e793d7e9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DebugFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DebugFunctions.java @@ -36,7 +36,7 @@ public class DebugFunctions { public abstract static class Debug extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull debug(RFunction fun, RAbstractStringVector text, RNull condition) { + protected RNull debug(RFunction fun, RAbstractStringVector text, RNull condition) { // TODO implement controlVisibility(); return RNull.instance; @@ -47,7 +47,7 @@ public class DebugFunctions { public abstract static class DebugOnce extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull debugonce(RFunction fun, RAbstractStringVector text, RNull condition) { + protected RNull debugonce(RFunction fun, RAbstractStringVector text, RNull condition) { // TODO implement controlVisibility(); return RNull.instance; @@ -58,7 +58,7 @@ public class DebugFunctions { public abstract static class UnDebug extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull undebug(RFunction fun) { + protected RNull undebug(RFunction fun) { // TODO implement controlVisibility(); return RNull.instance; @@ -69,7 +69,7 @@ public class DebugFunctions { public abstract static class IsDebugged extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public byte isDebugged(RFunction fun) { + protected byte isDebugged(RFunction fun) { // TODO implement controlVisibility(); return RRuntime.LOGICAL_FALSE; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DelayedAssign.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DelayedAssign.java index 1eb03339643ab0512f2a9152a435c64970d31609..f442daf225001c7fcf7cf96ed48b80e3f04bb8f3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DelayedAssign.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DelayedAssign.java @@ -42,23 +42,23 @@ public abstract class DelayedAssign extends RInvisibleBuiltinNode { } @Specialization - public Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, @SuppressWarnings("unused") RMissing evalEnv, @SuppressWarnings("unused") RMissing assignEnv) { + protected Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, @SuppressWarnings("unused") RMissing evalEnv, @SuppressWarnings("unused") RMissing assignEnv) { REnvironment curEnv = curEnv(frame); return doDelayedAssign(frame, nameVec, value, curEnv, curEnv); } @Specialization - public Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, @SuppressWarnings("unused") RMissing evalEnv, REnvironment assignEnv) { + protected Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, @SuppressWarnings("unused") RMissing evalEnv, REnvironment assignEnv) { return doDelayedAssign(frame, nameVec, value, curEnv(frame), assignEnv); } @Specialization - public Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, REnvironment evalEnv, @SuppressWarnings("unused") RMissing assignEnv) { + protected Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, REnvironment evalEnv, @SuppressWarnings("unused") RMissing assignEnv) { return doDelayedAssign(frame, nameVec, value, evalEnv, curEnv(frame)); } @Specialization - public Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, REnvironment evalEnv, REnvironment assignEnv) { + protected Object doDelayedAssign(VirtualFrame frame, RAbstractStringVector nameVec, RPromise value, REnvironment evalEnv, REnvironment assignEnv) { controlVisibility(); String name = nameVec.getDataAt(0); try { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Deparse.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Deparse.java index f54048e9a64cb7deb92edf3079f0f6e88c443ad7..7b24b9ba910ed833570b1f1e6aa97141eba515fc 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Deparse.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Deparse.java @@ -43,7 +43,7 @@ public abstract class Deparse extends RBuiltinNode { @SlowPath @Specialization - public RStringVector deparse(Object expr, int widthCutoffArg, RLogicalVector backtick, int nlines) { + protected RStringVector deparse(Object expr, int widthCutoffArg, RLogicalVector backtick, int nlines) { controlVisibility(); int widthCutoff = widthCutoffArg; if (widthCutoff == RRuntime.INT_NA || widthCutoff < RDeparse.MIN_Cutoff || widthCutoff > RDeparse.MAX_Cutoff) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java index b17bbcfafdcf3602fe3d630d1c80a0195cdc566c..3caa93c55e6d8cd58c83ded335143478cacb0b89 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Diag.java @@ -51,13 +51,13 @@ public abstract class Diag extends RBuiltinNode { } @Specialization - public RNull dim(RNull vector, int rows, int cols) { + protected RNull dim(RNull vector, int rows, int cols) { controlVisibility(); return RNull.instance; } @Specialization - public RIntVector dim(int val, int rows, int cols) { + protected RIntVector dim(int val, int rows, int cols) { controlVisibility(); int[] data = new int[rows * cols]; for (int i = 0; i < Math.min(cols, rows); i++) { @@ -67,12 +67,12 @@ public abstract class Diag extends RBuiltinNode { } @Specialization - public RIntVector dim(int val, int rows, RMissing cols) { + protected RIntVector dim(int val, int rows, RMissing cols) { return dim(val, rows, rows); } @Specialization - public RDoubleVector dim(double val, int rows, int cols) { + protected RDoubleVector dim(double val, int rows, int cols) { controlVisibility(); double[] data = new double[rows * cols]; for (int i = 0; i < Math.min(cols, rows); i++) { @@ -82,12 +82,12 @@ public abstract class Diag extends RBuiltinNode { } @Specialization - public RDoubleVector dim(double val, int rows, RMissing cols) { + protected RDoubleVector dim(double val, int rows, RMissing cols) { return dim(val, rows, rows); } @Specialization - public RLogicalVector dim(byte val, int rows, int cols) { + protected RLogicalVector dim(byte val, int rows, int cols) { controlVisibility(); byte[] data = new byte[rows * cols]; for (int i = 0; i < Math.min(cols, rows); i++) { @@ -97,12 +97,12 @@ public abstract class Diag extends RBuiltinNode { } @Specialization - public RLogicalVector dim(byte val, int rows, RMissing cols) { + protected RLogicalVector dim(byte val, int rows, RMissing cols) { return dim(val, rows, rows); } @Specialization(guards = "isMatrix") - public RIntVector dimWithDimensions(RIntVector vector, Object rows, Object cols) { + protected RIntVector dimWithDimensions(RIntVector vector, Object rows, Object cols) { controlVisibility(); int size = Math.min(vector.getDimensions()[0], vector.getDimensions()[1]); int[] result = new int[size]; @@ -119,7 +119,7 @@ public abstract class Diag extends RBuiltinNode { } @Specialization(guards = "isMatrix") - public RDoubleVector dimWithDimensions(RDoubleVector vector, Object rows, Object cols) { + protected RDoubleVector dimWithDimensions(RDoubleVector vector, Object rows, Object cols) { controlVisibility(); int size = Math.min(vector.getDimensions()[0], vector.getDimensions()[1]); double[] result = new double[size]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Dim.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Dim.java index c44687d23bbcc52271398fd5639c114a8675b4bd..2f584511bef436ff56bab5ffff97fb72a4f77757 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Dim.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Dim.java @@ -35,37 +35,37 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class Dim extends RBuiltinNode { @Specialization - public RNull dim(RNull vector) { + protected RNull dim(RNull vector) { controlVisibility(); return RNull.instance; } @Specialization - public RNull dim(int vector) { + protected RNull dim(int vector) { controlVisibility(); return RNull.instance; } @Specialization - public RNull dim(double vector) { + protected RNull dim(double vector) { controlVisibility(); return RNull.instance; } @Specialization - public RNull dim(byte vector) { + protected RNull dim(byte vector) { controlVisibility(); return RNull.instance; } @Specialization(guards = "!hasDimensions") - public RNull dim(RAbstractVector vector) { + protected RNull dim(RAbstractVector vector) { controlVisibility(); return RNull.instance; } @Specialization(guards = "hasDimensions") - public RIntVector dimWithDimensions(RAbstractVector vector) { + protected RIntVector dimWithDimensions(RAbstractVector vector) { controlVisibility(); return RDataFactory.createIntVector(vector.getDimensions(), RDataFactory.COMPLETE_VECTOR); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DimNames.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DimNames.java index b221bd1e4e245c0961803617dc0864c4661b0f9d..49fa4b5ef08f8a5570eb2e54d7f26bc913edb23c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DimNames.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DimNames.java @@ -34,19 +34,19 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class DimNames extends RBuiltinNode { @Specialization - public RNull getDimNames(RNull operand) { + protected RNull getDimNames(RNull operand) { controlVisibility(); return operand; } @Specialization(guards = "!isNull") - public RList getDimNames(RAbstractVector vector) { + protected RList getDimNames(RAbstractVector vector) { controlVisibility(); return vector.getDimNames(); } @Specialization(guards = "isNull") - public RNull getDimNamesNull(@SuppressWarnings("unused") RAbstractVector vector) { + protected RNull getDimNamesNull(@SuppressWarnings("unused") RAbstractVector vector) { controlVisibility(); return RNull.instance; } 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 ebd8249ad2c32be05a29e790d063f4ab63b2d0ea..d68ed27c959bd8efa2844fc00a2a250725034a38 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 @@ -40,7 +40,7 @@ public abstract class DoCall extends RBuiltinNode { @Child protected IndirectCallNode funCall = Truffle.getRuntime().createIndirectCallNode(); @Specialization(guards = "lengthOne") - public Object doDoCall(VirtualFrame frame, RAbstractStringVector fname, RList argsAsList, @SuppressWarnings("unused") REnvironment env) { + protected Object doDoCall(VirtualFrame frame, RAbstractStringVector fname, RList argsAsList, @SuppressWarnings("unused") REnvironment env) { RFunction func = RContext.getEngine().lookupBuiltin(fname.getDataAt(0)); if (func == null) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.UNKNOWN_FUNCTION, fname); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotLibpaths.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotLibpaths.java index 50ad1b3ab28f18b2eaba3db0ebeb22038e88da42..e2957447bc8c02023f3ba905b37cc6a7506992a8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotLibpaths.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotLibpaths.java @@ -55,13 +55,13 @@ import com.oracle.truffle.r.runtime.data.model.*; @RBuiltin(name = ".libPaths", kind = SUBSTITUTE, parameterNames = {"new"}) public abstract class DotLibpaths extends RBuiltinNode { @Specialization - public Object libPathsVec(@SuppressWarnings("unused") RMissing missing) { + protected Object libPathsVec(@SuppressWarnings("unused") RMissing missing) { controlVisibility(); return RDataFactory.createStringVector(LibPaths.dotLibPaths(), RDataFactory.COMPLETE_VECTOR); } @Specialization - public Object libPathsVec(RAbstractStringVector pathVec) { + protected Object libPathsVec(RAbstractStringVector pathVec) { controlVisibility(); ArrayList<String> resultsList = new ArrayList<>(pathVec.getLength()); FileSystem fileSystem = FileSystems.getDefault(); @@ -95,7 +95,7 @@ public abstract class DotLibpaths extends RBuiltinNode { } @Specialization - public Object libPathsGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object x) { + protected Object libPathsGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object x) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "path"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoubleBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoubleBuiltin.java index 86e24b50a586e536b881731eb671756e416b79a6..79a74ae1702083b2fc104f891b9c850847ea617f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoubleBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoubleBuiltin.java @@ -41,20 +41,20 @@ public abstract class DoubleBuiltin extends RBuiltinNode { } @Specialization - public Object createDoubleVector(int length) { + protected Object createDoubleVector(int length) { controlVisibility(); return RDataFactory.createDoubleVector(length); } @Specialization - public Object createDoubleVector(double length) { + protected Object createDoubleVector(double length) { controlVisibility(); return RDataFactory.createDoubleVector((int) length); } @SuppressWarnings("unused") @Specialization - public Object createDoubleVector(RMissing length) { + protected Object createDoubleVector(RMissing length) { controlVisibility(); return RDataFactory.createDoubleVector(0); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java index 48d2d430d3edb54b9c53975f6fa26c286150ba7a..4864bd5a1b01e41680dbe7e155a69f7aa068bcd9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Drop.java @@ -33,7 +33,7 @@ import com.oracle.truffle.r.runtime.data.model.*; @RBuiltin(name = "drop", kind = RBuiltinKind.INTERNAL, parameterNames = {"x"}) public abstract class Drop extends RBuiltinNode { @Specialization - public RAbstractVector doDrop(RAbstractVector x) { + protected RAbstractVector doDrop(RAbstractVector x) { int[] dims = x.getDimensions(); int[] newDims = new int[dims.length]; int count = 0; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DynLoadFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DynLoadFunctions.java index 4f536fc80a314ac903f896d667d39c07fe80fda3..2c002393ca6a3612620483ca9d7627d53f7eac86 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DynLoadFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DynLoadFunctions.java @@ -42,7 +42,7 @@ public class DynLoadFunctions { @RBuiltin(name = "dyn.load", kind = INTERNAL, parameterNames = {"lib", "local", "now", "unused"}) public abstract static class DynLoad extends RInvisibleBuiltinNode { @Specialization - public RList doDynLoad(VirtualFrame frame, RAbstractStringVector libVec, RAbstractLogicalVector localVec, byte now, @SuppressWarnings("unused") String unused) { + protected RList doDynLoad(VirtualFrame frame, RAbstractStringVector libVec, RAbstractLogicalVector localVec, byte now, @SuppressWarnings("unused") String unused) { controlVisibility(); // Length checked by GnuR if (libVec.getLength() > 1) { @@ -68,7 +68,7 @@ public class DynLoadFunctions { @RBuiltin(name = "dyn.unload", kind = INTERNAL, parameterNames = {"lib"}) public abstract static class DynUnload extends RInvisibleBuiltinNode { @Specialization - public RNull doDynunload(VirtualFrame frame, String lib) { + protected RNull doDynunload(VirtualFrame frame, String lib) { controlVisibility(); try { DLL.unload(lib); @@ -84,7 +84,7 @@ public class DynLoadFunctions { @RBuiltin(name = "getLoadedDLLs", aliases = {".dynlibs"}, kind = INTERNAL, parameterNames = {}) public abstract static class GetLoadedDLLs extends RBuiltinNode { @Specialization - public RList doGetLoadedDLLs() { + protected RList doGetLoadedDLLs() { controlVisibility(); Object[][] dlls = DLL.getLoadedDLLs(); String[] names = new String[dlls.length]; @@ -112,7 +112,7 @@ public class DynLoadFunctions { public abstract static class IsLoaded extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public byte isLoaded(String symbol, String packageName, String type) { + protected byte isLoaded(String symbol, String packageName, String type) { controlVisibility(); // TODO Pay attention to packageName boolean found = DLL.findSymbolInfo(symbol, null) != null; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EncodeString.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EncodeString.java index 36481557f75270c363001f47ae34a7f8b0f40d51..376b5a8497fb931dfa96c74af9249aa4ee4300ab 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EncodeString.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EncodeString.java @@ -34,7 +34,7 @@ public abstract class EncodeString extends RBuiltinNode { } private final NACheck na = NACheck.create(); - private BranchProfile everSeenNA = new BranchProfile(); + private final BranchProfile everSeenNA = new BranchProfile(); @Override public RNode[] getParameterValues() { @@ -87,7 +87,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "leftJustify", "isEncodeNA"}) - public RStringVector encodeStringLeftJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringLeftJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final int maxElWidth = computeWidth(x, width, quoteEl); final String[] result = new String[x.getLength()]; @@ -108,7 +108,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "leftJustify", "!isEncodeNA"}) - public RStringVector encodeStringLeftJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringLeftJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final int maxElWidth = computeWidth(x, width, quoteEl); final String[] result = new String[x.getLength()]; @@ -126,7 +126,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "rightJustify", "isEncodeNA"}) - public RStringVector encodeStringRightJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringRightJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final int maxElWidth = computeWidth(x, width, quoteEl); final String[] result = new String[x.getLength()]; @@ -147,7 +147,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "rightJustify", "!isEncodeNA"}) - public RStringVector encodeStringRightJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringRightJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final int maxElWidth = computeWidth(x, width, quoteEl); final String[] result = new String[x.getLength()]; @@ -165,7 +165,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "centerJustify", "isEncodeNA"}) - public RStringVector encodeStringCenterJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringCenterJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final int maxElWidth = computeWidth(x, width, quoteEl); final String[] result = new String[x.getLength()]; @@ -193,7 +193,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "centerJustify", "!isEncodeNA"}) - public RStringVector encodeStringCenterJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringCenterJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final int maxElWidth = computeWidth(x, width, quoteEl); final String[] result = new String[x.getLength()]; @@ -257,7 +257,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "noJustify", "isEncodeNA"}) - public RStringVector encodeStringNoJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringNoJustifyEncodeNA(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final String[] result = new String[x.getLength()]; for (int i = 0; i < x.getLength(); ++i) { @@ -274,7 +274,7 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = {"isValidWidth", "noJustify", "!isEncodeNA"}) - public RStringVector encodeStringNoJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringNoJustify(RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { final String quoteEl = quote.getDataAt(0); final String[] result = new String[x.getLength()]; for (int i = 0; i < x.getLength(); ++i) { @@ -291,31 +291,31 @@ public abstract class EncodeString extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "!isString") - public RStringVector encodeStringInvalidFirstArgument(VirtualFrame frame, Object x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringInvalidFirstArgument(VirtualFrame frame, Object x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.CHAR_VEC_ARGUMENT); } @SuppressWarnings("unused") @Specialization(guards = "!isValidWidth") - public RStringVector encodeStringInvalidWidth(VirtualFrame frame, RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringInvalidWidth(VirtualFrame frame, RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_VALUE, "width"); } @SuppressWarnings("unused") @Specialization(guards = "!isValidQuote") - public RStringVector encodeStringInvalidQuote(VirtualFrame frame, RAbstractStringVector x, int width, Object quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringInvalidQuote(VirtualFrame frame, RAbstractStringVector x, int width, Object quote, RAbstractIntVector justify, byte encodeNA) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_VALUE, "quote"); } @SuppressWarnings("unused") @Specialization(guards = "!isValidJustify") - public RStringVector encodeStringInvalidJustify(VirtualFrame frame, RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringInvalidJustify(VirtualFrame frame, RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_VALUE, "justify"); } @SuppressWarnings("unused") @Specialization(guards = "!isValidEncodeNA") - public RStringVector encodeStringInvalidEncodeNA(VirtualFrame frame, RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { + protected RStringVector encodeStringInvalidEncodeNA(VirtualFrame frame, RAbstractStringVector x, int width, RAbstractStringVector quote, RAbstractIntVector justify, byte encodeNA) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_VALUE, "na.encode"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java index 2942589b475665f4148efdf36b30eeedb9069f07..5ad7f2e9b6f6f3700ac1b74c2cc6b1a630be1f58 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java @@ -43,19 +43,19 @@ public class EnvFunctions { public abstract static class AsEnvironment extends RBuiltinNode { @Specialization - public REnvironment asEnvironment(REnvironment env) { + protected REnvironment asEnvironment(REnvironment env) { controlVisibility(); return env; } @Specialization - public REnvironment asEnvironment(VirtualFrame frame, double dpos) { + protected REnvironment asEnvironment(VirtualFrame frame, double dpos) { controlVisibility(); return asEnvironmentInt(frame, (int) dpos); } @Specialization - public REnvironment asEnvironmentInt(VirtualFrame frame, int pos) { + protected REnvironment asEnvironmentInt(VirtualFrame frame, int pos) { controlVisibility(); if (pos == -1) { Frame callerFrame = Utils.getCallerFrame(FrameAccess.MATERIALIZE); @@ -79,7 +79,7 @@ public class EnvFunctions { } @Specialization - public REnvironment asEnvironment(VirtualFrame frame, RAbstractStringVector nameVec) { + protected REnvironment asEnvironment(VirtualFrame frame, RAbstractStringVector nameVec) { controlVisibility(); String name = nameVec.getDataAt(0); String[] searchPath = REnvironment.searchPath(); @@ -97,7 +97,7 @@ public class EnvFunctions { public abstract static class EmptyEnv extends RBuiltinNode { @Specialization - public REnvironment emptyenv() { + protected REnvironment emptyenv() { controlVisibility(); return REnvironment.emptyEnv(); } @@ -107,7 +107,7 @@ public class EnvFunctions { public abstract static class GlobalEnv extends RBuiltinNode { @Specialization - public Object globalenv() { + protected Object globalenv() { controlVisibility(); return REnvironment.globalEnv(); } @@ -120,7 +120,7 @@ public class EnvFunctions { public abstract static class BaseEnv extends RBuiltinNode { @Specialization - public Object baseenv() { + protected Object baseenv() { controlVisibility(); return REnvironment.baseEnv(); } @@ -130,7 +130,7 @@ public class EnvFunctions { public abstract static class ParentEnv extends RBuiltinNode { @Specialization - public REnvironment parentenv(VirtualFrame frame, REnvironment env) { + protected REnvironment parentenv(VirtualFrame frame, REnvironment env) { controlVisibility(); if (env == REnvironment.emptyEnv()) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.EMPTY_NO_PARENT); @@ -145,7 +145,7 @@ public class EnvFunctions { public abstract static class SetParentEnv extends RBuiltinNode { @Specialization - public REnvironment setParentenv(VirtualFrame frame, REnvironment env, REnvironment parent) { + protected REnvironment setParentenv(VirtualFrame frame, REnvironment env, REnvironment parent) { controlVisibility(); if (env == REnvironment.emptyEnv()) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.CANNOT_SET_PARENT); @@ -160,7 +160,7 @@ public class EnvFunctions { public abstract static class IsEnvironment extends RBuiltinNode { @Specialization - public byte isEnvironment(Object env) { + protected byte isEnvironment(Object env) { controlVisibility(); return env instanceof REnvironment ? RRuntime.LOGICAL_TRUE : RRuntime.LOGICAL_FALSE; } @@ -175,7 +175,7 @@ public class EnvFunctions { } @Specialization - public Object environment(@SuppressWarnings("unused") RNull x) { + protected Object environment(@SuppressWarnings("unused") RNull x) { controlVisibility(); Frame callerFrame = Utils.getCallerFrame(FrameAccess.MATERIALIZE); return REnvironment.frameToEnvironment(callerFrame.materialize()); @@ -187,7 +187,7 @@ public class EnvFunctions { * an object that is not an {@link RFunction} is legal and must return {@code NULL}. */ @Specialization - public Object environment(Object funcArg) { + protected Object environment(Object funcArg) { controlVisibility(); if (funcArg instanceof RFunction) { RFunction func = (RFunction) funcArg; @@ -212,13 +212,13 @@ public class EnvFunctions { } @Specialization - public String environmentName(REnvironment env) { + protected String environmentName(REnvironment env) { controlVisibility(); return env.getName(); } @Specialization - public String environmentName(@SuppressWarnings("unused") Object env) { + protected String environmentName(@SuppressWarnings("unused") Object env) { controlVisibility(); // Not an error according to GnuR return ""; @@ -234,13 +234,13 @@ public class EnvFunctions { @Specialization @SuppressWarnings("unused") - public REnvironment newEnv(VirtualFrame frame, byte hash, RMissing parent, int size) { + protected REnvironment newEnv(VirtualFrame frame, byte hash, RMissing parent, int size) { return newEnv(frame, hash, RNull.instance, size); } @Specialization @SuppressWarnings("unused") - public REnvironment newEnv(VirtualFrame frame, byte hash, RNull parent, int size) { + protected REnvironment newEnv(VirtualFrame frame, byte hash, RNull parent, int size) { // TODO this will eventually go away when R code fixed when promises available controlVisibility(); // FIXME what if hash == FALSE? @@ -248,7 +248,7 @@ public class EnvFunctions { } @Specialization - public REnvironment newEnv(@SuppressWarnings("unused") VirtualFrame frame, @SuppressWarnings("unused") byte hash, REnvironment parent, int size) { + protected REnvironment newEnv(@SuppressWarnings("unused") VirtualFrame frame, @SuppressWarnings("unused") byte hash, REnvironment parent, int size) { controlVisibility(); // FIXME what if hash == FALSE? return new REnvironment.NewEnv(parent, size); @@ -259,7 +259,7 @@ public class EnvFunctions { // TODO INTERNAL public abstract static class Search extends RBuiltinNode { @Specialization - public RStringVector search() { + protected RStringVector search() { return RDataFactory.createStringVector(REnvironment.searchPath(), RDataFactory.COMPLETE_VECTOR); } } @@ -274,7 +274,7 @@ public class EnvFunctions { } @Specialization - public Object lockEnvironment(REnvironment env, byte bindings) { + protected Object lockEnvironment(REnvironment env, byte bindings) { controlVisibility(); env.lock(bindings == RRuntime.LOGICAL_TRUE); return RNull.instance; @@ -285,7 +285,7 @@ public class EnvFunctions { @RBuiltin(name = "environmentIsLocked", kind = INTERNAL, parameterNames = {"env"}) public abstract static class EnvironmentIsLocked extends RBuiltinNode { @Specialization - public Object lockEnvironment(REnvironment env) { + protected Object lockEnvironment(REnvironment env) { controlVisibility(); return RDataFactory.createLogicalVectorFromScalar(env.isLocked()); } @@ -295,7 +295,7 @@ public class EnvFunctions { @RBuiltin(name = "lockBinding", kind = INTERNAL, parameterNames = {"sym", "env"}) public abstract static class LockBinding extends RInvisibleBuiltinNode { @Specialization - public Object lockBinding(String sym, REnvironment env) { + protected Object lockBinding(String sym, REnvironment env) { controlVisibility(); env.lockBinding(sym); return RNull.instance; @@ -306,7 +306,7 @@ public class EnvFunctions { @RBuiltin(name = "unlockBinding", kind = INTERNAL, parameterNames = {"sym", "env"}) public abstract static class UnlockBinding extends RInvisibleBuiltinNode { @Specialization - public Object unlockBinding(String sym, REnvironment env) { + protected Object unlockBinding(String sym, REnvironment env) { controlVisibility(); env.unlockBinding(sym); return RNull.instance; @@ -317,7 +317,7 @@ public class EnvFunctions { @RBuiltin(name = "bindingIsLocked", kind = INTERNAL, parameterNames = {"sym", "env"}) public abstract static class BindingIsLocked extends RBuiltinNode { @Specialization - public Object bindingIsLocked(String sym, REnvironment env) { + protected Object bindingIsLocked(String sym, REnvironment env) { controlVisibility(); return RDataFactory.createLogicalVectorFromScalar(env.bindingIsLocked(sym)); } @@ -328,7 +328,7 @@ public class EnvFunctions { public abstract static class MakeActiveBinding extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object makeActiveBinding(Object sym, Object fun, Object env) { + protected Object makeActiveBinding(Object sym, Object fun, Object env) { // TODO implement controlVisibility(); throw RError.nyi(getEncapsulatingSourceSection(), "makeActiveBinding not implemented"); @@ -339,7 +339,7 @@ public class EnvFunctions { public abstract static class BindingIsActive extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object bindingIsActive(Object sym, Object fun, Object env) { + protected Object bindingIsActive(Object sym, Object fun, Object env) { // TODO implement controlVisibility(); return RDataFactory.createLogicalVectorFromScalar(false); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java index 210d0460932356d36ee37ab3574972b26c40eac0..03efc9ffa40a9d4cf311aac79a37706262b8a012 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EvalFunctions.java @@ -129,12 +129,12 @@ public class EvalFunctions { public abstract static class Eval extends EvalAdapter { @Specialization - public Object doEval(VirtualFrame frame, Object expr, @SuppressWarnings("unused") RMissing envir, @SuppressWarnings("unused") RMissing enclos) { + protected Object doEval(VirtualFrame frame, Object expr, @SuppressWarnings("unused") RMissing envir, @SuppressWarnings("unused") RMissing enclos) { return doEvalBodyInCallerFrame(frame, expr); } @Specialization - public Object doEval(VirtualFrame frame, Object expr, REnvironment envir, RMissing enclos) { + protected Object doEval(VirtualFrame frame, Object expr, REnvironment envir, RMissing enclos) { controlVisibility(); return doEvalBody(frame, expr, envir, enclos); } @@ -145,12 +145,12 @@ public class EvalFunctions { public abstract static class EvalQuote extends EvalAdapter { @Specialization - public Object doEval(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") RMissing envir, @SuppressWarnings("unused") RMissing enclos) { + protected Object doEval(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") RMissing envir, @SuppressWarnings("unused") RMissing enclos) { return doEvalBodyInCallerFrame(frame, RDataFactory.createLanguage(expr.getRep())); } @Specialization - public Object doEval(VirtualFrame frame, RPromise expr, REnvironment envir, RMissing enclos) { + protected Object doEval(VirtualFrame frame, RPromise expr, REnvironment envir, RMissing enclos) { /* * evalq does not evaluate it's first argument */ @@ -175,12 +175,12 @@ public class EvalFunctions { } @Specialization - public Object doEval(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") RMissing envir, RMissing enclos) { + protected Object doEval(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") RMissing envir, RMissing enclos) { return doEval(frame, expr, new REnvironment.NewEnv(REnvironment.frameToEnvironment(frame.materialize()), 0), enclos); } @Specialization - public Object doEval(VirtualFrame frame, RPromise expr, REnvironment envir, RMissing enclos) { + protected Object doEval(VirtualFrame frame, RPromise expr, REnvironment envir, RMissing enclos) { /* * local does not evaluate it's first argument */ diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Exists.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Exists.java index 24d8f6d5a7d3a23762076b09dfde2abaeb004c71..342af9245a47776c6cf3533689c62a131a01714f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Exists.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Exists.java @@ -50,7 +50,7 @@ public abstract class Exists extends RBuiltinNode { @Specialization(guards = "noEnv") @SuppressWarnings("unused") - public byte existsString(VirtualFrame frm, String name, int where, RMissing envir, Object frame, String mode, byte inherits) { + protected byte existsString(VirtualFrame frm, String name, int where, RMissing envir, Object frame, String mode, byte inherits) { controlVisibility(); if (getNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -66,7 +66,7 @@ public abstract class Exists extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public byte existsStringEnv(String name, REnvironment where, RMissing envir, Object frame, String mode, byte inherits) { + protected byte existsStringEnv(String name, REnvironment where, RMissing envir, Object frame, String mode, byte inherits) { controlVisibility(); if (inherits == RRuntime.LOGICAL_FALSE) { return RRuntime.asLogical(where.get(name) != null); @@ -80,19 +80,19 @@ public abstract class Exists extends RBuiltinNode { } @Specialization - public byte existsStringEnv(RStringVector name, REnvironment where, RMissing envir, Object frame, String mode, byte inherits) { + protected byte existsStringEnv(RStringVector name, REnvironment where, RMissing envir, Object frame, String mode, byte inherits) { controlVisibility(); return existsStringEnv(name.getDataAt(0), where, envir, frame, mode, inherits); } @Specialization - public byte existsStringEnv(String name, @SuppressWarnings("unused") int where, REnvironment envir, Object frame, String mode, byte inherits) { + protected byte existsStringEnv(String name, @SuppressWarnings("unused") int where, REnvironment envir, Object frame, String mode, byte inherits) { controlVisibility(); return existsStringEnv(name, envir, RMissing.instance, frame, mode, inherits); } @Specialization - public byte existsStringEnv(RStringVector name, int where, REnvironment envir, Object frame, String mode, byte inherits) { + protected byte existsStringEnv(RStringVector name, int where, REnvironment envir, Object frame, String mode, byte inherits) { controlVisibility(); return existsStringEnv(name.getDataAt(0), where, envir, frame, mode, inherits); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Expression.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Expression.java index 59c4993087a8aadf847115dc87f24ba08b6fe41e..4ad86b6c24f47dbdca49075cac8014359c925223 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Expression.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Expression.java @@ -37,7 +37,7 @@ public abstract class Expression extends RBuiltinNode { */ @Specialization - public Object doExpression(Object[] args) { + protected Object doExpression(Object[] args) { RLanguage[] data = new RLanguage[args.length]; for (int i = 0; i < args.length; i++) { data[i] = convert((RPromise) args[i]); @@ -47,7 +47,7 @@ public abstract class Expression extends RBuiltinNode { } @Specialization - public Object doExpression(RPromise language) { + protected Object doExpression(RPromise language) { RList list = RDataFactory.createList(new Object[]{convert(language)}); return RDataFactory.createExpression(list); } 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 3df487de6bef564d04779123bed1aac8915ca21f..ee343c58a74f99c3f4b846d545c0b937ba8e3055 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 @@ -50,7 +50,7 @@ public class FileFunctions { } @Specialization - public Object doFileCreate(RAbstractStringVector vec, byte showWarnings) { + protected Object doFileCreate(RAbstractStringVector vec, byte showWarnings) { controlVisibility(); byte[] status = new byte[vec.getLength()]; for (int i = 0; i < status.length; i++) { @@ -74,7 +74,7 @@ public class FileFunctions { } @Specialization - public Object doFileCreate(VirtualFrame frame, @SuppressWarnings("unused") Object x, @SuppressWarnings("unused") Object y) { + protected Object doFileCreate(VirtualFrame frame, @SuppressWarnings("unused") Object x, @SuppressWarnings("unused") Object y) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "file"); } @@ -87,7 +87,7 @@ public class FileFunctions { @SuppressWarnings("unused") @Specialization - public RList doFileInfo(RAbstractStringVector vec) { + protected RList doFileInfo(RAbstractStringVector vec) { // TODO fill out all fields, create data frame, handle multiple files controlVisibility(); int vecLength = vec.getLength(); @@ -118,7 +118,7 @@ public class FileFunctions { } } - abstract static class FileLinkAdaptor extends RBuiltinNode { + public abstract static class FileLinkAdaptor extends RBuiltinNode { protected Object doFileLink(VirtualFrame frame, RAbstractStringVector vecFrom, RAbstractStringVector vecTo, boolean symbolic) { int lenFrom = vecFrom.getLength(); int lenTo = vecTo.getLength(); @@ -159,13 +159,13 @@ public class FileFunctions { @RBuiltin(name = "file.link", kind = INTERNAL, parameterNames = {"from", "to"}) public abstract static class FileLink extends FileLinkAdaptor { @Specialization - public Object doFileLink(VirtualFrame frame, RAbstractStringVector vecFrom, RAbstractStringVector vecTo) { + protected Object doFileLink(VirtualFrame frame, RAbstractStringVector vecFrom, RAbstractStringVector vecTo) { controlVisibility(); return doFileLink(frame, vecFrom, vecTo, false); } @Specialization - public Object doFileLink(VirtualFrame frame, @SuppressWarnings("unused") Object from, @SuppressWarnings("unused") Object to) { + protected Object doFileLink(VirtualFrame frame, @SuppressWarnings("unused") Object from, @SuppressWarnings("unused") Object to) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "file"); } @@ -174,13 +174,13 @@ public class FileFunctions { @RBuiltin(name = "file.symlink", kind = INTERNAL, parameterNames = {"from", "to"}) public abstract static class FileSymLink extends FileLinkAdaptor { @Specialization - public Object doFileSymLink(VirtualFrame frame, RAbstractStringVector vecFrom, RAbstractStringVector vecTo) { + protected Object doFileSymLink(VirtualFrame frame, RAbstractStringVector vecFrom, RAbstractStringVector vecTo) { controlVisibility(); return doFileLink(frame, vecFrom, vecTo, true); } @Specialization - public Object doFileSymLink(VirtualFrame frame, @SuppressWarnings("unused") Object from, @SuppressWarnings("unused") Object to) { + protected Object doFileSymLink(VirtualFrame frame, @SuppressWarnings("unused") Object from, @SuppressWarnings("unused") Object to) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "file"); } @@ -190,7 +190,7 @@ public class FileFunctions { public abstract static class FileRemove extends RBuiltinNode { @Specialization - public Object doFileRemove(RAbstractStringVector vec) { + protected Object doFileRemove(RAbstractStringVector vec) { controlVisibility(); byte[] status = new byte[vec.getLength()]; for (int i = 0; i < status.length; i++) { @@ -210,7 +210,7 @@ public class FileFunctions { } @Specialization - public Object doFileRemove(VirtualFrame frame, @SuppressWarnings("unused") Object x) { + protected Object doFileRemove(VirtualFrame frame, @SuppressWarnings("unused") Object x) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "file"); } @@ -219,7 +219,7 @@ public class FileFunctions { @RBuiltin(name = "file.rename", kind = INTERNAL, parameterNames = {"from", "to"}) public abstract static class FileRename extends RBuiltinNode { @Specialization - public Object doFileRename(VirtualFrame frame, RAbstractStringVector vecFrom, RAbstractStringVector vecTo) { + protected Object doFileRename(VirtualFrame frame, RAbstractStringVector vecFrom, RAbstractStringVector vecTo) { controlVisibility(); int len = vecFrom.getLength(); if (len != vecTo.getLength()) { @@ -245,7 +245,7 @@ public class FileFunctions { } @Specialization - public Object doFileRename(VirtualFrame frame, @SuppressWarnings("unused") Object from, @SuppressWarnings("unused") Object to) { + protected Object doFileRename(VirtualFrame frame, @SuppressWarnings("unused") Object from, @SuppressWarnings("unused") Object to) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "file"); } @@ -255,7 +255,7 @@ public class FileFunctions { public abstract static class FileExists extends RBuiltinNode { @Specialization - public Object doFileExists(RAbstractStringVector vec) { + protected Object doFileExists(RAbstractStringVector vec) { controlVisibility(); byte[] status = new byte[vec.getLength()]; for (int i = 0; i < status.length; i++) { @@ -269,11 +269,10 @@ public class FileFunctions { } } return RDataFactory.createLogicalVector(status, RDataFactory.COMPLETE_VECTOR); - } @Specialization - public Object doFileExists(VirtualFrame frame, @SuppressWarnings("unused") Object vec) { + protected Object doFileExists(VirtualFrame frame, @SuppressWarnings("unused") Object vec) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "file"); } @@ -291,7 +290,7 @@ public class FileFunctions { // @formatter:off @SuppressWarnings("unused") @Specialization - public RStringVector doListFiles(VirtualFrame frame, RAbstractStringVector vec, RAbstractStringVector patternVec, byte allFiles, byte fullNames, byte recursive, + protected RStringVector doListFiles(VirtualFrame frame, RAbstractStringVector vec, RAbstractStringVector patternVec, byte allFiles, byte fullNames, byte recursive, byte ignoreCase, byte includeDirs, byte noDotDot) { // pattern in first element of vector, remaining elements are ignored (as per GnuR). String patternString = patternVec.getLength() == 0 ? "" : patternVec.getDataAt(0); @@ -343,17 +342,17 @@ public class FileFunctions { @SuppressWarnings("unused") @Specialization(guards = "lengthZero") - public RStringVector doFilePathZero(RAbstractStringVector vec, String fsep) { + protected RStringVector doFilePathZero(RAbstractStringVector vec, String fsep) { return RDataFactory.createEmptyStringVector(); } @Specialization(guards = "!lengthZero") - public RStringVector doFilePath(RAbstractStringVector vec, String fsep) { + protected RStringVector doFilePath(RAbstractStringVector vec, String fsep) { return doFilePath(new Object[]{vec}, fsep); } @Specialization(guards = "simpleArgs") - public RStringVector doFilePath(Object[] args, String fsep) { + protected RStringVector doFilePath(Object[] args, String fsep) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < args.length; i++) { Object elem = args[i]; @@ -405,12 +404,11 @@ public class FileFunctions { } return true; } - } - private abstract static class XyzNameAdapter extends RBuiltinNode { - abstract static class PathFunction { - abstract String invoke(FileSystem fileSystem, String name); + public abstract static class XyzNameAdapter extends RBuiltinNode { + public abstract static class PathFunction { + protected abstract String invoke(FileSystem fileSystem, String name); } protected RStringVector doXyzName(RAbstractStringVector vec, PathFunction fun) { @@ -431,7 +429,6 @@ public class FileFunctions { } return RDataFactory.createStringVector(data, complete); - } } @@ -440,18 +437,17 @@ public class FileFunctions { private static class ParentPathFunction extends XyzNameAdapter.PathFunction { @Override - String invoke(FileSystem fileSystem, String name) { + protected String invoke(FileSystem fileSystem, String name) { Path path = fileSystem.getPath(Utils.tildeExpand(name)); Path parent = path.getParent(); return parent != null ? parent.toString() : name; } - } private static final ParentPathFunction parentPathFunction = new ParentPathFunction(); @Specialization - public RStringVector doDirName(RAbstractStringVector vec) { + protected RStringVector doDirName(RAbstractStringVector vec) { return doXyzName(vec, parentPathFunction); } } @@ -461,18 +457,17 @@ public class FileFunctions { private static class BasePathFunction extends XyzNameAdapter.PathFunction { @Override - String invoke(FileSystem fileSystem, String name) { + protected String invoke(FileSystem fileSystem, String name) { Path path = fileSystem.getPath(name); Path parent = path.getFileName(); return parent != null ? parent.toString() : name; } - } private static final BasePathFunction basePathFunction = new BasePathFunction(); @Specialization - public RStringVector doDirName(RAbstractStringVector vec) { + protected RStringVector doDirName(RAbstractStringVector vec) { return doXyzName(vec, basePathFunction); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Force.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Force.java index 96e210be72dc730d5b304de4f25f8cf8b3444f83..a6664841b7ef5fb28e310af02b25761cad4917b5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Force.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Force.java @@ -35,7 +35,7 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class Force extends RBuiltinNode { @Specialization - Object force(@SuppressWarnings("unused") VirtualFrame frame, Object arg) { + protected Object force(@SuppressWarnings("unused") VirtualFrame frame, Object arg) { if (arg instanceof RPromise) { RPromise promise = (RPromise) arg; if (promise.isEvaluated()) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ForeignFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ForeignFunctions.java index 41645c3723565b343c0a45be061ebb33ccd17ead..bbbe49061dbc7086e51321f056ffa1e305383419 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ForeignFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ForeignFunctions.java @@ -86,7 +86,7 @@ public class ForeignFunctions { @SuppressWarnings("unused") @Specialization(guards = "dqrdc2") - public RList fortranDqrdc2(VirtualFrame frame, String f, Object[] args, byte naok, byte dup, RMissing rPackage, RMissing encoding) { + protected RList fortranDqrdc2(VirtualFrame frame, String f, Object[] args, byte naok, byte dup, RMissing rPackage, RMissing encoding) { controlVisibility(); try { RDoubleVector xVec = (RDoubleVector) args[0]; @@ -127,7 +127,7 @@ public class ForeignFunctions { @SuppressWarnings("unused") @Specialization(guards = "dqrcf") - public RList fortranDqrcf(VirtualFrame frame, String f, Object[] args, byte naok, byte dup, RMissing rPackage, RMissing encoding) { + protected RList fortranDqrcf(VirtualFrame frame, String f, Object[] args, byte naok, byte dup, RMissing rPackage, RMissing encoding) { controlVisibility(); try { RDoubleVector xVec = (RDoubleVector) args[0]; @@ -185,7 +185,7 @@ public class ForeignFunctions { @SuppressWarnings("unused") @Specialization - public RList c(VirtualFrame frame, String f, Object[] args, byte naok, byte dup, RMissing rPackage, RMissing encoding) { + protected RList c(VirtualFrame frame, String f, Object[] args, byte naok, byte dup, RMissing rPackage, RMissing encoding) { controlVisibility(); SymbolInfo symbolInfo = DLL.findSymbolInfo(f, null); if (symbolInfo == null) { @@ -318,7 +318,7 @@ public class ForeignFunctions { // TODO: handle more argument types (this is sufficient to run the b25 benchmarks) @SuppressWarnings("unused") @Specialization(guards = "fft") - public RComplexVector callFFT(VirtualFrame frame, RList f, Object[] args) { + protected RComplexVector callFFT(VirtualFrame frame, RList f, Object[] args) { controlVisibility(); RComplexVector zVec = (RComplexVector) castComplex(frame, castVector(frame, args[0])); double[] z = zVec.isTemporary() ? zVec.getDataWithoutCopying() : zVec.getDataCopy(); @@ -398,7 +398,7 @@ public class ForeignFunctions { // Translated from GnuR: library/methods/src/methods_list_dispatch.c @SuppressWarnings("unused") @Specialization(guards = "methodsPackageMetaName") - public String callMethodsPackageMetaName(VirtualFrame frame, RList f, Object[] args) { + protected String callMethodsPackageMetaName(VirtualFrame frame, RList f, Object[] args) { controlVisibility(); // TODO proper error checks String prefixString = (String) args[0]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Formals.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Formals.java index 5b2b98bb8af673305683e3fc897f92a4ad02b598..927cf3169f1d9a614e76b909c42a3ee408c1cfea 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Formals.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Formals.java @@ -33,7 +33,7 @@ import com.oracle.truffle.r.runtime.data.*; // TODO revert to INTERNAL when promises are lazy public abstract class Formals extends RBuiltinNode { @Specialization - public Object formals(Object funObj) { + protected Object formals(Object funObj) { controlVisibility(); if (funObj instanceof RFunction) { RFunction fun = (RFunction) funObj; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Format.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Format.java index ef721a42fe9ffc50dca70d77e206b83972554792..c1f482e95e7397cb34d20a6c1934d4a9a0b814f7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Format.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Format.java @@ -87,7 +87,7 @@ public abstract class Format extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "wrongArgsObject") - String formatWrongArgs(Object value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, RLogicalVector naEncodeVec, + protected String formatWrongArgs(Object value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, RLogicalVector naEncodeVec, RLogicalVector sciVec) { return null; } @@ -96,7 +96,7 @@ public abstract class Format extends RBuiltinNode { // types following suit at some point for compliance @SlowPath - RStringVector convertToString(RAbstractLogicalVector value) { + private static RStringVector convertToString(RAbstractLogicalVector value) { int width = formatLogical(value); String[] data = new String[value.getLength()]; for (int i = 0; i < data.length; i++) { @@ -108,7 +108,7 @@ public abstract class Format extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "!wrongArgs") - RStringVector format(VirtualFrame frame, RAbstractLogicalVector value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, + protected RStringVector format(VirtualFrame frame, RAbstractLogicalVector value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, RLogicalVector naEncodeVec, RAbstractVector sciVec) { if (value.getLength() == 0) { return RDataFactory.createEmptyStringVector(); @@ -117,7 +117,7 @@ public abstract class Format extends RBuiltinNode { } } - int formatLogical(RAbstractLogicalVector value) { + private static int formatLogical(RAbstractLogicalVector value) { int width = 1; for (int i = 0; i < value.getLength(); i++) { byte val = value.getDataAt(i); @@ -144,7 +144,7 @@ public abstract class Format extends RBuiltinNode { } @SlowPath - RStringVector convertToString(RAbstractIntVector value) { + private static RStringVector convertToString(RAbstractIntVector value) { String[] data = new String[value.getLength()]; int width = 0; int widthChanges = 0; @@ -164,7 +164,7 @@ public abstract class Format extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "!wrongArgs") - RStringVector format(VirtualFrame frame, RAbstractIntVector value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, + protected RStringVector format(VirtualFrame frame, RAbstractIntVector value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, RLogicalVector naEncodeVec, RAbstractVector sciVec) { if (value.getLength() == 0) { return RDataFactory.createEmptyStringVector(); @@ -196,7 +196,7 @@ public abstract class Format extends RBuiltinNode { } @SlowPath - RStringVector convertToString(RAbstractDoubleVector value) { + private static RStringVector convertToString(RAbstractDoubleVector value) { String[] data = new String[value.getLength()]; int width = 0; int widthChanges = 0; @@ -219,7 +219,7 @@ public abstract class Format extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "!wrongArgs") - RStringVector format(VirtualFrame frame, RAbstractDoubleVector value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, + protected RStringVector format(VirtualFrame frame, RAbstractDoubleVector value, RLogicalVector trimVec, RIntVector digitsVec, RIntVector nsmallVec, RIntVector widthVec, RIntVector justifyVec, RLogicalVector naEncodeVec, RAbstractVector sciVec) { byte trim = trimVec.getLength() > 0 ? trimVec.getDataAt(0) : RRuntime.LOGICAL_NA; int digits = digitsVec.getLength() > 0 ? digitsVec.getDataAt(0) : RRuntime.INT_NA; 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 966085718f9ea57808555b995ff3e1716db78651..42c86903a3a0b9dade2985048077d2585cb05a9b 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 @@ -68,8 +68,8 @@ public class FrameFunctions { @RBuiltin(name = "sys.nframe", kind = INTERNAL, parameterNames = {}) public abstract static class SysNFrame extends RBuiltinNode { - @Specialization() - public int sysNFrame() { + @Specialization + protected int sysNFrame() { controlVisibility(); return Utils.stackDepth(); } @@ -83,8 +83,8 @@ public class FrameFunctions { return new RNode[]{ConstantNode.create(0)}; } - @Specialization() - public REnvironment sysFrame(VirtualFrame frame, int nd) { + @Specialization + protected REnvironment sysFrame(VirtualFrame frame, int nd) { controlVisibility(); int n = nd; if (n == 0) { @@ -97,8 +97,8 @@ public class FrameFunctions { } } - @Specialization() - public REnvironment sysFrame(VirtualFrame frame, double nd) { + @Specialization + protected REnvironment sysFrame(VirtualFrame frame, double nd) { return sysFrame(frame, (int) nd); } } @@ -111,8 +111,8 @@ public class FrameFunctions { return new RNode[]{ConstantNode.create(1)}; } - @Specialization() - public int sysParent(int nd) { + @Specialization + protected int sysParent(int nd) { controlVisibility(); int n = nd; int d = Utils.stackDepth(); @@ -123,8 +123,8 @@ public class FrameFunctions { } } - @Specialization() - public int sysParent(double nd) { + @Specialization + protected int sysParent(double nd) { return sysParent((int) nd); } } @@ -137,8 +137,8 @@ public class FrameFunctions { return new RNode[]{ConstantNode.create(0)}; } - @Specialization() - public Object sysFunction(VirtualFrame frame, int nd) { + @Specialization + protected Object sysFunction(VirtualFrame frame, int nd) { controlVisibility(); int n = nd; // N.B. Despite the spec, n==0 is treated as the current function @@ -151,16 +151,16 @@ public class FrameFunctions { } } - @Specialization() - public Object sysFunction(VirtualFrame frame, double nd) { + @Specialization + protected Object sysFunction(VirtualFrame frame, double nd) { return sysFunction(frame, (int) nd); } } @RBuiltin(name = "sys.parents", kind = INTERNAL, parameterNames = {}) public abstract static class SysParents extends FrameHelper { - @Specialization() - public RIntVector sysParents() { + @Specialization + protected RIntVector sysParents() { controlVisibility(); int d = Utils.stackDepth(); int[] data = new int[d]; @@ -173,8 +173,8 @@ public class FrameFunctions { @RBuiltin(name = "sys.frames", kind = INTERNAL, parameterNames = {}) public abstract static class SysFrames extends FrameHelper { - @Specialization() - public Object sysFrames() { + @Specialization + protected Object sysFrames() { throw RError.nyi(null, "sys.frames is not implemented"); } } @@ -190,8 +190,8 @@ public class FrameFunctions { return new RNode[]{ConstantNode.create(1)}; } - @Specialization() - public REnvironment parentFrame(VirtualFrame frame, double nd) { + @Specialization + protected REnvironment parentFrame(VirtualFrame frame, double nd) { controlVisibility(); int n = (int) nd; if (n == 0) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Get.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Get.java index af4023eb0d0cb7927713feb37f7db564986c5d01..a00699533329d3a07fc236cd90fa8c71e9739905 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Get.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Get.java @@ -59,7 +59,7 @@ public abstract class Get extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object get(VirtualFrame frame, String x, int pos, RMissing envir, String mode, byte inherits) { + protected Object get(VirtualFrame frame, String x, int pos, RMissing envir, String mode, byte inherits) { controlVisibility(); boolean doesInherit = inherits == RRuntime.LOGICAL_TRUE; ReadVariableNode lookup = null; @@ -89,7 +89,7 @@ public abstract class Get extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object get(VirtualFrame frame, RAbstractStringVector x, REnvironment pos, RMissing envir, String mode, byte inherits) { + protected Object get(VirtualFrame frame, RAbstractStringVector x, REnvironment pos, RMissing envir, String mode, byte inherits) { controlVisibility(); String sx = x.getDataAt(0); REnvironment env = pos; @@ -111,7 +111,7 @@ public abstract class Get extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object get(VirtualFrame frame, RAbstractStringVector x, int pos, REnvironment envir, String mode, byte inherits) { + protected Object get(VirtualFrame frame, RAbstractStringVector x, int pos, REnvironment envir, String mode, byte inherits) { return get(frame, x, envir, RMissing.instance, mode, inherits); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetClass.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetClass.java index a34b17337f9df3c51715c6aeb45446371b6b735f..1e12b06996fe18351555c77b5e405ab40cbe3420 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetClass.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetClass.java @@ -23,13 +23,13 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class GetClass extends RBuiltinNode { @Specialization(guards = "isObject") - public Object getClassForObject(RAbstractContainer arg) { + protected Object getClassForObject(RAbstractContainer arg) { controlVisibility(); return arg.getClassHierarchy(); } @Specialization(guards = "!isObject") - public Object getClass(RAbstractContainer arg) { + protected Object getClass(RAbstractContainer arg) { controlVisibility(); final String klass = arg.getClassHierarchy().getDataAt(0); if (klass.equals(RRuntime.TYPE_DOUBLE)) { @@ -39,43 +39,43 @@ public abstract class GetClass extends RBuiltinNode { } @Specialization - public Object getClass(@SuppressWarnings("unused") RFunction arg) { + protected Object getClass(@SuppressWarnings("unused") RFunction arg) { controlVisibility(); return RRuntime.TYPE_FUNCTION; } @Specialization - public Object getClass(@SuppressWarnings("unused") RFormula arg) { + protected Object getClass(@SuppressWarnings("unused") RFormula arg) { controlVisibility(); return RRuntime.TYPE_FORMULA; } @Specialization - public Object getClass(@SuppressWarnings("unused") RNull arg) { + protected Object getClass(@SuppressWarnings("unused") RNull arg) { controlVisibility(); return RRuntime.NULL; } @Specialization - public Object getClass(@SuppressWarnings("unused") RSymbol arg) { + protected Object getClass(@SuppressWarnings("unused") RSymbol arg) { controlVisibility(); return RRuntime.CLASS_SYMBOL; } @Specialization - public Object getClass(@SuppressWarnings("unused") REnvironment arg) { + protected Object getClass(@SuppressWarnings("unused") REnvironment arg) { controlVisibility(); return RRuntime.TYPE_ENVIRONMENT; } @Specialization - public Object getClass(@SuppressWarnings("unused") RPairList arg) { + protected Object getClass(@SuppressWarnings("unused") RPairList arg) { controlVisibility(); return RRuntime.TYPE_PAIR_LIST; } @Specialization - public Object getClass(@SuppressWarnings("unused") RLanguage arg) { + protected Object getClass(@SuppressWarnings("unused") RLanguage arg) { controlVisibility(); return RRuntime.CLASS_LANGUAGE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetOldClass.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetOldClass.java index 1a8f66efbfbb1b0567a31b548f6191442f38019e..c3913db3d748fb30607b28cec0e9a9d7c1207b6a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetOldClass.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetOldClass.java @@ -35,7 +35,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class GetOldClass extends RBuiltinNode { @Specialization - public Object getOldClass(RAbstractContainer arg) { + protected Object getOldClass(RAbstractContainer arg) { controlVisibility(); if (arg.isObject()) { return arg.getClassHierarchy(); @@ -45,7 +45,7 @@ public abstract class GetOldClass extends RBuiltinNode { } @Specialization - public Object getOldClass(@SuppressWarnings("unused") RFunction arg) { + protected Object getOldClass(@SuppressWarnings("unused") RFunction arg) { controlVisibility(); return RNull.instance; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetText.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetText.java index d8fbd34d88f8c67d4f57d346cd7f8bb8ce442a2d..b4381cba8fcd7edbd3cc0898dc20a82386f56399 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetText.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GetText.java @@ -43,7 +43,7 @@ public abstract class GetText extends RBuiltinNode { } @Specialization - RAbstractVector getText(RAbstractVector vector, Object domain) { + protected RAbstractVector getText(RAbstractVector vector, Object domain) { // no translation done at this point return vector; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Getwd.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Getwd.java index d6ff4a1d198d00b1b9416ede86841d89523a40e9..ec42054a7366bc845fbf3cdcd689c4eecbea559e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Getwd.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Getwd.java @@ -34,7 +34,7 @@ import com.oracle.truffle.r.runtime.ffi.*; public abstract class Getwd extends RBuiltinNode { @Specialization - public Object getwd() { + protected Object getwd() { controlVisibility(); String result = RFFIFactory.getRFFI().getBaseRFFI().getwd(); return RDataFactory.createStringVector(result); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java index 2c4962bbb54871e7173a25b29b2019ce2ab4c859..e302a62c9aa1399c8f67416656fba5c330af5638 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java @@ -100,7 +100,7 @@ public class GrepFunctions { } @Specialization - public RIntVector grep(String patternArg, RAbstractStringVector vector, byte ignoreCase, byte value, byte perl, byte fixed, byte useBytes, byte invert) { + protected RIntVector grep(String patternArg, RAbstractStringVector vector, byte ignoreCase, byte value, byte perl, byte fixed, byte useBytes, byte invert) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, invert); valueCheck(value); @@ -148,7 +148,7 @@ public class GrepFunctions { } @Specialization - public Object grep(String patternArg, RAbstractStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected Object grep(String patternArg, RAbstractStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); String pattern = RegExp.checkPreDefinedClasses(patternArg); @@ -172,7 +172,7 @@ public class GrepFunctions { } @Specialization - public String sub(String patternArg, String replacement, String x, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected String sub(String patternArg, String replacement, String x, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); String pattern = RegExp.checkPreDefinedClasses(patternArg); @@ -180,7 +180,7 @@ public class GrepFunctions { } @Specialization - public RStringVector sub(String patternArg, String replacement, RStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected RStringVector sub(String patternArg, String replacement, RStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); String pattern = RegExp.checkPreDefinedClasses(patternArg); @@ -188,7 +188,7 @@ public class GrepFunctions { } @Specialization - public RStringVector sub(RStringVector patternArg, String replacement, RStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected RStringVector sub(RStringVector patternArg, String replacement, RStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); // FIXME print a warning that only pattern[1] is used @@ -197,7 +197,7 @@ public class GrepFunctions { } @Specialization - public RStringVector sub(String patternArg, RStringVector replacement, RStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected RStringVector sub(String patternArg, RStringVector replacement, RStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); // FIXME print a warning that only replacement[1] is used @@ -233,7 +233,7 @@ public class GrepFunctions { @Specialization @Override - public String sub(String patternArg, String replacement, String x, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected String sub(String patternArg, String replacement, String x, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); String pattern = RegExp.checkPreDefinedClasses(patternArg); @@ -241,7 +241,7 @@ public class GrepFunctions { } @Specialization - public String sub(RAbstractStringVector patternArg, RAbstractStringVector replacement, RAbstractStringVector x, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected String sub(RAbstractStringVector patternArg, RAbstractStringVector replacement, RAbstractStringVector x, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); String pattern = RegExp.checkPreDefinedClasses(patternArg.getDataAt(0)); @@ -267,10 +267,10 @@ public class GrepFunctions { } @Specialization - public Object regexp(String patternArg, RAbstractStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected Object regexp(RAbstractStringVector patternArg, RAbstractStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); - String pattern = RegExp.checkPreDefinedClasses(patternArg); + String pattern = RegExp.checkPreDefinedClasses(patternArg.getDataAt(0)); int[] result = new int[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { result[i] = findIndex(pattern, vector.getDataAt(i)).get(0); @@ -310,10 +310,10 @@ public class GrepFunctions { @Specialization @Override - public Object regexp(String patternArg, RAbstractStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { + protected Object regexp(RAbstractStringVector patternArg, RAbstractStringVector vector, byte ignoreCase, byte perl, byte fixed, byte useBytes) { controlVisibility(); checkExtraArgs(ignoreCase, perl, fixed, useBytes, RRuntime.LOGICAL_FALSE); - String pattern = RegExp.checkPreDefinedClasses(patternArg); + String pattern = RegExp.checkPreDefinedClasses(patternArg.getDataAt(0)); Object[] result = new Object[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { int[] data = toIntArray(findIndex(pattern, vector.getDataAt(i))); @@ -345,7 +345,7 @@ public class GrepFunctions { @SuppressWarnings("unused") @Specialization - public Object aGrep(String patternArg, RAbstractStringVector vector, byte ignoreCase, byte value, RIntVector costs, RDoubleVector bounds, byte useBytes, byte fixed) { + protected Object aGrep(RAbstractStringVector patternArg, RAbstractStringVector vector, byte ignoreCase, byte value, RIntVector costs, RDoubleVector bounds, byte useBytes, byte fixed) { // TODO implement properly, this only supports strict equality! controlVisibility(); checkExtraArgs(ignoreCase, RRuntime.LOGICAL_FALSE, RRuntime.LOGICAL_FALSE, useBytes, RRuntime.LOGICAL_FALSE); @@ -355,8 +355,9 @@ public class GrepFunctions { } int[] tmp = new int[vector.getLength()]; int numMatches = 0; + String pattern = patternArg.getDataAt(0); for (int i = 0; i < vector.getLength(); i++) { - if (patternArg.equals(vector.getDataAt(i))) { + if (pattern.equals(vector.getDataAt(i))) { tmp[i] = i + 1; numMatches++; } @@ -383,13 +384,14 @@ public class GrepFunctions { @SuppressWarnings("unused") @Specialization - public Object aGrep(String patternArg, RAbstractStringVector vector, byte ignoreCase, RIntVector costs, RDoubleVector bounds, byte useBytes, byte fixed) { + protected Object aGrep(RAbstractStringVector patternArg, RAbstractStringVector vector, byte ignoreCase, RIntVector costs, RDoubleVector bounds, byte useBytes, byte fixed) { // TODO implement properly, this only supports strict equality! controlVisibility(); checkExtraArgs(ignoreCase, RRuntime.LOGICAL_FALSE, RRuntime.LOGICAL_FALSE, useBytes, RRuntime.LOGICAL_FALSE); byte[] data = new byte[vector.getLength()]; + String pattern = patternArg.getDataAt(0); for (int i = 0; i < vector.getLength(); i++) { - data[i] = RRuntime.asLogical(patternArg.equals(vector.getDataAt(i))); + data[i] = RRuntime.asLogical(pattern.equals(vector.getDataAt(i))); } return RDataFactory.createLogicalVector(data, RDataFactory.COMPLETE_VECTOR); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java index 2960e6e146c3a170b758d814105167517e124b47..beadf648a18e11a63086a8b96513dff31bfe1e2a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java @@ -61,7 +61,7 @@ public class HiddenInternalFunctions { * modified call in the {@code eenv} environment. */ @Specialization - public RNull doMakeLazy(VirtualFrame frame, RAbstractStringVector names, RList values, RLanguage expr, REnvironment eenv, REnvironment aenv) { + protected RNull doMakeLazy(VirtualFrame frame, RAbstractStringVector names, RList values, RLanguage expr, REnvironment eenv, REnvironment aenv) { controlVisibility(); initEval(); for (int i = 0; i < names.getLength(); i++) { @@ -92,7 +92,7 @@ public class HiddenInternalFunctions { @RBuiltin(name = "importIntoEnv", kind = INTERNAL, parameterNames = {"impEnv", "impNames", "expEnv", "expNames"}) public abstract static class ImportIntoEnv extends RBuiltinNode { @Specialization - public RNull importIntoEnv(VirtualFrame frame, REnvironment impEnv, RAbstractStringVector impNames, REnvironment expEnv, RAbstractStringVector expNames) { + protected RNull importIntoEnv(VirtualFrame frame, REnvironment impEnv, RAbstractStringVector impNames, REnvironment expEnv, RAbstractStringVector expNames) { controlVisibility(); int length = impNames.getLength(); if (length != expNames.getLength()) { @@ -142,7 +142,7 @@ public class HiddenInternalFunctions { * No error checking here as this called by trusted library code. */ @Specialization - public Object lazyLoadDBFetch(VirtualFrame frame, RIntVector key, RStringVector datafile, RIntVector compressed, RFunction envhook) { + protected Object lazyLoadDBFetch(VirtualFrame frame, RIntVector key, RStringVector datafile, RIntVector compressed, RFunction envhook) { String dbPath = datafile.getDataAt(0); byte[] dbData = dbCache.get(dbPath); if (dbData == null) { @@ -187,7 +187,7 @@ public class HiddenInternalFunctions { } @Specialization - public Object lazyLoadDBFetch(VirtualFrame frame, RIntVector key, RStringVector datafile, RLogicalVector compressed, RFunction envhook) { + protected Object lazyLoadDBFetch(VirtualFrame frame, RIntVector key, RStringVector datafile, RLogicalVector compressed, RFunction envhook) { initCast(); return lazyLoadDBFetch(frame, key, datafile, castIntNode.doLogicalVector(compressed), envhook); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Identical.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Identical.java index 739f07be57523467b42074ad6ec4844521cc198a..6cb8b564e1d2be0a60ce2f9b0605d7a706cb7161 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Identical.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Identical.java @@ -45,7 +45,7 @@ public abstract class Identical extends RBuiltinNode { } @Specialization - public byte doInternalIdentical(byte x, byte y, + protected byte doInternalIdentical(byte x, byte y, // @formatter:off @SuppressWarnings("unused") byte numEq, @SuppressWarnings("unused") byte singleNA, @SuppressWarnings("unused") byte attribAsSet, @SuppressWarnings("unused") byte ignoreBytecode, @SuppressWarnings("unused") byte ignoreEnvironment) { @@ -55,7 +55,7 @@ public abstract class Identical extends RBuiltinNode { } @Specialization - public byte doInternalIdential(String x, String y, + protected byte doInternalIdential(String x, String y, // @formatter:off @SuppressWarnings("unused") byte numEq, @SuppressWarnings("unused") byte singleNA, @SuppressWarnings("unused") byte attribAsSet, @SuppressWarnings("unused") byte ignoreBytecode, @SuppressWarnings("unused") byte ignoreEnvironment) { @@ -65,7 +65,7 @@ public abstract class Identical extends RBuiltinNode { } @Specialization - public byte doInternalIdentical(double x, double y, + protected byte doInternalIdentical(double x, double y, // @formatter:off byte numEq, @SuppressWarnings("unused") byte singleNA, @SuppressWarnings("unused") byte attribAsSet, @SuppressWarnings("unused") byte ignoreBytecode, @SuppressWarnings("unused") byte ignoreEnvironment) { @@ -76,7 +76,7 @@ public abstract class Identical extends RBuiltinNode { } @Specialization - public byte doInternalIdentical(REnvironment x, REnvironment y, + protected byte doInternalIdentical(REnvironment x, REnvironment y, // @formatter:off @SuppressWarnings("unused") byte numEq, @SuppressWarnings("unused") byte singleNA, @SuppressWarnings("unused") byte attribAsSet, @SuppressWarnings("unused") byte ignoreBytecode, @SuppressWarnings("unused") byte ignoreEnvironment) { @@ -87,7 +87,7 @@ public abstract class Identical extends RBuiltinNode { } @Specialization(guards = "!vectorsLists") - public byte doInternalIdentialGeneric(RAbstractVector x, RAbstractVector y, + protected byte doInternalIdentialGeneric(RAbstractVector x, RAbstractVector y, // @formatter:off @SuppressWarnings("unused") byte numEq, @SuppressWarnings("unused") byte singleNA, @SuppressWarnings("unused") byte attribAsSet, @SuppressWarnings("unused") byte ignoreBytecode, @SuppressWarnings("unused") byte ignoreEnvironment) { @@ -105,7 +105,7 @@ public abstract class Identical extends RBuiltinNode { } @Specialization - public byte doInternalIdentialGeneric(@SuppressWarnings("unused") RList x, @SuppressWarnings("unused") RList y, + protected byte doInternalIdentialGeneric(@SuppressWarnings("unused") RList x, @SuppressWarnings("unused") RList y, // @formatter:off @SuppressWarnings("unused") byte numEq, @SuppressWarnings("unused") byte singleNA, @SuppressWarnings("unused") byte attribAsSet, @SuppressWarnings("unused") byte ignoreBytecode, @SuppressWarnings("unused") byte ignoreEnvironment) { @@ -115,7 +115,7 @@ public abstract class Identical extends RBuiltinNode { } @Specialization - public byte doInternalIdentialGeneric(@SuppressWarnings("unused") RDataFrame x, @SuppressWarnings("unused") RDataFrame y, + protected byte doInternalIdentialGeneric(@SuppressWarnings("unused") RDataFrame x, @SuppressWarnings("unused") RDataFrame y, // @formatter:off @SuppressWarnings("unused") byte numEq, @SuppressWarnings("unused") byte singleNA, @SuppressWarnings("unused") byte attribAsSet, @SuppressWarnings("unused") byte ignoreBytecode, @SuppressWarnings("unused") byte ignoreEnvironment) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ifelse.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ifelse.java index f0a46049953ccb51088fdbac46697c406282021f..9d73b210adda4d44137e7c8850986a95ab554b13 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ifelse.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ifelse.java @@ -43,43 +43,43 @@ public abstract class Ifelse extends RBuiltinNode { } @Specialization(guards = "isNA") - public byte ifelseNA(byte test, double yes, double no) { + protected byte ifelseNA(byte test, double yes, double no) { controlVisibility(); return RRuntime.LOGICAL_NA; } @Specialization(guards = "!isNA") - public double ifelse(byte test, double yes, double no) { + protected double ifelse(byte test, double yes, double no) { controlVisibility(); return test == RRuntime.LOGICAL_TRUE ? yes : no; } @Specialization(guards = "isNA") - public byte ifelseNA(byte test, int yes, int no) { + protected byte ifelseNA(byte test, int yes, int no) { controlVisibility(); return RRuntime.LOGICAL_NA; } @Specialization(guards = "!isNA") - public int ifelse(byte test, int yes, int no) { + protected int ifelse(byte test, int yes, int no) { controlVisibility(); return test == RRuntime.LOGICAL_TRUE ? yes : no; } @Specialization(guards = "isNA") - public byte ifelseNA(byte test, String yes, String no) { + protected byte ifelseNA(byte test, String yes, String no) { controlVisibility(); return RRuntime.LOGICAL_NA; } @Specialization(guards = "!isNA") - public String ifelse(byte test, String yes, String no) { + protected String ifelse(byte test, String yes, String no) { controlVisibility(); return test == RRuntime.LOGICAL_TRUE ? yes : no; } @Specialization - public RDoubleVector ifelse(RLogicalVector lvec, RDoubleVector dvec, double no) { + protected RDoubleVector ifelse(RLogicalVector lvec, RDoubleVector dvec, double no) { // just one special case for version.R assert lvec.getLength() == 1; double[] data = new double[]{lvec.getDataAt(0) == RRuntime.LOGICAL_TRUE ? dvec.getDataAt(0) : no}; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Im.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Im.java index 5f176434dc3f0c7ecbe6aa9986c4ab6c3e04cc4c..b7e3cbd48ec92a7c0b771e616e093532d3ede21f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Im.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Im.java @@ -40,7 +40,7 @@ public abstract class Im extends RBuiltinNode { private NACheck check = NACheck.create(); @Specialization - public RDoubleVector im(RAbstractComplexVector vector) { + protected RDoubleVector im(RAbstractComplexVector vector) { controlVisibility(); double[] result = new double[vector.getLength()]; check.enable(vector); @@ -52,9 +52,8 @@ public abstract class Im extends RBuiltinNode { } @Specialization - public RDoubleVector im(RAbstractDoubleVector vector) { + protected RDoubleVector im(RAbstractDoubleVector vector) { controlVisibility(); return RDataFactory.createDoubleVector(vector.getLength()); } - } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Inherits.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Inherits.java index 7f1e8baea65ea08b0fe8ad2ab4d2b0cc5c1aed87..240b068944cb19c186b022005797ab94f3defc71 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Inherits.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Inherits.java @@ -44,20 +44,32 @@ public abstract class Inherits extends RBuiltinNode { return inheritsNode; } + @SuppressWarnings("unused") + @Specialization + protected Object doesInherit(RNull x, RAbstractStringVector what, byte which) { + return RRuntime.LOGICAL_FALSE; + } + + @SuppressWarnings("unused") + @Specialization + protected Object doesInherit(REnvironment x, RAbstractStringVector what, byte which) { + return RRuntime.LOGICAL_FALSE; + } + @SuppressWarnings("unused") public boolean whichFalse(RAbstractVector x, RAbstractStringVector what, byte which) { return which != RRuntime.LOGICAL_TRUE; } @Specialization(guards = "whichFalse") - public byte doInherits(VirtualFrame frame, RAbstractVector x, RAbstractStringVector what, @SuppressWarnings("unused") byte which) { + protected byte doInherits(VirtualFrame frame, RAbstractVector x, RAbstractStringVector what, @SuppressWarnings("unused") byte which) { return initInheritsNode().execute(frame, x, what); } @SlowPath // map operations lead to recursion resulting in compilation failure @Specialization(guards = "!whichFalse") - public Object doesInherit(RAbstractVector x, RAbstractStringVector what, @SuppressWarnings("unused") byte which) { + protected Object doesInherit(RAbstractVector x, RAbstractStringVector what, @SuppressWarnings("unused") byte which) { Map<String, Integer> classToPos = InheritsNode.initClassToPos(x); int[] result = new int[what.getLength()]; for (int i = 0; i < what.getLength(); ++i) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IntegerBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IntegerBuiltin.java index 9d2662be2945694d4c6204095c9944b0338f6914..c0355bbe914b226b7da27df13b97606dd758b1d4 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IntegerBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IntegerBuiltin.java @@ -42,20 +42,20 @@ public abstract class IntegerBuiltin extends RBuiltinNode { } @Specialization - public Object createIntegerVector(int length) { + protected Object createIntegerVector(int length) { controlVisibility(); return RDataFactory.createIntVector(length); } @Specialization - public Object createIntegerVector(double length) { + protected Object createIntegerVector(double length) { controlVisibility(); return RDataFactory.createIntVector((int) length); } @SuppressWarnings("unused") @Specialization - public Object createIntegerVector(RMissing length) { + protected Object createIntegerVector(RMissing length) { controlVisibility(); return RDataFactory.createIntVector(0); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Internal.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Internal.java index 92113b1906c243a5b4e242f9898d0b5a743ae646..a04129d71b0ee05f5d1e0eca3eda586b1b256245 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Internal.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Internal.java @@ -45,7 +45,7 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class Internal extends RBuiltinNode { @Specialization - public Object doInternal(VirtualFrame frame, RPromise x) { + protected Object doInternal(VirtualFrame frame, RPromise x) { controlVisibility(); RNode call = (RNode) x.getRep(); Symbol symbol = null; @@ -74,6 +74,9 @@ public abstract class Internal extends RBuiltinNode { // .Internal function is validated CompilerDirectives.transferToInterpreterAndInvalidate(); // Replace the original call; we can't just use callNode as that will cause recursion! + if (symbol.getName().equals("paste")) { + System.console(); + } RCallNode internalCallNode = RCallNode.createInternalCall(frame, this.getParent().getSourceSection(), callNode, function, symbol); this.getParent().replace(internalCallNode); // evaluate the actual builtin this time, next time we won't get here! diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Invisible.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Invisible.java index ee3f119e247938610b0741330f0361e86c25f0ff..b892a0e4bfd4fa47ecc0557f0660d77b13a2c8dc 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Invisible.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Invisible.java @@ -44,7 +44,7 @@ public abstract class Invisible extends RInvisibleBuiltinNode { } @Specialization - public Object doInvisible(Object o) { + protected Object doInvisible(Object o) { controlVisibility(); return o; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsArray.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsArray.java index 7f831b7119ef8efbf82a3d389df9515b4f036849..e0e0e1451545b7ed87b7c2c1b55023ab89f4923a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsArray.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsArray.java @@ -23,19 +23,19 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class IsArray extends RBuiltinNode { @Specialization - public byte isType(RAbstractVector vector) { + protected byte isType(RAbstractVector vector) { controlVisibility(); return RRuntime.asLogical(vector.isArray()); } @Specialization - public byte isType(@SuppressWarnings("unused") RNull arg) { + protected byte isType(@SuppressWarnings("unused") RNull arg) { controlVisibility(); return RRuntime.FALSE; } @Specialization - public byte isType(@SuppressWarnings("unused") RFunction arg) { + protected byte isType(@SuppressWarnings("unused") RFunction arg) { controlVisibility(); return RRuntime.FALSE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsAtomic.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsAtomic.java index e35271bfe1ab7ec547a1b02747be4b20deac37a0..0b3c4174c1d177baa563773c6e2558fa96fb2032 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsAtomic.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsAtomic.java @@ -34,25 +34,25 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class IsAtomic extends RBuiltinNode { @Specialization - public byte isAtomic(@SuppressWarnings("unused") RNull arg) { + protected byte isAtomic(@SuppressWarnings("unused") RNull arg) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization(guards = "!isListVector") - public byte isAtomic(@SuppressWarnings("unused") RAbstractVector arg) { + protected byte isAtomic(@SuppressWarnings("unused") RAbstractVector arg) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isAtomic(@SuppressWarnings("unused") RFunction arg) { + protected byte isAtomic(@SuppressWarnings("unused") RFunction arg) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isAtomic(@SuppressWarnings("unused") RList arg) { + protected byte isAtomic(@SuppressWarnings("unused") RList arg) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCall.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCall.java index b2163366f7159f26cde4878b5aaf08bd41ec917c..b07a8a949fedb6c994a04b69b954444f8f717b76 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCall.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCall.java @@ -21,7 +21,7 @@ public abstract class IsCall extends IsTypeNode { @Override @Specialization - public byte isType(RLanguage lang) { + protected byte isType(RLanguage lang) { return RRuntime.LOGICAL_TRUE; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCharacter.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCharacter.java index 8f8bfa3dea8f4bc91108a8ced58b37ad883db26a..07195250cb6721df998dd892fe488814cd79a06f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCharacter.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsCharacter.java @@ -33,20 +33,20 @@ public abstract class IsCharacter extends IsTypeNode { @Specialization @Override - public byte isType(String value) { + protected byte isType(String value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RStringVector value) { + protected byte isType(RStringVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof String || value instanceof RStringVector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsComplex.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsComplex.java index 8ff1a30de9ef69614a805cb04809313a61fe4ec1..93d02d6bc8246f771bdfcd79e3e699109cb14816 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsComplex.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsComplex.java @@ -33,20 +33,20 @@ public abstract class IsComplex extends IsTypeNode { @Specialization @Override - public byte isType(RComplex value) { + protected byte isType(RComplex value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RComplexVector value) { + protected byte isType(RComplexVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof RComplex || value instanceof RComplexVector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDataFrame.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDataFrame.java index 55b4fd846f01d4502f9663ced8d4dff6bc72d081..365f03cd5362def25c5c49c11853466eb279ee4e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDataFrame.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDataFrame.java @@ -36,17 +36,17 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class IsDataFrame extends RBuiltinNode { @Specialization - public byte isType(RDataFrame operand) { + protected byte isType(RDataFrame operand) { return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isTypeFrame(RAbstractVector operand) { + protected byte isTypeFrame(RAbstractVector operand) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RNull operand) { + protected byte isType(RNull operand) { return RRuntime.LOGICAL_FALSE; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDouble.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDouble.java index 6feb37f15ea41c86b43ef0119dc6d6b104fa9852..535b432a6d89055bf349e6c68b4d3b470dac47a9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDouble.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsDouble.java @@ -34,20 +34,20 @@ public abstract class IsDouble extends IsTypeNode { @Specialization @Override - public byte isType(double value) { + protected byte isType(double value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RDoubleVector value) { + protected byte isType(RDoubleVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof Double || value instanceof RAbstractDoubleVector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsExpression.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsExpression.java index 39f86340e6fcf611872fc653f4601706cef01b58..3ddd49cf8db96924c84c3ea81e53ff83acc69e76 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsExpression.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsExpression.java @@ -33,7 +33,7 @@ public abstract class IsExpression extends IsTypeNode { @Override @Specialization - public byte isType(RExpression expr) { + protected byte isType(RExpression expr) { return RRuntime.LOGICAL_TRUE; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsFinite.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsFinite.java index 114a455f08d9a14456595e0b814b250559741fea..6a0b2a5879eaa80778316899e479c63f64d0d4cf 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsFinite.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsFinite.java @@ -36,7 +36,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class IsFinite extends RBuiltinNode { @Specialization - public RLogicalVector doIsFinite(RAbstractDoubleVector vec) { + protected RLogicalVector doIsFinite(RAbstractDoubleVector vec) { controlVisibility(); byte[] b = new byte[vec.getLength()]; for (int i = 0; i < b.length; i++) { @@ -46,7 +46,7 @@ public abstract class IsFinite extends RBuiltinNode { } @Specialization - public Object doIsFiniteGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object x) { + protected Object doIsFiniteGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object x) { controlVisibility(); CompilerDirectives.transferToInterpreter(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.UNIMPLEMENTED_ARGUMENT_TYPE); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsInteger.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsInteger.java index 3716c109552fcfac259c8ae4f2b8d358c8786164..5509af0591f490e4f65cadba309d30659b056e15 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsInteger.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsInteger.java @@ -34,20 +34,20 @@ public abstract class IsInteger extends IsTypeNode { @Specialization @Override - public byte isType(int value) { + protected byte isType(int value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RIntVector value) { + protected byte isType(RIntVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof Integer || value instanceof RAbstractIntVector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLanguage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLanguage.java index 3a60b3181ead82d7eca0f77ef3a02b05691187d9..798a09ffb0003eb64e040b0d8ea9fb343203b00a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLanguage.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLanguage.java @@ -30,19 +30,19 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class IsLanguage extends IsTypeNode { @Override @Specialization - public byte isType(RSymbol value) { + protected byte isType(RSymbol value) { return RRuntime.LOGICAL_TRUE; } @Override @Specialization - public byte isType(RExpression value) { + protected byte isType(RExpression value) { return RRuntime.LOGICAL_TRUE; } @Override @Specialization - public byte isType(RLanguage value) { + protected byte isType(RLanguage value) { return RRuntime.LOGICAL_TRUE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsListFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsListFunctions.java index 3fe5ceea1382253bf2d94028165996cbd14d3c35..c616e9e1b12166bfd40088c7f37fd5e89a23d1c0 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsListFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsListFunctions.java @@ -53,49 +53,49 @@ public class IsListFunctions { } @Specialization - public byte isType(VirtualFrame frame, RMissing value) { + protected byte isType(VirtualFrame frame, RMissing value) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENTS_PASSED_0_1, getRBuiltin().name()); } @Specialization - public byte isType(RList value) { + protected byte isType(RList value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization(guards = "!isList") - public byte isType(RAbstractVector value) { + protected byte isType(RAbstractVector value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RNull value) { + protected byte isType(RNull value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization(guards = "isList") - public byte isTypeFrame(RDataFrame value) { + protected byte isTypeFrame(RDataFrame value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization(guards = "!isList") - public byte isType(RDataFrame value) { + protected byte isType(RDataFrame value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(REnvironment env) { + protected byte isType(REnvironment env) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RPairList pl) { + protected byte isType(RPairList pl) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @@ -114,7 +114,7 @@ public class IsListFunctions { public abstract static class IsPairList extends IsTypeNode { @Specialization @Override - public byte isType(RPairList value) { + protected byte isType(RPairList value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLogical.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLogical.java index 6f142f73708fd0aa2cb1e63578d39bf79b49ae20..a94313045366c905db15478afb382d5e5d092c29 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLogical.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsLogical.java @@ -33,20 +33,20 @@ public abstract class IsLogical extends IsTypeNode { @Specialization @Override - public byte isType(byte value) { + protected byte isType(byte value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RLogicalVector value) { + protected byte isType(RLogicalVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof Boolean || value instanceof RLogicalVector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMatrix.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMatrix.java index ee6794e96a8ea4f8b66e21a7b05cee7b04c9f450..ad7a74e2f25637fd3d43f97c61dc1761d0335735 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMatrix.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMatrix.java @@ -34,13 +34,13 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class IsMatrix extends RBuiltinNode { @Specialization - public byte isType(RAbstractVector vector) { + protected byte isType(RAbstractVector vector) { controlVisibility(); return RRuntime.asLogical(vector.isMatrix()); } @Specialization - public byte isType(@SuppressWarnings("unused") RNull arg) { + protected byte isType(@SuppressWarnings("unused") RNull arg) { controlVisibility(); return RRuntime.FALSE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMethodsDispatchOn.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMethodsDispatchOn.java index 76f174a956fe92dbb6807e638d7e322a20083eac..441012acb364b6ea110641cf9afa9f670302cc56 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMethodsDispatchOn.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsMethodsDispatchOn.java @@ -31,7 +31,7 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class IsMethodsDispatchOn extends RBuiltinNode { @Specialization - public byte doIsMethodsDispatchOn(@SuppressWarnings("unused") RMissing x) { + protected byte doIsMethodsDispatchOn(@SuppressWarnings("unused") RMissing x) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNA.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNA.java index 2961f85cd6dfc7a8860fa8ee5d0a6a354fcafa85..d6536b9806b0007aba02887f21472b6074cb1a95 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNA.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNA.java @@ -50,13 +50,13 @@ public abstract class IsNA extends RBuiltinNode { public abstract Object execute(VirtualFrame frame, Object o); @Specialization - public byte isNA(int value) { + protected byte isNA(int value) { controlVisibility(); return RRuntime.asLogical(RRuntime.isNA(value)); } @Specialization - public RLogicalVector isNA(RAbstractIntVector vector) { + protected RLogicalVector isNA(RAbstractIntVector vector) { controlVisibility(); byte[] resultVector = new byte[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -66,13 +66,13 @@ public abstract class IsNA extends RBuiltinNode { } @Specialization - public byte isNA(double value) { + protected byte isNA(double value) { controlVisibility(); return RRuntime.asLogical(RRuntime.isNA(value)); } @Specialization - public RLogicalVector isNA(RAbstractDoubleVector vector) { + protected RLogicalVector isNA(RAbstractDoubleVector vector) { controlVisibility(); byte[] resultVector = new byte[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -82,13 +82,13 @@ public abstract class IsNA extends RBuiltinNode { } @Specialization - public byte isNA(String value) { + protected byte isNA(String value) { controlVisibility(); return RRuntime.asLogical(RRuntime.isNA(value)); } @Specialization - public RLogicalVector isNA(RStringVector vector) { + protected RLogicalVector isNA(RStringVector vector) { controlVisibility(); byte[] resultVector = new byte[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -98,7 +98,7 @@ public abstract class IsNA extends RBuiltinNode { } @Specialization - public RLogicalVector isNA(VirtualFrame frame, RList list) { + protected RLogicalVector isNA(VirtualFrame frame, RList list) { controlVisibility(); byte[] resultVector = new byte[list.getLength()]; for (int i = 0; i < list.getLength(); i++) { @@ -121,13 +121,13 @@ public abstract class IsNA extends RBuiltinNode { } @Specialization - public byte isNA(byte value) { + protected byte isNA(byte value) { controlVisibility(); return RRuntime.asLogical(RRuntime.isNA(value)); } @Specialization - public RLogicalVector isNA(RLogicalVector vector) { + protected RLogicalVector isNA(RLogicalVector vector) { controlVisibility(); byte[] resultVector = new byte[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -137,7 +137,7 @@ public abstract class IsNA extends RBuiltinNode { } @Specialization - public byte isNA(RNull value) { + protected byte isNA(RNull value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsName.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsName.java index 83be2250a3f9e8db9fa3a68712b6be6755937194..aa0602f0babbb9d569b3ff19ef84af54ef89ffec 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsName.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsName.java @@ -33,13 +33,13 @@ public abstract class IsName extends IsTypeNode { @Specialization @Override - public byte isType(RSymbol value) { + protected byte isType(RSymbol value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof RSymbol); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNull.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNull.java index 18f7fe326c70c43a2d171146c71b397ee66be4e0..edc73a3357e45635ed55159cdbd7b058c00f3c7f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNull.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNull.java @@ -33,13 +33,13 @@ public abstract class IsNull extends IsTypeNode { @Specialization @Override - public byte isType(RNull value) { + protected byte isType(RNull value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof RNull); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNumeric.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNumeric.java index 1033d66aca3ae705f9c8fd4bb839f83e3bec655d..2e9c6a41e8496da7e0dd04c3434332c47d8eb4e1 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNumeric.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsNumeric.java @@ -36,48 +36,48 @@ public abstract class IsNumeric extends IsTypeNode { @Specialization @Override - public byte isType(int value) { + protected byte isType(int value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RIntVector value) { + protected byte isType(RIntVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(double value) { + protected byte isType(double value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RDoubleVector value) { + protected byte isType(RDoubleVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RIntSequence value) { + protected byte isType(RIntSequence value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RDoubleSequence value) { + protected byte isType(RDoubleSequence value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof Integer || value instanceof RIntVector || value instanceof Double || value instanceof RDoubleVector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsObject.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsObject.java index ea700cf614e7f5fcf5785fbb43a8534aca0be3e2..a87f79655e0b7de026626d20a0605e9219ac0073 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsObject.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsObject.java @@ -35,13 +35,13 @@ public abstract class IsObject extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public byte isObject(RNull arg) { + protected byte isObject(RNull arg) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isObject(RAbstractVector arg) { + protected byte isObject(RAbstractVector arg) { controlVisibility(); return arg.isObject() ? RRuntime.LOGICAL_TRUE : RRuntime.LOGICAL_FALSE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsRaw.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsRaw.java index adbc323168dcd36531cdcdeb6c14854331d9cd8a..15436928cd6e5950203f1ba1e1ab1bd97e8a7022 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsRaw.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsRaw.java @@ -33,20 +33,20 @@ public abstract class IsRaw extends IsTypeNode { @Specialization @Override - public byte isType(RRaw value) { + protected byte isType(RRaw value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization @Override - public byte isType(RRawVector value) { + protected byte isType(RRawVector value) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @Specialization - public byte isType(Object value) { + protected byte isType(Object value) { controlVisibility(); return RRuntime.asLogical(value instanceof RRaw || value instanceof RRawVector); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTRUE.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTRUE.java index 29e7438c3e6dc93b2d154661e48b588c9ab16666..b8c5b972c30e6b717b37d2883b61d58ca3806a62 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTRUE.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTRUE.java @@ -38,7 +38,7 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class IsTRUE extends RBuiltinNode { @Specialization - public RLogicalVector isTRUE(byte x) { + protected RLogicalVector isTRUE(byte x) { controlVisibility(); byte xx = x; if (x == RRuntime.LOGICAL_NA) { @@ -48,13 +48,13 @@ public abstract class IsTRUE extends RBuiltinNode { } @Specialization(guards = "exactlyTrue") - public RLogicalVector isTRUE(@SuppressWarnings("unused") RLogicalVector x) { + protected RLogicalVector isTRUE(@SuppressWarnings("unused") RLogicalVector x) { controlVisibility(); return RDataFactory.createLogicalVectorFromScalar(RRuntime.LOGICAL_TRUE); } @Specialization - public RLogicalVector isTRUEGeneric(@SuppressWarnings("unused") Object x) { + protected RLogicalVector isTRUEGeneric(@SuppressWarnings("unused") Object x) { controlVisibility(); return RDataFactory.createLogicalVectorFromScalar(RRuntime.LOGICAL_FALSE); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeNode.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeNode.java index 380debc4d7f8aa90cbc77c0f24e22ea4c1cde0e7..5369eda224507247b423260c7d036dcd3daf38bd 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeNode.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeNode.java @@ -45,131 +45,131 @@ public abstract class IsTypeNode extends RBuiltinNode { } @Specialization - public byte isType(VirtualFrame frame, RMissing value) { + protected byte isType(VirtualFrame frame, RMissing value) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENTS_PASSED_0_1, getRBuiltin().name()); } @Specialization - public byte isType(int value) { + protected byte isType(int value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RIntVector value) { + protected byte isType(RIntVector value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(double value) { + protected byte isType(double value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RDoubleVector value) { + protected byte isType(RDoubleVector value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(String value) { + protected byte isType(String value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RStringVector value) { + protected byte isType(RStringVector value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(byte value) { + protected byte isType(byte value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RLogicalVector value) { + protected byte isType(RLogicalVector value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RNull value) { + protected byte isType(RNull value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RComplex value) { + protected byte isType(RComplex value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RComplexVector value) { + protected byte isType(RComplexVector value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RRaw value) { + protected byte isType(RRaw value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RRawVector value) { + protected byte isType(RRawVector value) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RList value) { + protected byte isType(RList value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RIntSequence value) { + protected byte isType(RIntSequence value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RDoubleSequence value) { + protected byte isType(RDoubleSequence value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RFunction value) { + protected byte isType(RFunction value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RSymbol value) { + protected byte isType(RSymbol value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RLanguage value) { + protected byte isType(RLanguage value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RPromise value) { + protected byte isType(RPromise value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RExpression value) { + protected byte isType(RExpression value) { return RRuntime.LOGICAL_FALSE; } @Specialization - public byte isType(RPairList value) { + protected byte isType(RPairList value) { return RRuntime.LOGICAL_FALSE; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java index 3dc9ef075e42a5877bca4376ef2ffa664251a96b..bf36701f11be0592f5c0a96964993d065a6e7688 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsUnsorted.java @@ -46,7 +46,7 @@ public abstract class IsUnsorted extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public byte isUnsorted(RDoubleVector x, byte narm, byte strictly) { + protected byte isUnsorted(RDoubleVector x, byte narm, byte strictly) { controlVisibility(); double last = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsVector.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsVector.java index 9a72a7c442455db0a0a8f386897186c72c8f8dfc..43cddc24f05d25e709632d11708f56546e7a9755 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsVector.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsVector.java @@ -43,47 +43,47 @@ public abstract class IsVector extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public byte isNull(RNull operand, Object mode) { + protected byte isNull(RNull operand, Object mode) { return RRuntime.LOGICAL_FALSE; } @SuppressWarnings("unused") @Specialization - public byte isNull(RDataFrame operand, Object mode) { + protected byte isNull(RDataFrame operand, Object mode) { return RRuntime.LOGICAL_FALSE; } @SuppressWarnings("unused") @Specialization(guards = {"namesOnlyOrNoAttr", "modeIsAnyOrMatches"}) - public byte isList(RAbstractVector x, String mode) { + protected byte isList(RAbstractVector x, String mode) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @SuppressWarnings("unused") @Specialization(guards = {"namesOnlyOrNoAttr", "!modeIsAnyOrMatches"}) - public byte isNotVector(RAbstractVector x, String mode) { + protected byte isNotVector(RAbstractVector x, String mode) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @SuppressWarnings("unused") @Specialization(guards = "!namesOnlyOrNoAttr") - public byte isVectorAttr(RAbstractVector x, String mode) { + protected byte isVectorAttr(RAbstractVector x, String mode) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } @SuppressWarnings("unused") @Specialization(guards = "namesOnlyOrNoAttr") - public byte isVector(RAbstractVector x, RMissing mode) { + protected byte isVector(RAbstractVector x, RMissing mode) { controlVisibility(); return RRuntime.LOGICAL_TRUE; } @SuppressWarnings("unused") @Specialization(guards = "!namesOnlyOrNoAttr") - public byte isVectorAttr(RAbstractVector x, RMissing mode) { + protected byte isVectorAttr(RAbstractVector x, RMissing mode) { controlVisibility(); return RRuntime.LOGICAL_FALSE; } 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 d45df802071de7aff7212edcabf7b04248318790..05fd4b91f1fdec4a00be611f44dec273a4ae3095 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 @@ -37,7 +37,7 @@ public class LaFunctions { public abstract static class Version extends RBuiltinNode { @Specialization @SlowPath - public String doVersion() { + protected String doVersion() { int[] version = new int[3]; RFFIFactory.getRFFI().getLapackRFFI().ilaver(version); return version[0] + "." + version[1] + "." + version[2]; @@ -50,7 +50,7 @@ public class LaFunctions { private static final String[] NAMES = new String[]{"values", "vectors"}; @Specialization - public Object doRg(VirtualFrame frame, RDoubleVector matrix, byte onlyValues) { + protected Object doRg(VirtualFrame frame, RDoubleVector matrix, byte onlyValues) { controlVisibility(); if (!matrix.isMatrix()) { RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_SQUARE_NUMERIC, "x"); @@ -128,7 +128,7 @@ public class LaFunctions { private static final String[] NAMES = new String[]{"qr", "rank", "qraux", "pivot"}; @Specialization - public RList doQr(VirtualFrame frame, RAbstractVector aIn) { + protected RList doQr(VirtualFrame frame, RAbstractVector aIn) { // This implementation is sufficient for B25 matcal-5. if (!aIn.isMatrix()) { RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_NUMERIC_MATRIX, "a"); @@ -182,7 +182,7 @@ public class LaFunctions { } @Specialization - public RDoubleVector doQrCoefReal(VirtualFrame frame, RList qIn, RDoubleVector bIn) { + protected RDoubleVector doQrCoefReal(VirtualFrame frame, RList qIn, RDoubleVector bIn) { if (!bIn.isMatrix()) { RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_NUMERIC_MATRIX, "b"); } @@ -235,7 +235,7 @@ public class LaFunctions { private static final RStringVector DET_CLASS = RDataFactory.createStringVector(new String[]{"det"}, RDataFactory.COMPLETE_VECTOR); @Specialization - public RList doDetGeReal(VirtualFrame frame, RDoubleVector aIn, byte useLogIn) { + protected RList doDetGeReal(VirtualFrame frame, RDoubleVector aIn, byte useLogIn) { if (!aIn.isMatrix()) { RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_NUMERIC_MATRIX, "a"); } @@ -294,7 +294,7 @@ public class LaFunctions { @RBuiltin(name = "La_chol", kind = INTERNAL, parameterNames = {"a", "pivot", "tol"}) public abstract static class LaChol extends RBuiltinNode { @Specialization - public RDoubleVector doDetGeReal(VirtualFrame frame, RDoubleVector aIn, byte pivot, double tol) { + protected RDoubleVector doDetGeReal(VirtualFrame frame, RDoubleVector aIn, byte pivot, double tol) { RDoubleVector a = (RDoubleVector) aIn.copy(); int[] aDims = aIn.getDimensions(); int n = aDims[0]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java index 76a279a1ee4457f4f655c9f78dee3d372b04e28f..bd1cfe0594c387b0e8113e3e98fdd4b2fdb07e24 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Lapply.java @@ -35,20 +35,20 @@ public abstract class Lapply extends RBuiltinNode { } @Specialization - public Object lapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object[] optionalArgs) { + protected Object lapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object[] optionalArgs) { Object[] combinedArgs = new Object[optionalArgs.length + 1]; System.arraycopy(optionalArgs, 0, combinedArgs, 1, optionalArgs.length); return lapplyHelper(frame, x, fun, combinedArgs); } @Specialization(guards = "!argMissing") - public Object lapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object optionalArg) { + protected Object lapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object optionalArg) { Object[] combinedArgs = new Object[]{null, optionalArg}; return lapplyHelper(frame, x, fun, combinedArgs); } @Specialization - public Object lapply(VirtualFrame frame, RAbstractVector x, RFunction fun, @SuppressWarnings("unused") RMissing optionalArg) { + protected Object lapply(VirtualFrame frame, RAbstractVector x, RFunction fun, @SuppressWarnings("unused") RMissing optionalArg) { Object[] combinedArgs = new Object[]{null}; return lapplyHelper(frame, x, fun, combinedArgs); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Length.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Length.java index 2cd01503848ca52d48049fc36672ac5cc71a9b95..9a7cc7eeb3952ebdd75b26e1ccdff672368100f0 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Length.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Length.java @@ -38,13 +38,13 @@ public abstract class Length extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public int getLength(RNull vector) { + protected int getLength(RNull vector) { controlVisibility(); return 0; } @Specialization - public int getLength(RAbstractContainer vector) { + protected int getLength(RAbstractContainer vector) { controlVisibility(); return vector.getLength(); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/License.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/License.java index 37c5bc819b7091c75feb9220e938d2ed54196294..e04411b6d79abed2de945e9b8e59db1c417ac377 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/License.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/License.java @@ -33,7 +33,7 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class License extends RInvisibleBuiltinNode { @Specialization - public Object license() { + protected Object license() { controlVisibility(); RContext.getInstance().getConsoleHandler().println(RRuntime.LICENSE); return RNull.instance; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ListBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ListBuiltin.java index 5c2f3a8537fb5bce3c9633ee4b53e7723f4704b2..bf573db4c66ac618ec1d6398c5bd1f275e5e7b59 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ListBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ListBuiltin.java @@ -37,74 +37,74 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class ListBuiltin extends RBuiltinNode { @Specialization - public RList list(@SuppressWarnings("unused") RMissing missing) { + protected RList list(@SuppressWarnings("unused") RMissing missing) { controlVisibility(); return list(new Object[0]); } @Specialization - public RList list(byte value) { + protected RList list(byte value) { controlVisibility(); return list(new Object[]{value}); } @Specialization - public RList list(int value) { + protected RList list(int value) { controlVisibility(); return list(new Object[]{value}); } @Specialization - public RList list(double value) { + protected RList list(double value) { controlVisibility(); return list(new Object[]{value}); } @Specialization - public RList list(RRaw value) { + protected RList list(RRaw value) { controlVisibility(); return list(new Object[]{value}); } @Specialization - public RList list(RComplex value) { + protected RList list(RComplex value) { controlVisibility(); return list(new Object[]{value}); } @Specialization - public RList list(String value) { + protected RList list(String value) { controlVisibility(); return list(new Object[]{value}); } @Specialization - public RList list(RAbstractVector value) { + protected RList list(RAbstractVector value) { controlVisibility(); return list(new Object[]{value}); } @Specialization - public RList list(Object[] args) { + protected RList list(Object[] args) { controlVisibility(); // TODO: should we duplicate all specializations for no-args and args case? return RDataFactory.createList(args, argNameVector()); } @Specialization - public RList list(RNull value) { + protected RList list(RNull value) { controlVisibility(); return RDataFactory.createList(new Object[]{value}, argNameVector()); } @Specialization - public RList list(REnvironment value) { + protected RList list(REnvironment value) { controlVisibility(); return RDataFactory.createList(new Object[]{value}, argNameVector()); } @Specialization - public RList list(RFunction value) { + protected RList list(RFunction value) { controlVisibility(); return RDataFactory.createList(new Object[]{value}, argNameVector()); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log.java index b28eada5bbe5404ef99ef1264f0983fa4fde66d6..895fb6bf27538a3a24ad45af3c96f3be48d0ed48 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log.java @@ -50,25 +50,25 @@ public abstract class Log extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull log(VirtualFrame frame, RNull x, RNull base) { + protected RNull log(VirtualFrame frame, RNull x, RNull base) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_ARGUMENT_FUNCTION); } @Specialization - public double log(int x, double base) { + protected double log(int x, double base) { controlVisibility(); return logb(x, base); } @Specialization - public double log(double x, double base) { + protected double log(double x, double base) { controlVisibility(); return logb(x, base); } @Specialization - public RDoubleVector log(RIntVector vector, double base) { + protected RDoubleVector log(RIntVector vector, double base) { controlVisibility(); double[] resultVector = new double[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -83,7 +83,7 @@ public abstract class Log extends RBuiltinNode { } @Specialization - public RDoubleVector log(RDoubleVector vector, double base) { + protected RDoubleVector log(RDoubleVector vector, double base) { controlVisibility(); double[] doubleVector = new double[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log10.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log10.java index b499bdeb576987dd18e1dddf699fbd0951e7e90d..5cf6a9e0c3fc6308caefdcac6fb66cd430638d0d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log10.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log10.java @@ -35,25 +35,25 @@ public abstract class Log10 extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull log(VirtualFrame frame, RNull x) { + protected RNull log(VirtualFrame frame, RNull x) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_ARGUMENT_FUNCTION); } @Specialization - public double log(int value) { + protected double log(int value) { controlVisibility(); return Math.log10(value); } @Specialization - public double log(double value) { + protected double log(double value) { controlVisibility(); return Math.log10(value); } @Specialization - public RDoubleVector log(RIntVector vector) { + protected RDoubleVector log(RIntVector vector) { controlVisibility(); double[] resultVector = new double[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -70,7 +70,7 @@ public abstract class Log10 extends RBuiltinNode { } @Specialization - public RDoubleVector log(RDoubleVector vector) { + protected RDoubleVector log(RDoubleVector vector) { controlVisibility(); double[] doubleVector = new double[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log2.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log2.java index 101ff4b6dcdaccaac4185b5572981db1992f3921..3d9d27ebfed151adea89ed6fa3ea618cfeb826c9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log2.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Log2.java @@ -37,25 +37,25 @@ public abstract class Log2 extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull log(VirtualFrame frame, RNull x) { + protected RNull log(VirtualFrame frame, RNull x) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_NUMERIC_ARGUMENT_FUNCTION); } @Specialization - public double log2(int value) { + protected double log2(int value) { controlVisibility(); return log2((double) value); } @Specialization - public double log2(double value) { + protected double log2(double value) { controlVisibility(); return Math.log(value) / log2value; } @Specialization - public RDoubleVector log2(RIntVector vector) { + protected RDoubleVector log2(RIntVector vector) { controlVisibility(); double[] resultVector = new double[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -70,7 +70,7 @@ public abstract class Log2 extends RBuiltinNode { } @Specialization - public RDoubleVector log2(RDoubleVector vector) { + protected RDoubleVector log2(RDoubleVector vector) { controlVisibility(); double[] doubleVector = new double[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LogicalBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LogicalBuiltin.java index ea5d6a5b0bf09c0acac25d4de7f0c56a94778716..31f855710377593de6a447e647975229b6e9cfee 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LogicalBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LogicalBuiltin.java @@ -41,20 +41,20 @@ public abstract class LogicalBuiltin extends RBuiltinNode { } @Specialization - public Object createLogicalVector(int length) { + protected Object createLogicalVector(int length) { controlVisibility(); return RDataFactory.createLogicalVector(length); } @Specialization - public Object createLogicalVector(double length) { + protected Object createLogicalVector(double length) { controlVisibility(); return RDataFactory.createLogicalVector((int) length); } @SuppressWarnings("unused") @Specialization - public Object createLogicalVector(RMissing length) { + protected Object createLogicalVector(RMissing length) { controlVisibility(); return RDataFactory.createLogicalVector(0); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ls.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ls.java index 9cda443d64ad631b24e5d76c27463638283e6643..f0dfcf6cfcc046171f15e781080aeee3c196cd6d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ls.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Ls.java @@ -49,49 +49,49 @@ public abstract class Ls extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RStringVector ls(VirtualFrame frame, RMissing name, int pos, RMissing envir, byte allNames, RMissing pattern) { + protected RStringVector ls(VirtualFrame frame, RMissing name, int pos, RMissing envir, byte allNames, RMissing pattern) { controlVisibility(); return REnvironment.createLsCurrent(frame.materialize()).ls(RRuntime.fromLogical(allNames), null); } @Specialization @SuppressWarnings("unused") - public RStringVector ls(REnvironment name, Object pos, RMissing envir, byte allNames, RMissing pattern) { + protected RStringVector ls(REnvironment name, Object pos, RMissing envir, byte allNames, RMissing pattern) { controlVisibility(); return name.ls(RRuntime.fromLogical(allNames), null); } @SuppressWarnings("unused") @Specialization - public RStringVector ls(VirtualFrame frame, RMissing name, int pos, REnvironment envir, byte allNames, RMissing pattern) { + protected RStringVector ls(VirtualFrame frame, RMissing name, int pos, REnvironment envir, byte allNames, RMissing pattern) { controlVisibility(); return envir.ls(RRuntime.fromLogical(allNames), null); } @Specialization @SuppressWarnings("unused") - public RStringVector ls(VirtualFrame frame, RMissing name, int pos, RMissing envir, byte allNames, String pattern) { + protected RStringVector ls(VirtualFrame frame, RMissing name, int pos, RMissing envir, byte allNames, String pattern) { controlVisibility(); return REnvironment.createLsCurrent(frame.materialize()).ls(RRuntime.fromLogical(allNames), compile(pattern)); } @Specialization @SuppressWarnings("unused") - public RStringVector ls(REnvironment name, Object pos, RMissing envir, byte allNames, String pattern) { + protected RStringVector ls(REnvironment name, Object pos, RMissing envir, byte allNames, String pattern) { controlVisibility(); return name.ls(RRuntime.fromLogical(allNames), compile(pattern)); } @SuppressWarnings("unused") @Specialization - public RStringVector ls(VirtualFrame frame, RMissing name, int pos, REnvironment envir, byte allNames, String pattern) { + protected RStringVector ls(VirtualFrame frame, RMissing name, int pos, REnvironment envir, byte allNames, String pattern) { controlVisibility(); return envir.ls(RRuntime.fromLogical(allNames), compile(pattern)); } @SuppressWarnings("unused") @Specialization - public RStringVector ls(VirtualFrame frame, RAbstractIntVector name, int pos, RMissing envir, byte allNames, RMissing pattern) { + protected RStringVector ls(VirtualFrame frame, RAbstractIntVector name, int pos, RMissing envir, byte allNames, RMissing pattern) { controlVisibility(); String[] searchPath = REnvironment.searchPath(); REnvironment env = REnvironment.lookupOnSearchPath(searchPath[name.getDataAt(0) - 1]); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatMult.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatMult.java index 8fbc91ccc2695747aec8a6d5ab3ae4388c0c5765..4cfebfc735ecac8ee8885fe6947397262c21f060 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatMult.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatMult.java @@ -54,7 +54,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "bothZeroDim") - public RDoubleVector both0Dim(RAbstractDoubleVector a, RAbstractDoubleVector b) { + protected RDoubleVector both0Dim(RAbstractDoubleVector a, RAbstractDoubleVector b) { controlVisibility(); int r = b.getDimensions()[1]; int c = a.getDimensions()[0]; @@ -64,14 +64,14 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "leftHasZeroDim") - public RAbstractVector left0Dim(RAbstractVector a, RAbstractVector b) { + protected RAbstractVector left0Dim(RAbstractVector a, RAbstractVector b) { controlVisibility(); int[] dim = a.getDimensions()[0] == 0 ? new int[]{0, b.getDimensions()[1]} : new int[]{b.getDimensions()[0], 0}; return a.copyWithNewDimensions(dim); } @Specialization(guards = "rightHasZeroDim") - public RAbstractVector right0Dim(RAbstractVector a, RAbstractVector b) { + protected RAbstractVector right0Dim(RAbstractVector a, RAbstractVector b) { controlVisibility(); int[] dim = b.getDimensions()[0] == 0 ? new int[]{0, a.getDimensions()[1]} : new int[]{a.getDimensions()[0], 0}; return b.copyWithNewDimensions(dim); @@ -80,7 +80,7 @@ public abstract class MatMult extends RBuiltinNode { // double-double @Specialization(guards = "matmat") - public RDoubleVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { + protected RDoubleVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { controlVisibility(); final int aCols = a.getDimensions()[1]; final int bRows = b.getDimensions()[0]; @@ -105,7 +105,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "vecvec") - public RDoubleVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { + protected RDoubleVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { controlVisibility(); if (a.getLength() != b.getLength()) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_CONFORMABLE_ARGS); @@ -120,7 +120,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "matvec") - public RDoubleVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { + protected RDoubleVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { controlVisibility(); final int aCols = a.getDimensions()[1]; final int aRows = a.getDimensions()[0]; @@ -153,7 +153,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "vecmat") - public RDoubleVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { + protected RDoubleVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractDoubleVector b) { controlVisibility(); final int bCols = b.getDimensions()[1]; final int bRows = b.getDimensions()[0]; @@ -188,7 +188,7 @@ public abstract class MatMult extends RBuiltinNode { // complex-complex @Specialization(guards = "matmat") - public RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { + protected RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { controlVisibility(); final int aCols = a.getDimensions()[1]; final int bRows = b.getDimensions()[0]; @@ -215,7 +215,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "vecvec") - public RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { + protected RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { controlVisibility(); if (a.getLength() != b.getLength()) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_CONFORMABLE_ARGS); @@ -230,7 +230,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "matvec") - public RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { + protected RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { controlVisibility(); final int aCols = a.getDimensions()[1]; final int aRows = a.getDimensions()[0]; @@ -265,7 +265,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "vecmat") - public RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { + protected RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractComplexVector b) { controlVisibility(); final int bRows = b.getDimensions()[0]; final int bCols = b.getDimensions()[1]; @@ -302,7 +302,7 @@ public abstract class MatMult extends RBuiltinNode { // int-int @Specialization(guards = "matmat") - public RIntVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { + protected RIntVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { controlVisibility(); final int aCols = a.getDimensions()[1]; final int bRows = b.getDimensions()[0]; @@ -327,7 +327,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "vecvec") - public RIntVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { + protected RIntVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { controlVisibility(); if (a.getLength() != b.getLength()) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NON_CONFORMABLE_ARGS); @@ -342,7 +342,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "matvec") - public RIntVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { + protected RIntVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { controlVisibility(); final int aCols = a.getDimensions()[1]; final int aRows = a.getDimensions()[0]; @@ -375,7 +375,7 @@ public abstract class MatMult extends RBuiltinNode { } @Specialization(guards = "vecmat") - public RIntVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { + protected RIntVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractIntVector b) { controlVisibility(); final int bCols = b.getDimensions()[1]; final int bRows = b.getDimensions()[0]; @@ -410,268 +410,268 @@ public abstract class MatMult extends RBuiltinNode { // logical-logical @Specialization(guards = "matmat") - public RIntVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { + protected RIntVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { return matmatmult(frame, RClosures.createLogicalToIntVector(a, na), RClosures.createLogicalToIntVector(b, na)); } @Specialization(guards = "vecvec") - public RIntVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { + protected RIntVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { return vecvecmult(frame, RClosures.createLogicalToIntVector(a, na), RClosures.createLogicalToIntVector(b, na)); } @Specialization(guards = "matvec") - public RIntVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { + protected RIntVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { return matvecmult(frame, RClosures.createLogicalToIntVector(a, na), RClosures.createLogicalToIntVector(b, na)); } @Specialization(guards = "vecmat") - public RIntVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { + protected RIntVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractLogicalVector b) { return vecmatmult(frame, RClosures.createLogicalToIntVector(a, na), RClosures.createLogicalToIntVector(b, na)); } // to int @Specialization(guards = "matmat") - public RIntVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { + protected RIntVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { return matmatmult(frame, RClosures.createLogicalToIntVector(a, na), b); } @Specialization(guards = "vecvec") - public RIntVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { + protected RIntVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { return vecvecmult(frame, RClosures.createLogicalToIntVector(a, na), b); } @Specialization(guards = "matvec") - public RIntVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { + protected RIntVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { return matvecmult(frame, RClosures.createLogicalToIntVector(a, na), b); } @Specialization(guards = "vecmat") - public RIntVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { + protected RIntVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractIntVector b) { return vecmatmult(frame, RClosures.createLogicalToIntVector(a, na), b); } @Specialization(guards = "matmat") - public RIntVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { + protected RIntVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { return matmatmult(frame, a, RClosures.createLogicalToIntVector(b, na)); } @Specialization(guards = "vecvec") - public RIntVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { + protected RIntVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { return vecvecmult(frame, a, RClosures.createLogicalToIntVector(b, na)); } @Specialization(guards = "matvec") - public RIntVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { + protected RIntVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { return matvecmult(frame, a, RClosures.createLogicalToIntVector(b, na)); } @Specialization(guards = "vecmat") - public RIntVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { + protected RIntVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractLogicalVector b) { return vecmatmult(frame, a, RClosures.createLogicalToIntVector(b, na)); } // to complex @Specialization(guards = "matmat") - public RComplexVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { + protected RComplexVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { return matmatmult(frame, RClosures.createIntToComplexVector(a, na), b); } @Specialization(guards = "vecvec") - public RComplexVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { + protected RComplexVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { return vecvecmult(frame, RClosures.createIntToComplexVector(a, na), b); } @Specialization(guards = "matvec") - public RComplexVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { + protected RComplexVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { return matvecmult(frame, RClosures.createIntToComplexVector(a, na), b); } @Specialization(guards = "vecmat") - public RComplexVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { + protected RComplexVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractComplexVector b) { return vecmatmult(frame, RClosures.createIntToComplexVector(a, na), b); } @Specialization(guards = "matmat") - public RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { + protected RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { return matmatmult(frame, a, RClosures.createIntToComplexVector(b, na)); } @Specialization(guards = "vecvec") - public RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { + protected RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { return vecvecmult(frame, a, RClosures.createIntToComplexVector(b, na)); } @Specialization(guards = "matvec") - public RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { + protected RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { return matvecmult(frame, a, RClosures.createIntToComplexVector(b, na)); } @Specialization(guards = "vecmat") - public RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { + protected RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractIntVector b) { return vecmatmult(frame, a, RClosures.createIntToComplexVector(b, na)); } @Specialization(guards = "matmat") - public RComplexVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { + protected RComplexVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { return matmatmult(frame, RClosures.createLogicalToComplexVector(a, na), b); } @Specialization(guards = "vecvec") - public RComplexVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { + protected RComplexVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { return vecvecmult(frame, RClosures.createLogicalToComplexVector(a, na), b); } @Specialization(guards = "matvec") - public RComplexVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { + protected RComplexVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { return matvecmult(frame, RClosures.createLogicalToComplexVector(a, na), b); } @Specialization(guards = "vecmat") - public RComplexVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { + protected RComplexVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractComplexVector b) { return vecmatmult(frame, RClosures.createLogicalToComplexVector(a, na), b); } @Specialization(guards = "matmat") - public RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { + protected RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { return matmatmult(frame, a, RClosures.createLogicalToComplexVector(b, na)); } @Specialization(guards = "vecvec") - public RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { + protected RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { return vecvecmult(frame, a, RClosures.createLogicalToComplexVector(b, na)); } @Specialization(guards = "matvec") - public RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { + protected RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { return matvecmult(frame, a, RClosures.createLogicalToComplexVector(b, na)); } @Specialization(guards = "vecmat") - public RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { + protected RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractLogicalVector b) { return vecmatmult(frame, a, RClosures.createLogicalToComplexVector(b, na)); } @Specialization(guards = "matmat") - public RComplexVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { + protected RComplexVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { return matmatmult(frame, RClosures.createDoubleToComplexVector(a, na), b); } @Specialization(guards = "vecvec") - public RComplexVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { + protected RComplexVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { return vecvecmult(frame, RClosures.createDoubleToComplexVector(a, na), b); } @Specialization(guards = "matvec") - public RComplexVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { + protected RComplexVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { return matvecmult(frame, RClosures.createDoubleToComplexVector(a, na), b); } @Specialization(guards = "vecmat") - public RComplexVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { + protected RComplexVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractComplexVector b) { return vecmatmult(frame, RClosures.createDoubleToComplexVector(a, na), b); } @Specialization(guards = "matmat") - public RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { + protected RComplexVector matmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { return matmatmult(frame, a, RClosures.createDoubleToComplexVector(b, na)); } @Specialization(guards = "vecvec") - public RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { + protected RComplexVector vecvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { return vecvecmult(frame, a, RClosures.createDoubleToComplexVector(b, na)); } @Specialization(guards = "matvec") - public RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { + protected RComplexVector matvecmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { return matvecmult(frame, a, RClosures.createDoubleToComplexVector(b, na)); } @Specialization(guards = "vecmat") - public RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { + protected RComplexVector vecmatmult(VirtualFrame frame, RAbstractComplexVector a, RAbstractDoubleVector b) { return vecmatmult(frame, a, RClosures.createDoubleToComplexVector(b, na)); } // to double @Specialization(guards = "matmat") - public RDoubleVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { + protected RDoubleVector matmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { return matmatmult(frame, RClosures.createIntToDoubleVector(a, na), b); } @Specialization(guards = "vecvec") - public RDoubleVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { + protected RDoubleVector vecvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { return vecvecmult(frame, RClosures.createIntToDoubleVector(a, na), b); } @Specialization(guards = "matvec") - public RDoubleVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { + protected RDoubleVector matvecmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { return matvecmult(frame, RClosures.createIntToDoubleVector(a, na), b); } @Specialization(guards = "vecmat") - public RDoubleVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { + protected RDoubleVector vecmatmult(VirtualFrame frame, RAbstractIntVector a, RAbstractDoubleVector b) { return vecmatmult(frame, RClosures.createIntToDoubleVector(a, na), b); } @Specialization(guards = "matmat") - public RDoubleVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { + protected RDoubleVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { return matmatmult(frame, a, RClosures.createIntToDoubleVector(b, na)); } @Specialization(guards = "vecvec") - public RDoubleVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { + protected RDoubleVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { return vecvecmult(frame, a, RClosures.createIntToDoubleVector(b, na)); } @Specialization(guards = "matvec") - public RDoubleVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { + protected RDoubleVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { return matvecmult(frame, a, RClosures.createIntToDoubleVector(b, na)); } @Specialization(guards = "vecmat") - public RDoubleVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { + protected RDoubleVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractIntVector b) { return vecmatmult(frame, a, RClosures.createIntToDoubleVector(b, na)); } @Specialization(guards = "matmat") - public RDoubleVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { + protected RDoubleVector matmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { return matmatmult(frame, RClosures.createLogicalToDoubleVector(a, na), b); } @Specialization(guards = "vecvec") - public RDoubleVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { + protected RDoubleVector vecvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { return vecvecmult(frame, RClosures.createLogicalToDoubleVector(a, na), b); } @Specialization(guards = "matvec") - public RDoubleVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { + protected RDoubleVector matvecmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { return matvecmult(frame, RClosures.createLogicalToDoubleVector(a, na), b); } @Specialization(guards = "vecmat") - public RDoubleVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { + protected RDoubleVector vecmatmult(VirtualFrame frame, RAbstractLogicalVector a, RAbstractDoubleVector b) { return vecmatmult(frame, RClosures.createLogicalToDoubleVector(a, na), b); } @Specialization(guards = "matmat") - public RDoubleVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { + protected RDoubleVector matmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { return matmatmult(frame, a, RClosures.createLogicalToDoubleVector(b, na)); } @Specialization(guards = "vecvec") - public RDoubleVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { + protected RDoubleVector vecvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { return vecvecmult(frame, a, RClosures.createLogicalToDoubleVector(b, na)); } @Specialization(guards = "matvec") - public RDoubleVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { + protected RDoubleVector matvecmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { return matvecmult(frame, a, RClosures.createLogicalToDoubleVector(b, na)); } @Specialization(guards = "vecmat") - public RDoubleVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { + protected RDoubleVector vecmatmult(VirtualFrame frame, RAbstractDoubleVector a, RAbstractLogicalVector b) { return vecmatmult(frame, a, RClosures.createLogicalToDoubleVector(b, na)); } @@ -679,25 +679,25 @@ public abstract class MatMult extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RDoubleVector doRaw(VirtualFrame frame, RAbstractRawVector a, Object b) { + protected RDoubleVector doRaw(VirtualFrame frame, RAbstractRawVector a, Object b) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NUMERIC_COMPLEX_MATRIX_VECTOR); } @SuppressWarnings("unused") @Specialization - public RDoubleVector doRaw(VirtualFrame frame, Object a, RAbstractRawVector b) { + protected RDoubleVector doRaw(VirtualFrame frame, Object a, RAbstractRawVector b) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NUMERIC_COMPLEX_MATRIX_VECTOR); } @SuppressWarnings("unused") @Specialization - public RDoubleVector doString(VirtualFrame frame, RAbstractStringVector a, Object b) { + protected RDoubleVector doString(VirtualFrame frame, RAbstractStringVector a, Object b) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NUMERIC_COMPLEX_MATRIX_VECTOR); } @SuppressWarnings("unused") @Specialization - public RDoubleVector doString(VirtualFrame frame, Object a, RAbstractStringVector b) { + protected RDoubleVector doString(VirtualFrame frame, Object a, RAbstractStringVector b) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.NUMERIC_COMPLEX_MATRIX_VECTOR); } 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 33cc1dbe7bc26b74795150b8e5db538f0a4b3450..a7f0fb244faa77f28d07133275b13b3af78a8d6d 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 @@ -70,19 +70,19 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RNull x, RAbstractVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RNull x, RAbstractVector table, Object nomatchObj, Object incomparables) { return RDataFactory.createIntVector(0); } @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractVector x, RNull table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractVector x, RNull table, Object nomatchObj, Object incomparables) { return RDataFactory.createIntVector(x.getLength()); } @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractIntVector x, RAbstractIntVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractIntVector x, RAbstractIntVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -104,7 +104,7 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractDoubleVector x, RAbstractIntVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractDoubleVector x, RAbstractIntVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -126,7 +126,7 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractIntVector x, RAbstractDoubleVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractIntVector x, RAbstractDoubleVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -148,7 +148,7 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractDoubleVector x, RAbstractDoubleVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractDoubleVector x, RAbstractDoubleVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -170,7 +170,7 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractStringVector x, RAbstractStringVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractStringVector x, RAbstractStringVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -192,7 +192,7 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractLogicalVector x, RAbstractLogicalVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractLogicalVector x, RAbstractLogicalVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -213,7 +213,7 @@ public abstract class Match extends RBuiltinNode { @Specialization(guards = "!isStringVectorX") @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractStringVector x, RAbstractVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractStringVector x, RAbstractVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -235,7 +235,7 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RAbstractComplexVector x, RAbstractComplexVector table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RAbstractComplexVector x, RAbstractComplexVector table, Object nomatchObj, Object incomparables) { controlVisibility(); int nomatch = castInt(frame, nomatchObj); int[] result = initResult(x.getLength(), nomatch); @@ -257,13 +257,13 @@ public abstract class Match extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, RFunction x, Object table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, RFunction x, Object table, Object nomatchObj, Object incomparables) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MATCH_VECTOR_ARGS); } @Specialization @SuppressWarnings("unused") - public RIntVector match(VirtualFrame frame, Object x, RFunction table, Object nomatchObj, Object incomparables) { + protected RIntVector match(VirtualFrame frame, Object x, RFunction table, Object nomatchObj, Object incomparables) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MATCH_VECTOR_ARGS); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java index 37f35d5c452973c0ca595be738e6316cfece2380..67a1d22f6a7d79f327a7aa8cc7ea4d17d244f517 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java @@ -49,14 +49,14 @@ public abstract class MatchFun extends RBuiltinNode { // FIXME implement actual semantics (lookup in caller environment) @Specialization - public RFunction matchFun(RFunction fun, @SuppressWarnings("unused") byte descend) { + protected RFunction matchFun(RFunction fun, @SuppressWarnings("unused") byte descend) { return fun; } @Child protected ReadVariableNode lookup; @Specialization - public Object matchFun(VirtualFrame frame, String fun, @SuppressWarnings("unused") byte descend) { + protected Object matchFun(VirtualFrame frame, String fun, @SuppressWarnings("unused") byte descend) { controlVisibility(); if (lookup == null || !fun.equals(lastFun)) { CompilerDirectives.transferToInterpreterAndInvalidate(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Matrix.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Matrix.java index ae568d3fd93b35bea254a1660da49463a3de1189..cfdfea8b110152638b1c8060bbe6a2a358b80029 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Matrix.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Matrix.java @@ -64,7 +64,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "isByRow") @SuppressWarnings("unused") - public Object matrixByRow(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected Object matrixByRow(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); RVector vdata = data.materialize(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); @@ -74,7 +74,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "isByRow") @SuppressWarnings("unused") - public Object matrixByRow(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected Object matrixByRow(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); RVector vdata = data.materialize(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); @@ -84,7 +84,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "isByRow") @SuppressWarnings("unused") - public Object matrixByRow(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected Object matrixByRow(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); RVector vdata = data.materialize(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); @@ -94,7 +94,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "isByRow") @SuppressWarnings("unused") - public Object matrixByRow(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected Object matrixByRow(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); int[] rowColByRow = new int[]{nrowncol[1], nrowncol[0]}; @@ -103,7 +103,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "!isByRow") @SuppressWarnings("unused") - public RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); return data.copyResized(nrowncol[0] * nrowncol[1], false).copyWithNewDimensions(nrowncol); @@ -111,7 +111,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "!isByRow") @SuppressWarnings("unused") - public RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RAbstractVector ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); return data.copyResized(nrowncol[0] * nrowncol[1], false).copyWithNewDimensions(nrowncol); @@ -119,7 +119,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "!isByRow") @SuppressWarnings("unused") - public RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RAbstractVector nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); return data.copyResized(nrowncol[0] * nrowncol[1], false).copyWithNewDimensions(nrowncol); @@ -127,7 +127,7 @@ public abstract class Matrix extends RBuiltinNode { @Specialization(guards = "!isByRow") @SuppressWarnings("unused") - public RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { + protected RAbstractVector matrix(VirtualFrame frame, RAbstractVector data, RMissing nrowp, RMissing ncolp, byte byrow, RNull dimnames, byte missingNr, byte missingNc) { controlVisibility(); int[] nrowncol = computeNrowNcol(frame, data, nrowp, ncolp); return data.copyResized(nrowncol[0] * nrowncol[1], false).copyWithNewDimensions(nrowncol); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mean.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mean.java index a0b1239dc14b518800ec29f04da24ab1e5cde7a1..66222b9f71a9b0987cb1e825706ab52ccce4e738 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mean.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mean.java @@ -48,7 +48,7 @@ public abstract class Mean extends RBuiltinNode { @Child protected BinaryArithmetic div = BinaryArithmetic.DIV.create(); @Specialization - public double mean(RAbstractDoubleVector x) { + protected double mean(RAbstractDoubleVector x) { controlVisibility(); double sum = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { @@ -58,7 +58,7 @@ public abstract class Mean extends RBuiltinNode { } @Specialization - public double mean(RAbstractIntVector x) { + protected double mean(RAbstractIntVector x) { controlVisibility(); double sum = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { @@ -68,7 +68,7 @@ public abstract class Mean extends RBuiltinNode { } @Specialization - public double mean(RAbstractLogicalVector x) { + protected double mean(RAbstractLogicalVector x) { controlVisibility(); double sum = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { @@ -78,7 +78,7 @@ public abstract class Mean extends RBuiltinNode { } @Specialization - public RComplex mean(RAbstractComplexVector x) { + protected RComplex mean(RAbstractComplexVector x) { controlVisibility(); RComplex sum = x.getDataAt(0); RComplex comp; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Missing.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Missing.java index cb7a224a4e3f8e2acda9027934d277729fc0837b..c54a0e2f6c75a63e83dfd8110c9da206b2f00803 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Missing.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Missing.java @@ -35,13 +35,13 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class Missing extends RBuiltinNode { @Specialization - public byte missing(VirtualFrame frame, RPromise promise) { + protected byte missing(VirtualFrame frame, RPromise promise) { controlVisibility(); return RRuntime.asLogical(RMissingHelper.isMissing(frame, promise)); } @Specialization - public byte missing(VirtualFrame frame, Object obj) { + protected byte missing(VirtualFrame frame, Object obj) { controlVisibility(); return RRuntime.asLogical(RMissingHelper.isMissing(frame, obj)); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mod.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mod.java index 1d7973b820eb8e63b9409604f5b15d3d5e45e3c6..56a958c6226fd122375ffab744259206e3a7b25b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mod.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Mod.java @@ -40,8 +40,8 @@ public abstract class Mod extends RBuiltinNode { @Child protected BinaryArithmeticNode add = BinaryArithmeticNode.create(BinaryArithmetic.ADD); @Child protected Sqrt sqrt = SqrtFactory.create(new RNode[1], getBuiltin(), getSuppliedArgsNames()); - @Specialization() - public RDoubleVector mod(RAbstractComplexVector vec) { + @Specialization + protected RDoubleVector mod(RAbstractComplexVector vec) { controlVisibility(); double[] data = new double[vec.getLength()]; for (int i = 0; i < vec.getLength(); i++) { @@ -50,5 +50,4 @@ public abstract class Mod extends RBuiltinNode { } return RDataFactory.createDoubleVector(data, RDataFactory.COMPLETE_VECTOR); } - } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NArgs.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NArgs.java index 6308e0ad7de97f53dae1c32d5a4e9a3057f87f7d..d4287d9071e55e2297e7a464369b78fff0ccb21d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NArgs.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NArgs.java @@ -34,7 +34,7 @@ import com.oracle.truffle.r.runtime.data.*; @RBuiltin(name = "nargs", kind = PRIMITIVE, parameterNames = {}) public abstract class NArgs extends RBuiltinNode { @Specialization - public int doNArgs(VirtualFrame frame) { + protected int doNArgs(VirtualFrame frame) { int result = 0; if (RArguments.getFunction(frame) == null) { return RRuntime.INT_NA; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NChar.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NChar.java index 8a59a6b4a1e753752a782a354d08c64e6b41d622..55096754465e2426ff88bf2464f5450e6442568f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NChar.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NChar.java @@ -62,35 +62,35 @@ public abstract class NChar extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RIntVector rev(VirtualFrame frame, RNull value, String type, byte allowNA) { + protected RIntVector rev(VirtualFrame frame, RNull value, String type, byte allowNA) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @SuppressWarnings("unused") @Specialization - public int rev(VirtualFrame frame, int value, String type, byte allowNA) { + protected int rev(VirtualFrame frame, int value, String type, byte allowNA) { controlVisibility(); return coerceContent(frame, value).length(); } @SuppressWarnings("unused") @Specialization - public int rev(VirtualFrame frame, double value, String type, byte allowNA) { + protected int rev(VirtualFrame frame, double value, String type, byte allowNA) { controlVisibility(); return coerceContent(frame, value).length(); } @SuppressWarnings("unused") @Specialization - public int rev(VirtualFrame frame, byte value, String type, byte allowNA) { + protected int rev(VirtualFrame frame, byte value, String type, byte allowNA) { controlVisibility(); return coerceContent(frame, value).length(); } @SuppressWarnings("unused") @Specialization - public RIntVector rev(RStringVector vector, String type, byte allowNA) { + protected RIntVector rev(RStringVector vector, String type, byte allowNA) { controlVisibility(); int len = vector.getLength(); int[] result = new int[len]; @@ -102,7 +102,7 @@ public abstract class NChar extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RIntVector rev(VirtualFrame frame, RAbstractVector vector, String type, byte allowNA) { + protected RIntVector rev(VirtualFrame frame, RAbstractVector vector, String type, byte allowNA) { controlVisibility(); int len = vector.getLength(); int[] result = new int[len]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NGetText.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NGetText.java index 7fef72000b9eeb02da2bd2c9ad8f5324339fdcd5..ff62693f94c1c528c7fac58cc5e67e9baf30fc03 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NGetText.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NGetText.java @@ -50,48 +50,48 @@ public abstract class NGetText extends RBuiltinNode { } @Specialization(guards = "wrongNVector") - public String getTextEmpty(VirtualFrame frame, RAbstractIntVector nVector, String msg1, String msg2, Object domain) { + protected String getTextEmpty(VirtualFrame frame, RAbstractIntVector nVector, String msg1, String msg2, Object domain) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "n"); } @Specialization(guards = "!wrongNVector") - public String getText(RAbstractIntVector nVector, String msg1, String msg2, Object domain) { + protected String getText(RAbstractIntVector nVector, String msg1, String msg2, Object domain) { int n = nVector.getDataAt(0); return n == 1 ? msg1 : msg2; } @Specialization(guards = "!wrongNVector") - public String getTextMsg1Null(VirtualFrame frame, RAbstractIntVector nVector, RNull msg1, RNull msg2, Object domain) { + protected String getTextMsg1Null(VirtualFrame frame, RAbstractIntVector nVector, RNull msg1, RNull msg2, Object domain) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_STRING, "msg1"); } @Specialization(guards = "!wrongNVector") - public String getTextMsg1Null(VirtualFrame frame, RAbstractIntVector nVector, RNull msg1, RAbstractVector msg2, Object domain) { + protected String getTextMsg1Null(VirtualFrame frame, RAbstractIntVector nVector, RNull msg1, RAbstractVector msg2, Object domain) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_STRING, "msg1"); } @Specialization(guards = {"!wrongNVector", "!msg1StringVectorOneElem"}) - public String getTextMsg1WrongMsg2Null(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RNull msg2, Object domain) { + protected String getTextMsg1WrongMsg2Null(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RNull msg2, Object domain) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_STRING, "msg1"); } @Specialization(guards = {"!wrongNVector", "!msg1StringVectorOneElem"}) - public String getTextMsg1Wrong(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RAbstractVector msg2, Object domain) { + protected String getTextMsg1Wrong(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RAbstractVector msg2, Object domain) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_STRING, "msg1"); } @Specialization(guards = {"!wrongNVector", "msg1StringVectorOneElem"}) - public String getTextMsg1(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RNull msg2, Object domain) { + protected String getTextMsg1(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RNull msg2, Object domain) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_STRING, "msg2"); } @Specialization(guards = {"!wrongNVector", "msg1StringVectorOneElem", "!msg2StringVectorOneElem"}) - public String getTextMsg2Wrong(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RAbstractVector msg2, Object domain) { + protected String getTextMsg2Wrong(VirtualFrame frame, RAbstractIntVector nVector, RAbstractVector msg1, RAbstractVector msg2, Object domain) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MUST_BE_STRING, "msg2"); } @Specialization(guards = {"!wrongNVector", "msg1StringVectorOneElem", "msg2StringVectorOneElem"}) - public String getTextMsg1(RAbstractIntVector nVector, RAbstractVector msg1, RAbstractVector msg2, Object domain) { + protected String getTextMsg1(RAbstractIntVector nVector, RAbstractVector msg1, RAbstractVector msg2, Object domain) { return getText(nVector, ((RAbstractStringVector) msg1).getDataAt(0), ((RAbstractStringVector) msg2).getDataAt(0), domain); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NZChar.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NZChar.java index 5fff9e143f2103bc42cb28f1535b3ad5d3d556d3..d277a575fac0bbc6c629cfa64c37cb3aeaf8fded 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NZChar.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NZChar.java @@ -56,31 +56,31 @@ public abstract class NZChar extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RLogicalVector rev(VirtualFrame frame, RNull value) { + protected RLogicalVector rev(VirtualFrame frame, RNull value) { controlVisibility(); return RDataFactory.createEmptyLogicalVector(); } @Specialization - public byte rev(VirtualFrame frame, int value) { + protected byte rev(VirtualFrame frame, int value) { controlVisibility(); return isNonZeroLength(coerceContent(frame, value)); } @Specialization - public byte rev(VirtualFrame frame, double value) { + protected byte rev(VirtualFrame frame, double value) { controlVisibility(); return isNonZeroLength(coerceContent(frame, value)); } @Specialization - public byte rev(VirtualFrame frame, byte value) { + protected byte rev(VirtualFrame frame, byte value) { controlVisibility(); return isNonZeroLength(coerceContent(frame, value)); } @Specialization - public RLogicalVector rev(RStringVector vector) { + protected RLogicalVector rev(RStringVector vector) { controlVisibility(); int len = vector.getLength(); byte[] result = new byte[len]; @@ -91,7 +91,7 @@ public abstract class NZChar extends RBuiltinNode { } @Specialization - public RLogicalVector rev(VirtualFrame frame, RAbstractVector vector) { + protected RLogicalVector rev(VirtualFrame frame, RAbstractVector vector) { controlVisibility(); int len = vector.getLength(); byte[] result = new byte[len]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Names.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Names.java index 45578069593e3614266aae00d0d5f45cbca29ca6..1c2e5b4b40a2b3837c8a2d22ba4d953fb0eff1a2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Names.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Names.java @@ -35,61 +35,61 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class Names extends RBuiltinNode { @Specialization - public RNull getNames(RNull vector) { + protected RNull getNames(RNull vector) { controlVisibility(); return RNull.instance; } @Specialization - public RNull getNames(byte operand) { + protected RNull getNames(byte operand) { controlVisibility(); return RNull.instance; } @Specialization - public RNull getNames(int operand) { + protected RNull getNames(int operand) { controlVisibility(); return RNull.instance; } @Specialization - public RNull getNames(double operand) { + protected RNull getNames(double operand) { controlVisibility(); return RNull.instance; } @Specialization - public RNull getNames(RComplex operand) { + protected RNull getNames(RComplex operand) { controlVisibility(); return RNull.instance; } @Specialization - public RNull getNames(String operand) { + protected RNull getNames(String operand) { controlVisibility(); return RNull.instance; } @Specialization - public RNull getNames(RRaw operand) { + protected RNull getNames(RRaw operand) { controlVisibility(); return RNull.instance; } @Specialization - public RNull getNames(RFunction function) { + protected RNull getNames(RFunction function) { controlVisibility(); return RNull.instance; } @Specialization(guards = "!hasNames") - public RNull getEmptyNames(RAbstractContainer container) { + protected RNull getEmptyNames(RAbstractContainer container) { controlVisibility(); return RNull.instance; } @Specialization(guards = "hasNames") - public RStringVector getNames(RAbstractContainer container) { + protected RStringVector getNames(RAbstractContainer container) { controlVisibility(); return (RStringVector) container.getNames(); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NamespaceFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NamespaceFunctions.java index f25b90d1d95a74e84806a1805d6e587c7c0643f1..f430d8fdca6ae2437983b37477fe8527a1d194dc 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NamespaceFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NamespaceFunctions.java @@ -35,7 +35,7 @@ public class NamespaceFunctions { @RBuiltin(name = "getRegisteredNamespace", kind = INTERNAL, parameterNames = {"name"}) public abstract static class GetRegisteredNamespace extends RBuiltinNode { @Specialization - public Object doGetRegisteredNamespace(String name) { + protected Object doGetRegisteredNamespace(String name) { controlVisibility(); Object result = REnvironment.getRegisteredNamespace(name); if (result == null) { @@ -46,7 +46,7 @@ public class NamespaceFunctions { } @Specialization - public Object doGetRegisteredNamespace(RSymbol name) { + protected Object doGetRegisteredNamespace(RSymbol name) { controlVisibility(); return doGetRegisteredNamespace(name.getName()); } @@ -55,7 +55,7 @@ public class NamespaceFunctions { @RBuiltin(name = "isNamespaceEnv", kind = INTERNAL, parameterNames = {"env"}) public abstract static class IsNamespaceEnv extends RBuiltinNode { @Specialization - public byte doIsNamespaceEnv(REnvironment env) { + protected byte doIsNamespaceEnv(REnvironment env) { controlVisibility(); return RRuntime.asLogical(env.isNamespaceEnv()); } @@ -64,7 +64,7 @@ public class NamespaceFunctions { @RBuiltin(name = "getNamespaceRegistry", kind = INTERNAL, parameterNames = {}) public abstract static class GetNamespaceRegistry extends RBuiltinNode { @Specialization - public REnvironment doGetNamespaceRegistry(@SuppressWarnings("unused") RMissing missing) { + protected REnvironment doGetNamespaceRegistry(@SuppressWarnings("unused") RMissing missing) { controlVisibility(); return REnvironment.getNamespaceRegistry(); } @@ -73,7 +73,7 @@ public class NamespaceFunctions { @RBuiltin(name = "registerNamespace", kind = INTERNAL, parameterNames = {"name", "env"}) public abstract static class RegisterNamespace extends RBuiltinNode { @Specialization - public RNull registerNamespace(String name, REnvironment env) { + protected RNull registerNamespace(String name, REnvironment env) { controlVisibility(); REnvironment.registerNamespace(name, env); return RNull.instance; @@ -83,14 +83,14 @@ public class NamespaceFunctions { @RBuiltin(name = "unregisterNamespace", kind = INTERNAL, parameterNames = {"name"}) public abstract static class UnregisterNamespace extends RBuiltinNode { @Specialization - public RNull unregisterNamespace(@SuppressWarnings("unused") RAbstractStringVector name) { + protected RNull unregisterNamespace(@SuppressWarnings("unused") RAbstractStringVector name) { controlVisibility(); // TODO implement return RNull.instance; } @Specialization - public Object unregisterNamespace(@SuppressWarnings("unused") RSymbol name) { + protected Object unregisterNamespace(@SuppressWarnings("unused") RSymbol name) { controlVisibility(); // TODO implement return RNull.instance; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NextMethod.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NextMethod.java index 1fde5b21acadf523859ed808273bd8fc8c72c70d..4c4bd3d361608075b6e83dede60798a626895e30 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NextMethod.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NextMethod.java @@ -38,7 +38,7 @@ public abstract class NextMethod extends RBuiltinNode { } @Specialization - public Object nextMethod(VirtualFrame frame, String genericMethod, @SuppressWarnings("unused") Object obj, Object[] args) { + protected Object nextMethod(VirtualFrame frame, String genericMethod, @SuppressWarnings("unused") Object obj, Object[] args) { controlVisibility(); final RStringVector type = readType(frame); final String genericName = readGenericName(frame, genericMethod); @@ -55,13 +55,13 @@ public abstract class NextMethod extends RBuiltinNode { } @Specialization - public Object nextMethod(VirtualFrame frame, @SuppressWarnings("unused") RNull generic, @SuppressWarnings("unused") RNull obj, @SuppressWarnings("unused") RMissing args) { + protected Object nextMethod(VirtualFrame frame, @SuppressWarnings("unused") RNull generic, @SuppressWarnings("unused") RNull obj, @SuppressWarnings("unused") RMissing args) { controlVisibility(); return nextMethod(frame, null, null, new Object[0]); } @Specialization - public Object nextMethod(VirtualFrame frame, String generic, Object obj, @SuppressWarnings("unused") RMissing args) { + protected Object nextMethod(VirtualFrame frame, String generic, Object obj, @SuppressWarnings("unused") RMissing args) { controlVisibility(); return nextMethod(frame, generic, obj, new Object[0]); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NormalizePath.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NormalizePath.java index 7ac30f8e2be19042fdd8142a966c0e2134a7dd8d..f5d478e1fe8646b004cea5cb905506b1aee4bd67 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NormalizePath.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/NormalizePath.java @@ -40,7 +40,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class NormalizePath extends RBuiltinNode { @Specialization - public RStringVector doNormalizePath(VirtualFrame frame, RAbstractStringVector pathVec, @SuppressWarnings("unused") String winslash, byte mustWork) { + protected RStringVector doNormalizePath(VirtualFrame frame, RAbstractStringVector pathVec, @SuppressWarnings("unused") String winslash, byte mustWork) { controlVisibility(); String[] results = new String[pathVec.getLength()]; FileSystem fileSystem = FileSystems.getDefault(); @@ -78,7 +78,7 @@ public abstract class NormalizePath extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object doNormalizePath(VirtualFrame frame, Object path, Object winslash, Object mustWork) { + protected Object doNormalizePath(VirtualFrame frame, Object path, Object winslash, Object mustWork) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.WRONG_TYPE); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OnExit.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OnExit.java index 47e6cf797c51afe8b4053df098a931b38daec89a..72fdd3b70b593ea8e3be40a59c450f03613eb9e5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OnExit.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OnExit.java @@ -45,14 +45,14 @@ public abstract class OnExit extends RInvisibleBuiltinNode { } @Specialization - public Object onExit(@SuppressWarnings("unused") RPromise expr, @SuppressWarnings("unused") byte add) { + protected Object onExit(@SuppressWarnings("unused") RPromise expr, @SuppressWarnings("unused") byte add) { controlVisibility(); RContext.getInstance().setEvalWarning("on.exit ignored"); return RNull.instance; } @Specialization - public Object onExit(@SuppressWarnings("unused") RNull expr, @SuppressWarnings("unused") byte add) { + protected Object onExit(@SuppressWarnings("unused") RNull expr, @SuppressWarnings("unused") byte add) { controlVisibility(); RContext.getInstance().setEvalWarning("on.exit ignored"); return RNull.instance; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Options.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Options.java index 206885dd58f66ed71f49c6a6ef69101383d169cf..a5d3306ab08927acf38e790df7bffc242318eac2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Options.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Options.java @@ -59,7 +59,7 @@ public abstract class Options extends RBuiltinNode { } @Specialization - public Object options(VirtualFrame frame, Object args) { + protected Object options(VirtualFrame frame, Object args) { controlVisibility(); if (args instanceof RMissing) { return options((RMissing) args); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java index e600fb88fb35463e338d8d76b7f6b115a07bd367..b98cbf6802a4a16f9efce5deccebb743faac19d6 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Order.java @@ -54,7 +54,7 @@ public abstract class Order extends RBuiltinNode { // specialisations for one parameter @Specialization - public RIntVector order(RStringVector x, @SuppressWarnings("unused") RMissing tie) { + protected RIntVector order(RStringVector x, @SuppressWarnings("unused") RMissing tie) { controlVisibility(); String[] xs = x.getDataCopy(); int[] ord = ordArray(xs.length); @@ -63,7 +63,7 @@ public abstract class Order extends RBuiltinNode { } @Specialization - public RIntVector order(RDoubleVector x, @SuppressWarnings("unused") RMissing tie) { + protected RIntVector order(RDoubleVector x, @SuppressWarnings("unused") RMissing tie) { controlVisibility(); double[] xs = x.getDataCopy(); int[] ord = ordArray(xs.length); @@ -72,7 +72,7 @@ public abstract class Order extends RBuiltinNode { } @Specialization - public RIntVector order(RIntVector x, @SuppressWarnings("unused") RMissing tie) { + protected RIntVector order(RIntVector x, @SuppressWarnings("unused") RMissing tie) { controlVisibility(); int[] xs = x.getDataCopy(); int[] ord = ordArray(xs.length); @@ -81,13 +81,13 @@ public abstract class Order extends RBuiltinNode { } @Specialization - public RIntVector order(RIntVector x, @SuppressWarnings("unused") RNull nul) { + protected RIntVector order(RIntVector x, @SuppressWarnings("unused") RNull nul) { controlVisibility(); return order(x, RMissing.instance); } @Specialization - public RIntVector order(RComplexVector x, @SuppressWarnings("unused") RMissing tie) { + protected RIntVector order(RComplexVector x, @SuppressWarnings("unused") RMissing tie) { controlVisibility(); double[] xs = x.getDataCopy(); int[] ord = ordArray(x.getLength()); @@ -98,7 +98,7 @@ public abstract class Order extends RBuiltinNode { // specialisations for vector and tie parameters @Specialization - public RIntVector order(RIntVector x, RStringVector tie) { + protected RIntVector order(RIntVector x, RStringVector tie) { controlVisibility(); int[] t = order(tie, RMissing.instance).getDataWithoutCopying(); int[] xs = x.getDataCopy(); @@ -109,7 +109,7 @@ public abstract class Order extends RBuiltinNode { } @Specialization - public RIntVector order(RDoubleVector x, RStringVector tie) { + protected RIntVector order(RDoubleVector x, RStringVector tie) { controlVisibility(); int[] t = order(tie, RMissing.instance).getDataWithoutCopying(); double[] xs = x.getDataCopy(); @@ -120,7 +120,7 @@ public abstract class Order extends RBuiltinNode { } @Specialization - public RIntVector order(RDoubleVector x, RDoubleVector tie) { + protected RIntVector order(RDoubleVector x, RDoubleVector tie) { controlVisibility(); int[] t = order(tie, RMissing.instance).getDataWithoutCopying(); double[] xs = x.getDataCopy(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PMatch.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PMatch.java index 741387cf1aad96d193caf9175cea00cca0133e72..3543224957d30f18d988491151867d3c78500dc8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PMatch.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PMatch.java @@ -49,7 +49,7 @@ public abstract class PMatch extends RBuiltinNode { } @Specialization - public RIntVector doPMatch(RAbstractStringVector x, RAbstractStringVector table, int nomatch, byte duplicatesOk) { + protected RIntVector doPMatch(RAbstractStringVector x, RAbstractStringVector table, int nomatch, byte duplicatesOk) { int xl = x.getLength(); int tl = table.getLength(); boolean dupsOk = RRuntime.fromLogical(duplicatesOk); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java index 05a47814a4c99d84fc9c82565cbd081ae16d2914..9b716fdb099abb084272365f3568c000dda4aadb 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java @@ -46,7 +46,7 @@ public abstract class Parse extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object parse(VirtualFrame frame, RConnection conn, RNull n, RNull text, String prompt, RNull srcFile, String encoding) { + protected Object parse(VirtualFrame frame, RConnection conn, RNull n, RNull text, String prompt, RNull srcFile, String encoding) { controlVisibility(); try { String[] lines = conn.readLines(0); @@ -58,7 +58,7 @@ public abstract class Parse extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object parse(VirtualFrame frame, RConnection conn, double n, RNull text, String prompt, RNull srcFile, String encoding) { + protected Object parse(VirtualFrame frame, RConnection conn, double n, RNull text, String prompt, RNull srcFile, String encoding) { controlVisibility(); try { String[] lines = conn.readLines((int) n); @@ -70,7 +70,7 @@ public abstract class Parse extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "isText") - public Object parse(VirtualFrame frame, RConnection conn, RNull n, String text, String prompt, RNull srcFile, String encoding) { + protected Object parse(VirtualFrame frame, RConnection conn, RNull n, String text, String prompt, RNull srcFile, String encoding) { controlVisibility(); try { return doParse(text); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste.java index 572853ace4afea4ff2bf78765f579b0e31bf8f38..d1ef4594f0a9b9cd6865f8197594ab253d827241 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste.java @@ -70,12 +70,12 @@ public abstract class Paste extends RBuiltinNode { } @Specialization - public RStringVector pasteList(VirtualFrame frame, RList values, String sep, RNull collapse) { + protected RStringVector pasteList(VirtualFrame frame, RList values, String sep, RNull collapse) { return pasteList(frame, values, sep, (Object) collapse); } @Specialization - public RStringVector pasteList(VirtualFrame frame, RList values, String sep, Object collapse) { + protected RStringVector pasteList(VirtualFrame frame, RList values, String sep, Object collapse) { controlVisibility(); if (isEmptyOrNull(values)) { return RDataFactory.createEmptyStringVector(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste0.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste0.java index 86265d64f78fa6d7773593588345b19fe94478a1..84554b563aa8d103fd2c6a4147af32a009f5d6be 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste0.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Paste0.java @@ -57,7 +57,7 @@ public abstract class Paste0 extends RBuiltinNode { } @Specialization - public Object paste0(VirtualFrame frame, RList values, Object collapse) { + protected Object paste0(VirtualFrame frame, RList values, Object collapse) { controlVisibility(); return paste(frame, values, collapse); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PathExpand.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PathExpand.java index c0cc467cdbc22de1a3b7049229173d96929745b1..64f78e024e11906ec436805beb603cf308f62333 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PathExpand.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PathExpand.java @@ -35,7 +35,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class PathExpand extends RBuiltinNode { @Specialization - public Object doPathExpand(RAbstractStringVector vec) { + protected Object doPathExpand(RAbstractStringVector vec) { controlVisibility(); String[] results = new String[vec.getLength()]; for (int i = 0; i < results.length; i++) { @@ -46,7 +46,7 @@ public abstract class PathExpand extends RBuiltinNode { } @Specialization - public Object doPathExpandGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object path) { + protected Object doPathExpandGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object path) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "path"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java index 17b1c21395fe2d49adfa6d8534e0f7582574cf1c..8576637c1bbc7f465c80d774f2e8e03e43c59878 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PrettyPrinterNode.java @@ -115,13 +115,13 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrint(RNull operand, Object listElementName, byte quote) { + protected String prettyPrint(RNull operand, Object listElementName, byte quote) { return "NULL"; } @SlowPath @Specialization - public String prettyPrintVector(byte operand, Object listElementName, byte quote) { + protected String prettyPrintVector(byte operand, Object listElementName, byte quote) { return concat("[1] ", prettyPrint(operand)); } @@ -137,7 +137,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintVector(int operand, Object listElementName, byte quote) { + protected String prettyPrintVector(int operand, Object listElementName, byte quote) { return concat("[1] ", prettyPrint(operand)); } @@ -147,7 +147,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintVector(double operand, Object listElementName, byte quote) { + protected String prettyPrintVector(double operand, Object listElementName, byte quote) { return concat("[1] ", prettyPrint(operand)); } @@ -161,7 +161,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintVector(RComplex operand, Object listElementName, byte quote) { + protected String prettyPrintVector(RComplex operand, Object listElementName, byte quote) { return concat("[1] ", prettyPrint(operand)); } @@ -173,7 +173,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintVector(String operand, Object listElementName, byte quote) { + protected String prettyPrintVector(String operand, Object listElementName, byte quote) { return concat("[1] ", prettyPrint(operand)); } @@ -183,7 +183,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintVector(RRaw operand, Object listElementName, byte quote) { + protected String prettyPrintVector(RRaw operand, Object listElementName, byte quote) { return concat("[1] ", prettyPrint(operand)); } @@ -193,13 +193,13 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrint(RFunction operand, Object listElementName, byte quote) { + protected String prettyPrint(RFunction operand, Object listElementName, byte quote) { return ((RRootNode) operand.getTarget().getRootNode()).getSourceCode(); } @SlowPath @Specialization - public String prettyPrint(REnvironment operand, Object listElementName, byte quote) { + protected String prettyPrint(REnvironment operand, Object listElementName, byte quote) { RAttributes attributes = operand.getAttributes(); if (attributes == null) { return operand.toString(); @@ -214,7 +214,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrint(RExpression expr, Object listElementName, byte quote) { + protected String prettyPrint(RExpression expr, Object listElementName, byte quote) { StringBuilder builder = new StringBuilder(); builder.append("expression("); RList exprs = expr.getList(); @@ -230,13 +230,13 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintSymbol(RSymbol operand, Object listElementName, byte quote) { + protected String prettyPrintSymbol(RSymbol operand, Object listElementName, byte quote) { return operand.getName(); } @SlowPath @Specialization - public String prettyPrintPromise(RPromise promise, Object listElementName, byte quote) { + protected String prettyPrintPromise(RPromise promise, Object listElementName, byte quote) { if (promise.isEvaluated()) { return prettyPrintRecursive(promise.getValue(), listElementName, quote); } else { @@ -246,7 +246,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintLanguage(RLanguage language, Object listElementName, byte quote) { + protected String prettyPrintLanguage(RLanguage language, Object listElementName, byte quote) { return prettyPrintLanguageRep(language, listElementName); } @@ -262,7 +262,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintPairList(RPairList pairList, Object listElementName, byte quote) { + protected String prettyPrintPairList(RPairList pairList, Object listElementName, byte quote) { StringBuilder sb = new StringBuilder(); RPairList pl = pairList; while (pl != null) { @@ -285,13 +285,13 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintMissing(RMissing missing, Object listElementName, byte quote) { + protected String prettyPrintMissing(RMissing missing, Object listElementName, byte quote) { return ""; } @SlowPath @Specialization - public String prettyPrintFormula(RFormula formula, Object listElementName, byte quote) { + protected String prettyPrintFormula(RFormula formula, Object listElementName, byte quote) { return formula.getSource().getCode(); } @@ -580,37 +580,37 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "twoDimsOrMore") - public String prettyPrintM(RList operand, Object listElementName, byte quote) { + protected String prettyPrintM(RList operand, Object listElementName, byte quote) { return printVectorMultiDim(operand, true, false); } @SlowPath @Specialization(guards = "twoDimsOrMore") - public String prettyPrintM(RAbstractStringVector operand, Object listElementName, byte quote) { + protected String prettyPrintM(RAbstractStringVector operand, Object listElementName, byte quote) { return printVectorMultiDim(operand, true, false); } @SlowPath @Specialization(guards = "twoDimsOrMore") - public String prettyPrintM(RAbstractComplexVector operand, Object listElementName, byte quote) { + protected String prettyPrintM(RAbstractComplexVector operand, Object listElementName, byte quote) { return printVectorMultiDim(operand, false, true); } @SlowPath @Specialization(guards = "twoDimsOrMore") - public String prettyPrintM(RAbstractRawVector operand, Object listElementName, byte quote) { + protected String prettyPrintM(RAbstractRawVector operand, Object listElementName, byte quote) { return printVectorMultiDim(operand, false, true); } @SlowPath @Specialization(guards = "twoDimsOrMore") - public String prettyPrintM(RAbstractVector operand, Object listElementName, byte quote) { + protected String prettyPrintM(RAbstractVector operand, Object listElementName, byte quote) { return printVectorMultiDim(operand, false, false); } @SlowPath @Specialization(guards = "!twoDimsOrMore") - public String prettyPrint(RList operand, Object listElementName, byte quote) { + protected String prettyPrint(RList operand, Object listElementName, byte quote) { return prettyPrintList0(operand, listElementName, quote); } @@ -636,7 +636,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!twoDimsOrMore") - public String prettyPrint(RAbstractDoubleVector operand, Object listElementName, byte quote) { + protected String prettyPrint(RAbstractDoubleVector operand, Object listElementName, byte quote) { int length = operand.getLength(); String[] values = new String[length]; double maxRoundFactor = getMaxRoundFactor(operand); @@ -651,7 +651,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!twoDimsOrMore") - public String prettyPrint(RAbstractIntVector operand, Object listElementName, byte quote) { + protected String prettyPrint(RAbstractIntVector operand, Object listElementName, byte quote) { int length = operand.getLength(); String[] values = new String[length]; for (int i = 0; i < length; i++) { @@ -663,7 +663,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!twoDimsOrMore") - public String prettyPrint(RAbstractStringVector operand, Object listElementName, byte quote) { + protected String prettyPrint(RAbstractStringVector operand, Object listElementName, byte quote) { int length = operand.getLength(); String[] values = new String[length]; for (int i = 0; i < length; i++) { @@ -679,7 +679,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!twoDimsOrMore") - public String prettyPrint(RAbstractLogicalVector operand, Object listElementName, byte quote) { + protected String prettyPrint(RAbstractLogicalVector operand, Object listElementName, byte quote) { int length = operand.getLength(); String[] values = new String[length]; for (int i = 0; i < length; i++) { @@ -691,7 +691,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!twoDimsOrMore") - public String prettyPrint(RAbstractRawVector operand, Object listElementName, byte quote) { + protected String prettyPrint(RAbstractRawVector operand, Object listElementName, byte quote) { int length = operand.getLength(); String[] values = new String[length]; for (int i = 0; i < length; i++) { @@ -703,7 +703,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!twoDimsOrMore") - public String prettyPrint(RAbstractComplexVector operand, Object listElementName, byte quote) { + protected String prettyPrint(RAbstractComplexVector operand, Object listElementName, byte quote) { if (re == null) { // the two are allocated side by side; checking for re is sufficient CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -736,7 +736,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrint(RDataFrame operand, Object listElementName, byte quote) { + protected String prettyPrint(RDataFrame operand, Object listElementName, byte quote) { if (operand.getVector().getLength() == 0) { return "data frame with 0 columns and 0 rows"; @@ -945,73 +945,73 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintListElement(RNull operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(RNull operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(byte operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(byte operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(int operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(int operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(double operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(double operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(RComplex operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(RComplex operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(String operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(String operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(RRaw operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(RRaw operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(RAbstractVector operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(RAbstractVector operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(RSymbol operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(RSymbol operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(RLanguage operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(RLanguage operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(REnvironment operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(REnvironment operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @SlowPath @Specialization - public String prettyPrintListElement(RFunction operand, Object listElementName, byte quote) { + protected String prettyPrintListElement(RFunction operand, Object listElementName, byte quote) { return prettyPrintSingleElement(operand, listElementName, quote); } @@ -1034,61 +1034,61 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String prettyPrintVectorElement(RNull operand) { + protected String prettyPrintVectorElement(RNull operand) { return "NULL"; } @SlowPath @Specialization - public String prettyPrintVectorElement(byte operand) { + protected String prettyPrintVectorElement(byte operand) { return prettyPrint(operand); } @SlowPath @Specialization - public String prettyPrintVectorElement(int operand) { + protected String prettyPrintVectorElement(int operand) { return prettyPrint(operand); } @SlowPath @Specialization - public String prettyPrintVectorElement(double operand) { + protected String prettyPrintVectorElement(double operand) { return prettyPrint(operand); } @SlowPath @Specialization - public String prettyPrintVectorElement(RComplex operand) { + protected String prettyPrintVectorElement(RComplex operand) { return prettyPrint(operand); } @SlowPath @Specialization - public String prettyPrintVectorElement(String operand) { + protected String prettyPrintVectorElement(String operand) { return prettyPrint(operand); } @SlowPath @Specialization - public String prettyPrintVectorElement(RRaw operand) { + protected String prettyPrintVectorElement(RRaw operand) { return prettyPrint(operand); } @SlowPath @Specialization - public String prettyPrintVectorElement(RList operand) { + protected String prettyPrintVectorElement(RList operand) { return prettyPrint(operand); } @SlowPath @Specialization(guards = {"!isLengthOne", "!isVectorList"}) - public String prettyPrintVectorElement(RAbstractVector operand) { + protected String prettyPrintVectorElement(RAbstractVector operand) { return prettyPrint(operand); } @SlowPath @Specialization(guards = {"isLengthOne", "!isVectorList"}) - public String prettyPrintVectorElementLengthOne(RAbstractVector operand) { + protected String prettyPrintVectorElementLengthOne(RAbstractVector operand) { return prettyPrintRecursive(operand.getDataAtAsObject(0)); } @@ -1132,7 +1132,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String printVectorMultiDim(RAbstractVector vector, byte isListOrStringVector, byte isComplexOrRawVector) { + protected String printVectorMultiDim(RAbstractVector vector, byte isListOrStringVector, byte isComplexOrRawVector) { int[] dimensions = vector.getDimensions(); RIntVector dimensionsVector = RDataFactory.createIntVector(dimensions, RDataFactory.COMPLETE_VECTOR); assert dimensions != null; @@ -1227,7 +1227,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "isEmpty") - public String printVector2DimEmpty(RAbstractVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { + protected String printVector2DimEmpty(RAbstractVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { int nrow = dimensions.getDataAt(0); int ncol = dimensions.getDataAt(1); @@ -1264,7 +1264,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!isEmpty") - public String printVector2Dim(RAbstractDoubleVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { + protected String printVector2Dim(RAbstractDoubleVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { int nrow = dimensions.getDataAt(0); int ncol = dimensions.getDataAt(1); @@ -1326,7 +1326,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = "!isEmpty") - public String printVector2Dim(RAbstractComplexVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { + protected String printVector2Dim(RAbstractComplexVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { int nrow = dimensions.getDataAt(0); int ncol = dimensions.getDataAt(1); @@ -1381,7 +1381,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization(guards = {"!isEmpty", "notDoubleOrComplex"}) - public String printVector2Dim(RAbstractVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { + protected String printVector2Dim(RAbstractVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { int nrow = dimensions.getDataAt(0); int ncol = dimensions.getDataAt(1); @@ -1540,15 +1540,15 @@ public abstract class PrettyPrinterNode extends RNode { return builderToString(b); } - public boolean isEmpty(RAbstractVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { + protected boolean isEmpty(RAbstractVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { return vector.getLength() == 0; } - public boolean isEmpty(RAbstractDoubleVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { + protected boolean isEmpty(RAbstractDoubleVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { return vector.getLength() == 0; } - public boolean isEmpty(RAbstractComplexVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { + protected boolean isEmpty(RAbstractComplexVector vector, RIntVector dimensions, int offset, byte isListOrStringVector, byte isComplexOrRawVector) { return vector.getLength() == 0; } @@ -1583,7 +1583,7 @@ public abstract class PrettyPrinterNode extends RNode { @SlowPath @Specialization - public String printDim(RAbstractVector vector, byte isListOrStringVector, byte isComplexOrRawVector, int currentDimLevel, int arrayBase, int accDimensions, String header) { + protected String printDim(RAbstractVector vector, byte isListOrStringVector, byte isComplexOrRawVector, int currentDimLevel, int arrayBase, int accDimensions, String header) { int[] dimensions = vector.getDimensions(); RIntVector dimensionsVector = RDataFactory.createIntVector(dimensions, RDataFactory.COMPLETE_VECTOR); StringBuilder sb = new StringBuilder(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Print.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Print.java index e4e7f4b6ebfde694400363b6c9b86b64332280b1..ecc840973e6f05c4cfe7ad3f934f12e876c01e5c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Print.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Print.java @@ -50,7 +50,7 @@ public abstract class Print extends RInvisibleBuiltinNode { } @Specialization - public Object print(VirtualFrame frame, Object o, byte quote) { + protected Object print(VirtualFrame frame, Object o, byte quote) { String s = (String) prettyPrinter.executeString(frame, o, null, quote); if (s != null && !s.isEmpty()) { printHelper(s); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ProcTime.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ProcTime.java index 90c23bb5ae833e2c7caa5963b27148829d8ef55f..58407f38f15d05c97f0f4f2b53fef35900abb3f2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ProcTime.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ProcTime.java @@ -40,7 +40,7 @@ public abstract class ProcTime extends RBuiltinNode { private static RStringVector RNAMES; @Specialization - public RDoubleVector procTime() { + protected RDoubleVector procTime() { controlVisibility(); double[] data = new double[5]; long nowInNanos = RContext.getEngine().elapsedTimeInNanos(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Prod.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Prod.java index db64598b9bf51051197eaa918a8c15c0d1027463..682d58c8fdecc2ad4b84d0b6649d539a2363870f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Prod.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Prod.java @@ -40,7 +40,7 @@ public abstract class Prod extends RBuiltinNode { @Child protected BinaryArithmetic prod = BinaryArithmetic.MULTIPLY.create(); @Specialization - public double prod(RAbstractDoubleVector x) { + protected double prod(RAbstractDoubleVector x) { controlVisibility(); double product = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { @@ -50,7 +50,7 @@ public abstract class Prod extends RBuiltinNode { } @Specialization - public double prod(RAbstractIntVector x) { + protected double prod(RAbstractIntVector x) { controlVisibility(); double product = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { @@ -60,7 +60,7 @@ public abstract class Prod extends RBuiltinNode { } @Specialization - public double prod(RAbstractLogicalVector x) { + protected double prod(RAbstractLogicalVector x) { controlVisibility(); double product = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { @@ -70,7 +70,7 @@ public abstract class Prod extends RBuiltinNode { } @Specialization - public RComplex prod(RAbstractComplexVector x) { + protected RComplex prod(RAbstractComplexVector x) { controlVisibility(); RComplex product = x.getDataAt(0); for (int k = 1; k < x.getLength(); ++k) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quit.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quit.java index 4d103aaaa9ae4f5befe11407016b166d0f5464d7..8cf759290520b1459f8e0dde3991c6bc0686f0c5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quit.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quit.java @@ -42,7 +42,7 @@ public abstract class Quit extends RInvisibleBuiltinNode { } @Specialization - public Object doQuit(final String saveArg, int status, byte runLast) { + protected Object doQuit(final String saveArg, int status, byte runLast) { controlVisibility(); String save = saveArg; RContext.ConsoleHandler consoleHandler = RContext.getInstance().getConsoleHandler(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quote.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quote.java index 74459208e3a69190ac68f59bacbf94d16dc71ecd..807a1f69dc8e6b1bbe25f581aa1ab480799d9a70 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quote.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quote.java @@ -42,12 +42,12 @@ public abstract class Quote extends RBuiltinNode { public abstract Object execute(VirtualFrame frame, RPromise expr); @Specialization - public RLanguage doQuote(VirtualFrame frame, @SuppressWarnings("unused") RMissing arg) { + protected RLanguage doQuote(VirtualFrame frame, @SuppressWarnings("unused") RMissing arg) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENTS_PASSED_0_1, getRBuiltin().name()); } @Specialization - public Object doQuote(RPromise expr) { + protected Object doQuote(RPromise expr) { controlVisibility(); // GnuR creates symbols for simple variables and actual values for constants RNode node = (RNode) expr.getRep(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/R/lazyLoad.R b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/R/lazyLoad.R index 12988564d6ac3ea879f7f4fae288346c0b5bbef3..542650d647822168d410036e394aff90110f012d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/R/lazyLoad.R +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/R/lazyLoad.R @@ -30,7 +30,8 @@ lazyLoadDBexec <- function(filebase, fun, filter) ## - not that this version is actually used to load base ## glue <- function (..., sep = " ", collapse = NULL) - .Internal(paste(list(...), sep, collapse)) + # argument hack as per standard pase + .Internal(paste(list(...), sep = sep, collapse = collapse)) readRDS <- function (file) { halt <- function (message) .Internal(stop(TRUE, message)) gzfile <- function (description, open) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RNGFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RNGFunctions.java index e675a7ce84dca6a1211cd32e5de53aff9463a859..f884dd2afc29824c4a590d518d2976c31f2afbe3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RNGFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RNGFunctions.java @@ -46,7 +46,7 @@ public class RNGFunctions { @SuppressWarnings("unused") @Specialization - public RNull setSeed(VirtualFrame frame, double seed, RNull kind, RNull normKind) { + protected RNull setSeed(VirtualFrame frame, double seed, RNull kind, RNull normKind) { controlVisibility(); doSetSeed(frame, (int) seed, RRNG.NO_KIND_CHANGE, RRNG.NO_KIND_CHANGE); return RNull.instance; @@ -54,7 +54,7 @@ public class RNGFunctions { @SuppressWarnings("unused") @Specialization - public RNull setSeed(VirtualFrame frame, double seed, RAbstractIntVector kind, RNull normKind) { + protected RNull setSeed(VirtualFrame frame, double seed, RAbstractIntVector kind, RNull normKind) { controlVisibility(); doSetSeed(frame, (int) seed, kind.getDataAt(0), RRNG.NO_KIND_CHANGE); return RNull.instance; @@ -62,7 +62,7 @@ public class RNGFunctions { @SuppressWarnings("unused") @Specialization - public RNull setSeed(VirtualFrame frame, RNull seed, RNull kind, RNull normKind) { + protected RNull setSeed(VirtualFrame frame, RNull seed, RNull kind, RNull normKind) { controlVisibility(); doSetSeed(frame, RRNG.RESET_SEED, RRNG.NO_KIND_CHANGE, RRNG.NO_KIND_CHANGE); return RNull.instance; @@ -70,7 +70,7 @@ public class RNGFunctions { @SuppressWarnings("unused") @Specialization - public RNull setSeed(VirtualFrame frame, byte seed, RNull kind, RNull normKind) { + protected RNull setSeed(VirtualFrame frame, byte seed, RNull kind, RNull normKind) { controlVisibility(); CompilerDirectives.transferToInterpreter(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SEED_NOT_VALID_INT); @@ -95,13 +95,13 @@ public class RNGFunctions { @Specialization @SuppressWarnings("unused") - public RIntVector doRNGkind(VirtualFrame frame, RNull x, RNull y) { + protected RIntVector doRNGkind(VirtualFrame frame, RNull x, RNull y) { controlVisibility(); return getCurrent(); } @Specialization - public RIntVector doRNGkind(VirtualFrame frame, RAbstractIntVector kind, @SuppressWarnings("unused") RNull normKind) { + protected RIntVector doRNGkind(VirtualFrame frame, RAbstractIntVector kind, @SuppressWarnings("unused") RNull normKind) { controlVisibility(); RIntVector result = getCurrent(); try { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RVersion.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RVersion.java index 2a05e5c74510494ea4a7b540f07a2ba9a1068dd4..3168ac7176581ccc9fe84fe427a86b3e92fdfee3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RVersion.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RVersion.java @@ -33,7 +33,7 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class RVersion extends RBuiltinNode { @Specialization - public Object doRVersion(@SuppressWarnings("unused") RMissing x) { + protected Object doRVersion(@SuppressWarnings("unused") RMissing x) { controlVisibility(); return RDataFactory.createList(RVersionInfo.listValues(), RDataFactory.createStringVector(RVersionInfo.listNames(), RDataFactory.COMPLETE_VECTOR)); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RawBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RawBuiltin.java index 528eac774b842f6d4ae7e9b6b02f6f41aea167ec..23428afa77391a922cd49d285bd7a1ae469f1bca 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RawBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RawBuiltin.java @@ -34,20 +34,20 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class RawBuiltin extends RBuiltinNode { @Specialization - public Object createRawVector(int length) { + protected Object createRawVector(int length) { controlVisibility(); return RDataFactory.createRawVector(length); } @Specialization - public Object createRawVector(double length) { + protected Object createRawVector(double length) { controlVisibility(); return RDataFactory.createRawVector((int) length); } @SuppressWarnings("unused") @Specialization - public Object createRawVector(RMissing length) { + protected Object createRawVector(RMissing length) { controlVisibility(); return RDataFactory.createRawVector(0); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Re.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Re.java index 2099ad9e33c264fba1296dd80a1dc22a51641d30..395d3410d3067fdf78d92e97f099e80cf84eeb4a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Re.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Re.java @@ -40,7 +40,7 @@ public abstract class Re extends RBuiltinNode { private NACheck check = NACheck.create(); @Specialization - public RDoubleVector re(RAbstractComplexVector vector) { + protected RDoubleVector re(RAbstractComplexVector vector) { controlVisibility(); double[] result = new double[vector.getLength()]; check.enable(vector); @@ -52,9 +52,8 @@ public abstract class Re extends RBuiltinNode { } @Specialization - public RDoubleVector re(RAbstractDoubleVector vector) { + protected RDoubleVector re(RAbstractDoubleVector vector) { controlVisibility(); return (RDoubleVector) vector.copy(); } - } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java index 06f17ef8fe9e0d7b5b21439b354aa9bcae803f15..e386bf18544961967cd269e6aaa9716c3503f8c9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadDCF.java @@ -38,7 +38,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class ReadDCF extends RBuiltinNode { @Specialization - public RStringVector doReadDCF(VirtualFrame frame, RConnection conn, RAbstractStringVector fields, @SuppressWarnings("unused") RNull keepWhite) { + protected RStringVector doReadDCF(VirtualFrame frame, RConnection conn, RAbstractStringVector fields, @SuppressWarnings("unused") RNull keepWhite) { try { DCF dcf = DCF.read(conn.readLines(0)); if (dcf == null) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadREnviron.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadREnviron.java index b58cc70f827fdde33b6180c4aadd7da259037390..d31f16cfe19dc033d1fbcd0cbe22bdfd390daa5e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadREnviron.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ReadREnviron.java @@ -37,7 +37,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class ReadREnviron extends RInvisibleBuiltinNode { @Specialization(guards = "lengthOneCVector") - public Object doReadEnviron(VirtualFrame frame, RAbstractStringVector vec) { + protected Object doReadEnviron(VirtualFrame frame, RAbstractStringVector vec) { controlVisibility(); String path = Utils.tildeExpand(vec.getDataAt(0)); byte result = RRuntime.LOGICAL_TRUE; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Repeat.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Repeat.java index 1c503f1e967e8895e6bbf7fc46a37d468e2ae806..08ac7a8236df66c0e9cce826cdadf353142a7f1a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Repeat.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Repeat.java @@ -43,8 +43,8 @@ import com.oracle.truffle.r.runtime.data.model.*; @RBuiltin(name = "rep", kind = PRIMITIVE, parameterNames = {"x", "times", "length.out", "each"}) public abstract class Repeat extends RBuiltinNode { - BranchProfile withNames = new BranchProfile(); - BranchProfile noNames = new BranchProfile(); + private final BranchProfile withNames = new BranchProfile(); + private final BranchProfile noNames = new BranchProfile(); @Override public RNode[] getParameterValues() { @@ -61,7 +61,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RNull repeat(VirtualFrame frame, RNull value, Object times, Object lengthOut, Object each) { + protected RNull repeat(VirtualFrame frame, RNull value, Object times, Object lengthOut, Object each) { controlVisibility(); return RNull.instance; } @@ -75,7 +75,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector repeat(int value, int times, RMissing lengthOut, Object each) { + protected RIntVector repeat(int value, int times, RMissing lengthOut, Object each) { controlVisibility(); int[] array = new int[times]; Arrays.fill(array, value); @@ -84,19 +84,19 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public int repeatLengthNA(int value, Object times, int lengthOut, Object each) { + protected int repeatLengthNA(int value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RIntVector repeat(int value, Object times, int lengthOut, Object each) { + protected RIntVector repeat(int value, Object times, int lengthOut, Object each) { return repeat(value, lengthOut, RMissing.instance, each); } @Specialization @SuppressWarnings("unused") - public RDoubleVector repeat(double value, int times, RMissing lengthOut, Object each) { + protected RDoubleVector repeat(double value, int times, RMissing lengthOut, Object each) { controlVisibility(); double[] array = new double[times]; Arrays.fill(array, value); @@ -105,19 +105,19 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public double repeatLengthNA(double value, Object times, int lengthOut, Object each) { + protected double repeatLengthNA(double value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RDoubleVector repeat(double value, Object times, int lengthOut, Object each) { + protected RDoubleVector repeat(double value, Object times, int lengthOut, Object each) { return repeat(value, lengthOut, RMissing.instance, each); } @Specialization @SuppressWarnings("unused") - public RRawVector repeat(RRaw value, int times, RMissing lengthOut, Object each) { + protected RRawVector repeat(RRaw value, int times, RMissing lengthOut, Object each) { controlVisibility(); byte[] array = new byte[times]; Arrays.fill(array, value.getValue()); @@ -126,19 +126,19 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RRaw repeatLengthNA(RRaw value, Object times, int lengthOut, Object each) { + protected RRaw repeatLengthNA(RRaw value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RRawVector repeat(RRaw value, Object times, int lengthOut, Object each) { + protected RRawVector repeat(RRaw value, Object times, int lengthOut, Object each) { return repeat(value, lengthOut, RMissing.instance, each); } @Specialization @SuppressWarnings("unused") - public RComplexVector repeat(RComplex value, int times, RMissing lengthOut, Object each) { + protected RComplexVector repeat(RComplex value, int times, RMissing lengthOut, Object each) { controlVisibility(); double[] array = new double[times << 1]; for (int i = 0; i < times; ++i) { @@ -151,19 +151,19 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RComplex repeatLengthNA(RComplex value, Object times, int lengthOut, Object each) { + protected RComplex repeatLengthNA(RComplex value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RComplexVector repeat(RComplex value, Object times, int lengthOut, Object each) { + protected RComplexVector repeat(RComplex value, Object times, int lengthOut, Object each) { return repeat(value, lengthOut, RMissing.instance, each); } @Specialization @SuppressWarnings("unused") - public RStringVector repeat(String value, int times, RMissing lengthOut, Object each) { + protected RStringVector repeat(String value, int times, RMissing lengthOut, Object each) { controlVisibility(); String[] array = new String[times]; Arrays.fill(array, value); @@ -172,19 +172,19 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public String repeatLengthNA(String value, Object times, int lengthOut, Object each) { + protected String repeatLengthNA(String value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RStringVector repeat(String value, Object times, int lengthOut, Object each) { + protected RStringVector repeat(String value, Object times, int lengthOut, Object each) { return repeat(value, lengthOut, RMissing.instance, each); } @Specialization @SuppressWarnings("unused") - public RLogicalVector repeat(byte value, int times, RMissing lengthOut, Object each) { + protected RLogicalVector repeat(byte value, int times, RMissing lengthOut, Object each) { controlVisibility(); byte[] array = new byte[times]; Arrays.fill(array, value); @@ -193,13 +193,13 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public byte repeatLengthNA(byte value, Object times, int lengthOut, Object each) { + protected byte repeatLengthNA(byte value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RLogicalVector repeat(byte value, Object times, int lengthOut, Object each) { + protected RLogicalVector repeat(byte value, Object times, int lengthOut, Object each) { return repeat(value, lengthOut, RMissing.instance, each); } @@ -234,7 +234,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RIntVector repeat(RAbstractIntVector value, int times, RMissing lengthOut, Object each) { + protected RIntVector repeat(RAbstractIntVector value, int times, RMissing lengthOut, Object each) { controlVisibility(); int oldLength = value.getLength(); int length = oldLength * times; @@ -255,13 +255,13 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RAbstractIntVector repeatLengthNA(RAbstractIntVector value, Object times, int lengthOut, Object each) { + protected RAbstractIntVector repeatLengthNA(RAbstractIntVector value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RIntVector repeat(RAbstractIntVector value, Object times, int lengthOut, Object each) { + protected RIntVector repeat(RAbstractIntVector value, Object times, int lengthOut, Object each) { controlVisibility(); int[] array = new int[lengthOut]; for (int i = 0, j = 0; i < lengthOut; ++i, j = Utils.incMod(j, value.getLength())) { @@ -278,7 +278,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RDoubleVector repeat(RAbstractDoubleVector value, int times, RMissing lengthOut, Object each) { + protected RDoubleVector repeat(RAbstractDoubleVector value, int times, RMissing lengthOut, Object each) { controlVisibility(); int oldLength = value.getLength(); int length = value.getLength() * times; @@ -299,13 +299,13 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RAbstractDoubleVector repeatLengthNA(RAbstractDoubleVector value, Object times, int lengthOut, Object each) { + protected RAbstractDoubleVector repeatLengthNA(RAbstractDoubleVector value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RDoubleVector repeat(RAbstractDoubleVector value, Object times, int lengthOut, Object each) { + protected RDoubleVector repeat(RAbstractDoubleVector value, Object times, int lengthOut, Object each) { controlVisibility(); double[] array = new double[lengthOut]; for (int i = 0, j = 0; i < lengthOut; ++i, j = Utils.incMod(j, value.getLength())) { @@ -322,7 +322,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RRawVector repeat(RRawVector value, int times, RMissing lengthOut, Object each) { + protected RRawVector repeat(RRawVector value, int times, RMissing lengthOut, Object each) { controlVisibility(); int oldLength = value.getLength(); int length = oldLength * times; @@ -343,13 +343,13 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RRawVector repeatLengthNA(RRawVector value, Object times, int lengthOut, Object each) { + protected RRawVector repeatLengthNA(RRawVector value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RRawVector repeat(RRawVector value, Object times, int lengthOut, Object each) { + protected RRawVector repeat(RRawVector value, Object times, int lengthOut, Object each) { controlVisibility(); byte[] array = new byte[lengthOut]; for (int i = 0, j = 0; i < lengthOut; ++i, j = Utils.incMod(j, value.getLength())) { @@ -366,7 +366,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RComplexVector repeat(RComplexVector value, int times, RMissing lengthOut, Object each) { + protected RComplexVector repeat(RComplexVector value, int times, RMissing lengthOut, Object each) { controlVisibility(); int oldLength = value.getLength(); int length = value.getLength() * times; @@ -390,13 +390,13 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RComplexVector repeatLengthNA(RComplexVector value, Object times, int lengthOut, Object each) { + protected RComplexVector repeatLengthNA(RComplexVector value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RComplexVector repeat(RComplexVector value, Object times, int lengthOut, Object each) { + protected RComplexVector repeat(RComplexVector value, Object times, int lengthOut, Object each) { controlVisibility(); int length = lengthOut << 1; double[] array = new double[length]; @@ -416,7 +416,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RLogicalVector repeat(RAbstractLogicalVector value, int times, RMissing lengthOut, Object each) { + protected RLogicalVector repeat(RAbstractLogicalVector value, int times, RMissing lengthOut, Object each) { controlVisibility(); int oldLength = value.getLength(); int length = value.getLength() * times; @@ -437,13 +437,13 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RAbstractLogicalVector repeatLengthNA(RAbstractLogicalVector value, Object times, int lengthOut, Object each) { + protected RAbstractLogicalVector repeatLengthNA(RAbstractLogicalVector value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RLogicalVector repeat(RAbstractLogicalVector value, Object times, int lengthOut, Object each) { + protected RLogicalVector repeat(RAbstractLogicalVector value, Object times, int lengthOut, Object each) { controlVisibility(); byte[] array = new byte[lengthOut]; for (int i = 0, j = 0; i < lengthOut; ++i, j = Utils.incMod(j, value.getLength())) { @@ -460,7 +460,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RStringVector repeat(RAbstractStringVector value, int times, RMissing lengthOut, Object each) { + protected RStringVector repeat(RAbstractStringVector value, int times, RMissing lengthOut, Object each) { controlVisibility(); int oldLength = value.getLength(); int length = value.getLength() * times; @@ -481,13 +481,13 @@ public abstract class Repeat extends RBuiltinNode { @Specialization(guards = "lengthNA") @SuppressWarnings("unused") - public RAbstractStringVector repeatLengthNA(RAbstractStringVector value, Object times, int lengthOut, Object each) { + protected RAbstractStringVector repeatLengthNA(RAbstractStringVector value, Object times, int lengthOut, Object each) { return value; } @Specialization(guards = "!lengthNA") @SuppressWarnings("unused") - public RStringVector repeat(RAbstractStringVector value, Object times, int lengthOut, Object each) { + protected RStringVector repeat(RAbstractStringVector value, Object times, int lengthOut, Object each) { controlVisibility(); String[] array = new String[lengthOut]; for (int i = 0, j = 0; i < lengthOut; ++i, j = Utils.incMod(j, value.getLength())) { @@ -520,7 +520,7 @@ public abstract class Repeat extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RAbstractVector repeatTV(VirtualFrame frame, RAbstractVector value, RIntVector times, RMissing lengthOut, Object each) { + protected RAbstractVector repeatTV(VirtualFrame frame, RAbstractVector value, RIntVector times, RMissing lengthOut, Object each) { controlVisibility(); if (value.getLength() != times.getLength()) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "times"); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java index 0e6c3bb5575916a1bce396cd8307f6e4bd27ce09..7d5f8c350ffc655db1ff1bc2a85970b856c892e3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java @@ -46,7 +46,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RDoubleVector repInt(double value, int times) { + protected RDoubleVector repInt(double value, int times) { controlVisibility(); double[] array = new double[times]; Arrays.fill(array, value); @@ -54,7 +54,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RRawVector repInt(RRaw value, int times) { + protected RRawVector repInt(RRaw value, int times) { controlVisibility(); byte[] array = new byte[times]; Arrays.fill(array, value.getValue()); @@ -62,7 +62,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RIntVector repInt(RIntSequence value, int times) { + protected RIntVector repInt(RIntSequence value, int times) { controlVisibility(); int oldLength = value.getLength(); int length = oldLength * times; @@ -76,7 +76,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RDoubleVector repInt(RDoubleVector value, int times) { + protected RDoubleVector repInt(RDoubleVector value, int times) { controlVisibility(); int oldLength = value.getLength(); int length = value.getLength() * times; @@ -90,7 +90,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RIntVector repInt(int value, int times) { + protected RIntVector repInt(int value, int times) { controlVisibility(); int[] array = new int[times]; Arrays.fill(array, value); @@ -98,7 +98,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RStringVector repInt(String value, int times) { + protected RStringVector repInt(String value, int times) { controlVisibility(); String[] array = new String[times]; Arrays.fill(array, value); @@ -106,7 +106,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RStringVector repInt(VirtualFrame frame, RStringVector value, RIntVector timesVec) { + protected RStringVector repInt(VirtualFrame frame, RStringVector value, RIntVector timesVec) { controlVisibility(); int valueLength = value.getLength(); int times = timesVec.getLength(); @@ -141,7 +141,7 @@ public abstract class RepeatInternal extends RBuiltinNode { } @Specialization - public RList repList(RList value, int times) { + protected RList repList(RList value, int times) { controlVisibility(); int oldLength = value.getLength(); int length = value.getLength() * times; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatLength.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatLength.java index 9f6241b4fcd9cf216f48935f19a2fc6008acc03b..82b9e6f68f2a12860cfc4b941b5e576df40ef4a3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatLength.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatLength.java @@ -35,7 +35,7 @@ public abstract class RepeatLength extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public RNull repLen(RNull value, int length) { + protected RNull repLen(RNull value, int length) { controlVisibility(); return RNull.instance; } @@ -44,7 +44,7 @@ public abstract class RepeatLength extends RBuiltinNode { // Specialization for single values // @Specialization - public RRawVector repLen(RRaw value, int length) { + protected RRawVector repLen(RRaw value, int length) { controlVisibility(); byte[] array = new byte[length]; Arrays.fill(array, value.getValue()); @@ -52,7 +52,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RIntVector repLen(int value, int length) { + protected RIntVector repLen(int value, int length) { controlVisibility(); int[] array = new int[length]; Arrays.fill(array, length); @@ -60,7 +60,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RDoubleVector repLen(double value, int length) { + protected RDoubleVector repLen(double value, int length) { controlVisibility(); double[] array = new double[length]; Arrays.fill(array, value); @@ -68,7 +68,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RStringVector repLen(String value, int length) { + protected RStringVector repLen(String value, int length) { controlVisibility(); String[] array = new String[length]; Arrays.fill(array, value); @@ -76,7 +76,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RComplexVector repLen(RComplex value, int length) { + protected RComplexVector repLen(RComplex value, int length) { controlVisibility(); int complexLength = length * 2; double[] array = new double[complexLength]; @@ -88,7 +88,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RLogicalVector repLen(byte value, int length) { + protected RLogicalVector repLen(byte value, int length) { controlVisibility(); byte[] array = new byte[length]; Arrays.fill(array, value); @@ -99,7 +99,7 @@ public abstract class RepeatLength extends RBuiltinNode { // Specialization for vector values // @Specialization - public RIntVector repLen(RAbstractIntVector value, int length) { + protected RIntVector repLen(RAbstractIntVector value, int length) { controlVisibility(); int[] array = new int[length]; for (int i = 0, j = 0; i < length; i++, j = Utils.incMod(j, value.getLength())) { @@ -109,7 +109,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RDoubleVector repLen(RDoubleVector value, int length) { + protected RDoubleVector repLen(RDoubleVector value, int length) { controlVisibility(); double[] array = new double[length]; for (int i = 0, j = 0; i < length; i++, j = Utils.incMod(j, value.getLength())) { @@ -119,7 +119,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RStringVector repLen(RStringVector vectorToRepeat, int length) { + protected RStringVector repLen(RStringVector vectorToRepeat, int length) { controlVisibility(); String[] result = new String[length]; int vectorToRepeatLength = vectorToRepeat.getLength(); @@ -130,7 +130,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RRawVector repLen(RRawVector value, int length) { + protected RRawVector repLen(RRawVector value, int length) { controlVisibility(); byte[] array = new byte[length]; for (int i = 0, j = 0; i < length; i++, j = Utils.incMod(j, value.getLength())) { @@ -140,7 +140,7 @@ public abstract class RepeatLength extends RBuiltinNode { } @Specialization - public RComplexVector repLen(RComplexVector value, int length) { + protected RComplexVector repLen(RComplexVector value, int length) { controlVisibility(); final int resultLength = length * 2; double[] array = new double[resultLength]; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java index 2bb9a8adc628a76c984782d5d6717bc0b063ef1f..c95eb8a7380fd8032e3c940f57ad9df2cd22605f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java @@ -43,7 +43,7 @@ public abstract class Return extends RBuiltinNode { } @Specialization - public Object returnFunction(Object value) { + protected Object returnFunction(Object value) { controlVisibility(); throw new ReturnException(value); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rev.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rev.java index cf4c04b49b3cf76cb04a2c69730e1d15a09aa17d..5eaec67f80d888e7b03b587eff455ab7c091c822 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rev.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rev.java @@ -34,43 +34,43 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class Rev extends RBuiltinNode { @Specialization - public int rev(int value) { + protected int rev(int value) { controlVisibility(); return value; } - @Specialization() - public double rev(double value) { + @Specialization + protected double rev(double value) { controlVisibility(); return value; } @Specialization - public byte rev(byte value) { + protected byte rev(byte value) { controlVisibility(); return value; } @Specialization - public String rev(String value) { + protected String rev(String value) { controlVisibility(); return value; } @Specialization - public RComplex asInteger(RComplex value) { + protected RComplex asInteger(RComplex value) { controlVisibility(); return value; } @Specialization - public RRaw asInteger(RRaw value) { + protected RRaw asInteger(RRaw value) { controlVisibility(); return value; } @Specialization - public RNull asInteger(RNull value) { + protected RNull asInteger(RNull value) { controlVisibility(); return value; } @@ -90,7 +90,7 @@ public abstract class Rev extends RBuiltinNode { } @Specialization - public RIntVector rev(RIntVector vector) { + protected RIntVector rev(RIntVector vector) { controlVisibility(); int len = vector.getLength(); int[] result = new int[len]; @@ -101,7 +101,7 @@ public abstract class Rev extends RBuiltinNode { } @Specialization - public RDoubleVector rev(RDoubleVector vector) { + protected RDoubleVector rev(RDoubleVector vector) { controlVisibility(); int len = vector.getLength(); double[] result = new double[len]; @@ -112,7 +112,7 @@ public abstract class Rev extends RBuiltinNode { } @Specialization - public RStringVector rev(RStringVector vector) { + protected RStringVector rev(RStringVector vector) { controlVisibility(); int len = vector.getLength(); String[] result = new String[len]; @@ -123,7 +123,7 @@ public abstract class Rev extends RBuiltinNode { } @Specialization - public RLogicalVector rev(RLogicalVector vector) { + protected RLogicalVector rev(RLogicalVector vector) { controlVisibility(); int len = vector.getLength(); byte[] result = new byte[len]; @@ -134,7 +134,7 @@ public abstract class Rev extends RBuiltinNode { } @Specialization - public RComplexVector rev(RComplexVector vector) { + protected RComplexVector rev(RComplexVector vector) { controlVisibility(); int len = vector.getLength(); double[] result = new double[len * 2]; @@ -148,7 +148,7 @@ public abstract class Rev extends RBuiltinNode { } @Specialization - public RRawVector rev(RRawVector vector) { + protected RRawVector rev(RRawVector vector) { controlVisibility(); int len = vector.getLength(); byte[] result = new byte[len]; @@ -159,14 +159,14 @@ public abstract class Rev extends RBuiltinNode { } @Specialization - public RIntSequence rev(RIntSequence sequence) { + protected RIntSequence rev(RIntSequence sequence) { controlVisibility(); int start = sequence.getStart() + (sequence.getLength() - 1) * sequence.getStride(); return RDataFactory.createIntSequence(start, -sequence.getStride(), sequence.getLength()); } @Specialization - public RDoubleSequence rev(RDoubleSequence sequence) { + protected RDoubleSequence rev(RDoubleSequence sequence) { controlVisibility(); double start = sequence.getStart() + (sequence.getLength() - 1) * sequence.getStride(); return RDataFactory.createDoubleSequence(start, -sequence.getStride(), sequence.getLength()); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rhome.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rhome.java index 8f00e25efeb6824e5ee4c606c4ec0aeb1f1878ad..f38a412b819ffedf5f36a82dadf2c810e3afe08c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rhome.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rhome.java @@ -46,13 +46,13 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class Rhome extends RBuiltinNode { @Specialization - public Object doRhome(@SuppressWarnings("unused") RMissing component) { + protected Object doRhome(@SuppressWarnings("unused") RMissing component) { controlVisibility(); return RDataFactory.createStringVector(REnvVars.rHome()); } @Specialization - public Object doRhome(String component) { + protected Object doRhome(String component) { controlVisibility(); String rHome = REnvVars.rHome(); String result = component.equals("home") ? rHome : RRuntime.toString(FileSystems.getDefault().getPath(rHome, component).toAbsolutePath()); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rm.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rm.java index 8936db8179f91c7fb69e08126cd8534f6d6c19ca..1519b99a154b7c893f217c4de9f3d2ecc00207be 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rm.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Rm.java @@ -55,7 +55,7 @@ public abstract class Rm extends RInvisibleBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object rm(VirtualFrame frame, String name, RStringVector list, Object pos, RMissing envir, byte inherits) { + protected Object rm(VirtualFrame frame, String name, RStringVector list, Object pos, RMissing envir, byte inherits) { controlVisibility(); removeFromCurrentFrame(frame, name); return RNull.instance; @@ -63,7 +63,7 @@ public abstract class Rm extends RInvisibleBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object rm(VirtualFrame frame, Object[] names, RStringVector list, Object pos, RMissing envir, byte inherits) { + protected Object rm(VirtualFrame frame, Object[] names, RStringVector list, Object pos, RMissing envir, byte inherits) { controlVisibility(); for (Object o : names) { assert o instanceof String; @@ -74,7 +74,7 @@ public abstract class Rm extends RInvisibleBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object rm(VirtualFrame frame, String name, RStringVector list, Object pos, REnvironment envir, byte inherits) { + protected Object rm(VirtualFrame frame, String name, RStringVector list, Object pos, REnvironment envir, byte inherits) { controlVisibility(); try { envir.rm(name); @@ -86,7 +86,7 @@ public abstract class Rm extends RInvisibleBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object rm(VirtualFrame frame, Object[] names, RStringVector list, Object pos, REnvironment envir, byte inherits) { + protected Object rm(VirtualFrame frame, Object[] names, RStringVector list, Object pos, REnvironment envir, byte inherits) { controlVisibility(); try { for (Object o : names) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java index 08a1b4828a4ce542860ce24c448e7eff41378e65..e183ef6a76f0a058406a617290eff0dc8b543137 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Round.java @@ -63,25 +63,25 @@ public abstract class Round extends RBuiltinNode { } @Specialization - public int round(int x, @SuppressWarnings("unused") int digits) { + protected int round(int x, @SuppressWarnings("unused") int digits) { controlVisibility(); return roundOp.op(x); } @Specialization(guards = "!hasDigits") - public double round(double x, @SuppressWarnings("unused") int digits) { + protected double round(double x, @SuppressWarnings("unused") int digits) { controlVisibility(); return roundOp.op(x); } @Specialization(guards = "hasDigits") - public double roundDigits(double x, int digits) { + protected double roundDigits(double x, int digits) { controlVisibility(); return roundOp.opd(x, digits); } @Specialization(guards = "!hasDigits") - public RDoubleVector round(RAbstractDoubleVector x, int digits) { + protected RDoubleVector round(RAbstractDoubleVector x, int digits) { controlVisibility(); double[] result = new double[x.getLength()]; check.enable(x); @@ -95,7 +95,7 @@ public abstract class Round extends RBuiltinNode { } @Specialization(guards = "hasDigits") - public RDoubleVector roundDigits(RAbstractDoubleVector x, int digits) { + protected RDoubleVector roundDigits(RAbstractDoubleVector x, int digits) { controlVisibility(); double[] result = new double[x.getLength()]; check.enable(x); @@ -109,19 +109,19 @@ public abstract class Round extends RBuiltinNode { } @Specialization(guards = "!hasDigits") - public RComplex round(RComplex x, @SuppressWarnings("unused") int digits) { + protected RComplex round(RComplex x, @SuppressWarnings("unused") int digits) { controlVisibility(); return roundOp.op(x.getRealPart(), x.getImaginaryPart()); } @Specialization(guards = "hasDigits") - public RComplex roundDigits(RComplex x, int digits) { + protected RComplex roundDigits(RComplex x, int digits) { controlVisibility(); return roundOp.opd(x.getRealPart(), x.getImaginaryPart(), digits); } @Specialization(guards = "!hasDigits") - public RComplexVector round(RComplexVector x, int digits) { + protected RComplexVector round(RComplexVector x, int digits) { controlVisibility(); double[] result = new double[x.getLength() << 1]; check.enable(x); @@ -138,7 +138,7 @@ public abstract class Round extends RBuiltinNode { } @Specialization(guards = "hasDigits") - public RComplexVector roundDigits(RComplexVector x, int digits) { + protected RComplexVector roundDigits(RComplexVector x, int digits) { controlVisibility(); double[] result = new double[x.getLength() << 1]; check.enable(x); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowMeans.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowMeans.java index cb6498e0cd8805061c1cb49ab5d71f72bb3203e5..05843df98ff2965a4db4c71dc3c694bd1a6926f7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowMeans.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowMeans.java @@ -43,7 +43,7 @@ public abstract class RowMeans extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector rowMeansNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowMeansNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; boolean isComplete = true; @@ -69,7 +69,7 @@ public abstract class RowMeans extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector rowMeansNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowMeansNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; boolean isComplete = true; @@ -95,7 +95,7 @@ public abstract class RowMeans extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector rowMeansNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowMeansNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; na.enable(x); @@ -115,7 +115,7 @@ public abstract class RowMeans extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector rowMeansNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowMeansNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; boolean isComplete = true; @@ -141,7 +141,7 @@ public abstract class RowMeans extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector rowMeansNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowMeansNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; na.enable(x); @@ -161,7 +161,7 @@ public abstract class RowMeans extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector rowMeansNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowMeansNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; boolean isComplete = true; @@ -188,7 +188,7 @@ public abstract class RowMeans extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RDoubleVector rowMeans(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { + protected RDoubleVector rowMeans(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.X_NUMERIC); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowSums.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowSums.java index 0ed92286c3d82d142cf90c093fb0344b643e1baf..c347cfb4df2a0be8909c38fc9d1b590218b7cccd 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowSums.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowSums.java @@ -43,7 +43,7 @@ public abstract class RowSums extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector rowSumsNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowSumsNaRmFalse(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; boolean isComplete = true; @@ -69,7 +69,7 @@ public abstract class RowSums extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector rowSumsNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowSumsNaRmTrue(RDoubleVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; na.enable(x); @@ -87,7 +87,7 @@ public abstract class RowSums extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector rowSumsNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowSumsNaRmFalse(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; na.enable(x); @@ -107,7 +107,7 @@ public abstract class RowSums extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector rowSumsNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowSumsNaRmTrue(RLogicalVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; na.enable(x); @@ -125,7 +125,7 @@ public abstract class RowSums extends RBuiltinNode { } @Specialization(guards = "!isNaRm") - public RDoubleVector rowSumsNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowSumsNaRmFalse(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; na.enable(x); @@ -145,7 +145,7 @@ public abstract class RowSums extends RBuiltinNode { } @Specialization(guards = "isNaRm") - public RDoubleVector rowSumsNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { + protected RDoubleVector rowSumsNaRmTrue(RIntVector x, int rowNum, int colNum, @SuppressWarnings("unused") byte naRm) { controlVisibility(); double[] result = new double[rowNum]; na.enable(x); @@ -164,7 +164,7 @@ public abstract class RowSums extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RDoubleVector rowSums(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { + protected RDoubleVector rowSums(VirtualFrame frame, RAbstractStringVector x, int rowNum, int colNum, byte naRm) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.X_NUMERIC); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample.java index 6c403a920c9f786cfdf645bc9e9d61dad06faf3f..87c2fec0eba64ca5b8d3f09edd44901c3321bf93 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample.java @@ -44,31 +44,31 @@ public abstract class Sample extends RBuiltinNode { @Specialization(guards = "invalidFirstArgument") @SuppressWarnings("unused") - public RIntVector doSampleInvalidFirstArg(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { + protected RIntVector doSampleInvalidFirstArg(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_FIRST_ARGUMENT); } @Specialization(guards = "invalidProb") @SuppressWarnings("unused") - public RIntVector doSampleInvalidProb(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { + protected RIntVector doSampleInvalidProb(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INCORRECT_NUM_PROB); } @Specialization(guards = "largerPopulation") @SuppressWarnings("unused") - public RIntVector doSampleLargerPopulation(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { + protected RIntVector doSampleLargerPopulation(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SAMPLE_LARGER_THAN_POPULATION); } @Specialization(guards = "invalidSizeArgument") @SuppressWarnings("unused") - public RIntVector doSampleInvalidSize(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { + protected RIntVector doSampleInvalidSize(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, RRuntime.toString(size)); } @Specialization(guards = {"!invalidFirstArgument", "!invalidProb", "!largerPopulation", "!invalidSizeArgument", "withReplacement"}) - public RIntVector doSampleWithReplacement(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { + protected RIntVector doSampleWithReplacement(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { // The following code is transcribed from GNU R src/main/random.c lines 493-501 in // function do_sample. double[] probArray = prob.getDataCopy(); @@ -88,7 +88,7 @@ public abstract class Sample extends RBuiltinNode { } @Specialization(guards = {"!invalidFirstArgument", "!invalidProb", "!largerPopulation", "!invalidSizeArgument", "!withReplacement"}) - public RIntVector doSampleNoReplacement(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { + protected RIntVector doSampleNoReplacement(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { double[] probArray = prob.getDataCopy(); fixupProbability(frame, probArray, x, size, isRepeatable); return RDataFactory.createIntVector(probSampleWithoutReplace(x, probArray, size), RDataFactory.COMPLETE_VECTOR); @@ -96,24 +96,24 @@ public abstract class Sample extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "invalidFirstArgumentNullProb") - public RIntVector doSampleInvalidFirstArgument(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RNull prob) { + protected RIntVector doSampleInvalidFirstArgument(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RNull prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_FIRST_ARGUMENT); } @SuppressWarnings("unused") @Specialization(guards = "invalidSizeArgument") - public RIntVector doSampleInvalidSizeArgument(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RNull prob) { + protected RIntVector doSampleInvalidSizeArgument(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RNull prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, RRuntime.toString(size)); } @SuppressWarnings("unused") @Specialization(guards = "largerPopulation") - public RIntVector doSampleInvalidLargerPopulation(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RNull prob) { + protected RIntVector doSampleInvalidLargerPopulation(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RNull prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INCORRECT_NUM_PROB); } @Specialization(guards = {"!invalidFirstArgumentNullProb", "!invalidSizeArgument", "!largerPopulation"}) - public RIntVector doSample(final int x, final int size, final byte isRepeatable, @SuppressWarnings("unused") final RNull prob) { + protected RIntVector doSample(final int x, final int size, final byte isRepeatable, @SuppressWarnings("unused") final RNull prob) { // TODO:Add support of long integers. // The following code is transcribed from GNU R src/main/random.c lines 533-545 in // function do_sample. @@ -140,7 +140,7 @@ public abstract class Sample extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "invalidIsRepeatable") - public RIntVector doSampleInvalidIsRepeatable(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { + protected RIntVector doSampleInvalidIsRepeatable(VirtualFrame frame, final int x, final int size, final byte isRepeatable, final RDoubleVector prob) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, RRuntime.toString(isRepeatable)); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Seq.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Seq.java index 1cda5c6287fb8485428d6cf740a27d603869ea24..551760cbcf16081ea8a9bc34d6bafc2a8c6bf53b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Seq.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Seq.java @@ -69,91 +69,91 @@ public abstract class Seq extends RBuiltinNode { } @Specialization(guards = {"startLengthOne", "toLengthOne", "zero"}) - public int seqZero(VirtualFrame frame, RAbstractIntVector start, RAbstractIntVector to, Object stride, RMissing lengthOut, RMissing alongWith) { + protected int seqZero(VirtualFrame frame, RAbstractIntVector start, RAbstractIntVector to, Object stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return 0; } @Specialization(guards = {"startLengthOne", "toLengthOne", "zero"}) - public int seqZer0(RAbstractDoubleVector start, RAbstractIntVector to, Object stride, RMissing lengthOut, RMissing alongWith) { + protected int seqZer0(RAbstractDoubleVector start, RAbstractIntVector to, Object stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return 0; } @Specialization(guards = {"startLengthOne", "toLengthOne", "zero"}) - public int seqZero(RAbstractIntVector start, RAbstractDoubleVector to, Object stride, RMissing lengthOut, RMissing alongWith) { + protected int seqZero(RAbstractIntVector start, RAbstractDoubleVector to, Object stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return 0; } @Specialization(guards = {"startLengthOne", "toLengthOne", "zero"}) - public double seq(RAbstractDoubleVector start, RAbstractDoubleVector to, Object stride, RMissing lengthOut, RMissing alongWith) { + protected double seq(RAbstractDoubleVector start, RAbstractDoubleVector to, Object stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return 0; } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RIntSequence seq(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RIntSequence seq(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createIntSequence(start.getDataAt(0), ascending(start, to) ? 1 : -1, Math.abs(to.getDataAt(0) - start.getDataAt(0)) + 1); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RIntSequence seq(RAbstractIntVector start, RAbstractIntVector to, int stride, RMissing lengthOut, RMissing alongWith) { + protected RIntSequence seq(RAbstractIntVector start, RAbstractIntVector to, int stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createIntSequence(start.getDataAt(0), stride, Math.abs((to.getDataAt(0) - start.getDataAt(0)) / stride) + 1); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!lengthZero"}) - public RDoubleVector seq(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RDoubleVector seq(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return getVectorWithComputedStride(RRuntime.int2double(start.getDataAt(0)), RRuntime.int2double(to.getDataAt(0)), RRuntime.int2double(lengthOut), ascending(start, to)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!lengthZero"}) - public RDoubleVector seq(RAbstractLogicalVector start, RAbstractLogicalVector to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RDoubleVector seq(RAbstractLogicalVector start, RAbstractLogicalVector to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return getVectorWithComputedStride(RRuntime.logical2double(start.getDataAt(0)), RRuntime.logical2double(to.getDataAt(0)), RRuntime.int2double(lengthOut), ascending(start, to)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "lengthZero"}) - public RIntVector seqLengthZero(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RIntVector seqLengthZero(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractIntVector start, RAbstractIntVector to, double stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractIntVector start, RAbstractIntVector to, double stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(RRuntime.int2double(start.getDataAt(0)), stride, (int) (Math.abs((to.getDataAt(0) - start.getDataAt(0)) / stride)) + 1); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!lengthZero"}) - public RDoubleVector seq(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, double lengthOut, RMissing alongWith) { + protected RDoubleVector seq(RAbstractIntVector start, RAbstractIntVector to, RMissing stride, double lengthOut, RMissing alongWith) { controlVisibility(); return getVectorWithComputedStride(RRuntime.int2double(start.getDataAt(0)), RRuntime.int2double(to.getDataAt(0)), lengthOut, ascending(start, to)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!lengthZero"}) - public RDoubleVector seq(RAbstractLogicalVector start, RAbstractLogicalVector to, RMissing stride, double lengthOut, RMissing alongWith) { + protected RDoubleVector seq(RAbstractLogicalVector start, RAbstractLogicalVector to, RMissing stride, double lengthOut, RMissing alongWith) { controlVisibility(); return getVectorWithComputedStride(RRuntime.logical2double(start.getDataAt(0)), RRuntime.logical2double(to.getDataAt(0)), lengthOut, ascending(start, to)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "lengthZero"}) - public RIntVector seqLengthZero(RAbstractLogicalVector start, RAbstractLogicalVector to, RMissing stride, double lengthOut, RMissing alongWith) { + protected RIntVector seqLengthZero(RAbstractLogicalVector start, RAbstractLogicalVector to, RMissing stride, double lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractIntVector start, RAbstractDoubleVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractIntVector start, RAbstractDoubleVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), ascending(start, to) ? 1 : -1, (int) Math.abs(to.getDataAt(0) - start.getDataAt(0)) + 1); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractIntVector start, RAbstractDoubleVector to, int stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractIntVector start, RAbstractDoubleVector to, int stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); int length = (int) Math.abs(to.getDataAt(0) - start.getDataAt(0)) / stride; if (start.getDataAt(0) + length * stride == to.getDataAt(0)) { @@ -163,151 +163,151 @@ public abstract class Seq extends RBuiltinNode { } @Specialization(guards = "!startEmpty") - public RIntSequence seqFromOneArg(RAbstractIntVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RIntSequence seqFromOneArg(RAbstractIntVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); // GNU R really does that (take the length of start to create a sequence) return RDataFactory.createIntSequence(1, 1, start.getLength()); } @Specialization(guards = "startEmpty") - public RIntVector seqFromOneArgEmpty(RAbstractIntVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RIntVector seqFromOneArgEmpty(RAbstractIntVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { return RDataFactory.createEmptyIntVector(); } @Specialization(guards = "!startEmpty") - public RIntSequence seqFromOneArg(RAbstractLogicalVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RIntSequence seqFromOneArg(RAbstractLogicalVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); // GNU R really does that (take the length of start to create a sequence) return RDataFactory.createIntSequence(1, 1, start.getLength()); } @Specialization(guards = "startEmpty") - public RIntVector seqFromOneArgEmpty(RAbstractLogicalVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RIntVector seqFromOneArgEmpty(RAbstractLogicalVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { return RDataFactory.createEmptyIntVector(); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractDoubleVector start, RAbstractIntVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractDoubleVector start, RAbstractIntVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), ascending(start, to) ? 1 : -1, (int) Math.abs(to.getDataAt(0) - start.getDataAt(0)) + 1); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractDoubleVector start, RAbstractIntVector to, int stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractDoubleVector start, RAbstractIntVector to, int stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), stride, (int) Math.abs((to.getDataAt(0) - start.getDataAt(0)) / stride) + 1); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), ascending(start, to) ? 1 : -1, (int) Math.abs(to.getDataAt(0) - start.getDataAt(0)) + 1); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractDoubleVector start, RAbstractDoubleVector to, int stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractDoubleVector start, RAbstractDoubleVector to, int stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), stride, (int) (Math.abs((to.getDataAt(0) - start.getDataAt(0)) / stride) + 1)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!lengthZero"}) - public RDoubleVector seq(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RDoubleVector seq(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return getVectorWithComputedStride(start.getDataAt(0), to.getDataAt(0), RRuntime.int2double(lengthOut), ascending(start, to)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "lengthZero"}) - public RIntVector seqLengthZero(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RIntVector seqLengthZero(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!zero"}) - public RDoubleSequence seq(RAbstractDoubleVector start, RAbstractDoubleVector to, double stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seq(RAbstractDoubleVector start, RAbstractDoubleVector to, double stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), stride, (int) (Math.abs((to.getDataAt(0) - start.getDataAt(0)) / stride) + 1)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "!lengthZero"}) - public RDoubleVector seq(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, double lengthOut, RMissing alongWith) { + protected RDoubleVector seq(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, double lengthOut, RMissing alongWith) { controlVisibility(); return getVectorWithComputedStride(start.getDataAt(0), to.getDataAt(0), lengthOut, ascending(start, to)); } @Specialization(guards = {"startLengthOne", "toLengthOne", "lengthZero"}) - public RIntVector seqLengthZero(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, double lengthOut, RMissing alongWith) { + protected RIntVector seqLengthZero(RAbstractDoubleVector start, RAbstractDoubleVector to, RMissing stride, double lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @Specialization(guards = "!startEmpty") - public RDoubleSequence seqFromOneArg(RAbstractDoubleVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RDoubleSequence seqFromOneArg(RAbstractDoubleVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { controlVisibility(); // GNU R really does that (take the length of start to create a sequence) return RDataFactory.createDoubleSequence(1, 1, start.getLength()); } @Specialization(guards = "startEmpty") - public RIntVector seqFromOneArgEmpty(RAbstractDoubleVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { + protected RIntVector seqFromOneArgEmpty(RAbstractDoubleVector start, RMissing to, RMissing stride, RMissing lengthOut, RMissing alongWith) { return RDataFactory.createEmptyIntVector(); } @Specialization(guards = "lengthZero") - public RIntVector seqLengthZero(RMissing start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RIntVector seqLengthZero(RMissing start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @Specialization(guards = "!lengthZero") - public RIntSequence seq(RMissing start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RIntSequence seq(RMissing start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createIntSequence(1, 1, lengthOut); } @Specialization(guards = "lengthZero") - public RIntVector seqLengthZero(RMissing start, RMissing to, RMissing stride, double lengthOut, RMissing alongWith) { + protected RIntVector seqLengthZero(RMissing start, RMissing to, RMissing stride, double lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @Specialization(guards = "!lengthZero") - public RIntSequence seq(RMissing start, RMissing to, RMissing stride, double lengthOut, RMissing alongWith) { + protected RIntSequence seq(RMissing start, RMissing to, RMissing stride, double lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createIntSequence(1, 1, (int) Math.ceil(lengthOut)); } @Specialization(guards = "lengthZeroAlong") - public RIntVector LengthZero(RMissing start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { + protected RIntVector LengthZero(RMissing start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { controlVisibility(); return RDataFactory.createEmptyIntVector(); } @Specialization(guards = "!lengthZeroAlong") - public RIntSequence seq(RMissing start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { + protected RIntSequence seq(RMissing start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { controlVisibility(); return RDataFactory.createIntSequence(1, 1, alongWith.getLength()); } @Specialization(guards = {"startLengthOne", "lengthZero"}) - public RDoubleVector seq(RAbstractDoubleVector start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RDoubleVector seq(RAbstractDoubleVector start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createEmptyDoubleVector(); } @Specialization(guards = {"startLengthOne", "lengthZeroAlong"}) - public RDoubleVector seq(RAbstractDoubleVector start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { + protected RDoubleVector seq(RAbstractDoubleVector start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { controlVisibility(); return RDataFactory.createEmptyDoubleVector(); } @Specialization(guards = {"startLengthOne", "!lengthZero"}) - public RDoubleSequence seqLengthZero(RAbstractDoubleVector start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { + protected RDoubleSequence seqLengthZero(RAbstractDoubleVector start, RMissing to, RMissing stride, int lengthOut, RMissing alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), 1, lengthOut); } @Specialization(guards = {"startLengthOne", "!lengthZeroAlong"}) - public RDoubleSequence seqLengthZero(RAbstractDoubleVector start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { + protected RDoubleSequence seqLengthZero(RAbstractDoubleVector start, RMissing to, RMissing stride, Object lengthOut, RAbstractVector alongWith) { controlVisibility(); return RDataFactory.createDoubleSequence(start.getDataAt(0), 1, alongWith.getLength()); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqAlong.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqAlong.java index 2bfb108c6572b196e47ee61684dbcba41775de29..e28ab759115ab3c7742db81744be7bc05fb8cb11 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqAlong.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqAlong.java @@ -39,7 +39,7 @@ public abstract class SeqAlong extends RBuiltinNode { } @Specialization - public RIntSequence seq(int length) { + protected RIntSequence seq(int length) { controlVisibility(); return RDataFactory.createIntSequence(1, 1, length); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqLen.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqLen.java index ba3d71224e6f3c41baca23f4b14b02dac913e6b6..fd8afde6ae22a9a7be6a29136c73a441d741b736 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqLen.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SeqLen.java @@ -40,7 +40,7 @@ public abstract class SeqLen extends RBuiltinNode { } @Specialization - public RIntSequence seq(int length) { + protected RIntSequence seq(int length) { controlVisibility(); return RDataFactory.createIntSequence(1, 1, length); } 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 fe9adcfb78e2b7c9cc8c80781d248991b6801fe0..b364be1998191809e4dfd3acb6457fee90711b90 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 @@ -37,7 +37,7 @@ public class SerializeFunctions { @RBuiltin(name = "unserializeFromConn", kind = INTERNAL, parameterNames = {"conn", "refhook"}) public abstract static class UnserializeFromConn extends RInvisibleBuiltinNode { @Specialization - public Object doUnserializeFromConn(VirtualFrame frame, RConnection conn, @SuppressWarnings("unused") RNull refhook) { + protected Object doUnserializeFromConn(VirtualFrame frame, RConnection conn, @SuppressWarnings("unused") RNull refhook) { controlVisibility(); try { Object result = RSerialize.unserialize(conn); @@ -49,7 +49,7 @@ public class SerializeFunctions { } @Specialization - public Object doUnserializeFromConn(VirtualFrame frame, RConnection conn, @SuppressWarnings("unused") REnvironment refhook) { + protected Object doUnserializeFromConn(VirtualFrame frame, RConnection conn, @SuppressWarnings("unused") REnvironment refhook) { // TODO figure out what this really means? return doUnserializeFromConn(frame, conn, RNull.instance); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Setwd.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Setwd.java index fd2ad2509ed944a3c932cde250873b497a46bf10..4573fd10f41634ff5a669a8f6e796ec94a48b19a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Setwd.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Setwd.java @@ -34,7 +34,7 @@ import com.oracle.truffle.r.runtime.ffi.*; public abstract class Setwd extends RInvisibleBuiltinNode { @Specialization - public Object setwd(VirtualFrame frame, String dir) { + protected Object setwd(VirtualFrame frame, String dir) { controlVisibility(); int rc = RFFIFactory.getRFFI().getBaseRFFI().setwd(dir); if (rc != 0) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ShortRowNames.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ShortRowNames.java index 874ac1d714c7a863450353ce57699df61fdf0899..5de7ea6465a9fb475dd33f9de22f3a10750d7c7a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ShortRowNames.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ShortRowNames.java @@ -43,27 +43,27 @@ public abstract class ShortRowNames extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull getNames(RNull operand, RAbstractIntVector type) { + protected RNull getNames(RNull operand, RAbstractIntVector type) { controlVisibility(); return RNull.instance; } @SuppressWarnings("unused") @Specialization(guards = "invalidType") - public RNull getNamesInvalidType(VirtualFrame frame, RAbstractContainer operand, RAbstractIntVector type) { + protected RNull getNamesInvalidType(VirtualFrame frame, RAbstractContainer operand, RAbstractIntVector type) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "type"); } @SuppressWarnings("unused") @Specialization(guards = {"!invalidType", "!returnScalar"}) - public Object getNamesNull(RAbstractContainer operand, RAbstractIntVector type) { + protected Object getNamesNull(RAbstractContainer operand, RAbstractIntVector type) { controlVisibility(); return operand.getRowNames(); } @Specialization(guards = {"!invalidType", "returnScalar"}) - public int getNames(RAbstractContainer operand, RAbstractIntVector type) { + protected int getNames(RAbstractContainer operand, RAbstractIntVector type) { controlVisibility(); int t = type.getDataAt(0); Object a = operand.getRowNames(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SortFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SortFunctions.java index 05070e5e813093c2290e2263bdc61f33b1661030..13923cd1bbfb326f5693ddaa7aa0715c94203692 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SortFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SortFunctions.java @@ -58,7 +58,7 @@ public class SortFunctions { @SuppressWarnings("unused") @Specialization - public RIntVector sortList(VirtualFrame frame, RAbstractVector vec, RNull partial, byte naLast, byte decreasing, RMissing method) { + protected RIntVector sortList(VirtualFrame frame, RAbstractVector vec, RNull partial, byte naLast, byte decreasing, RMissing method) { controlVisibility(); if (order == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -92,14 +92,14 @@ public class SortFunctions { } @Specialization - public RDoubleVector qsort(RAbstractDoubleVector vec, @SuppressWarnings("unused") Object indexReturn) { + protected RDoubleVector qsort(RAbstractDoubleVector vec, @SuppressWarnings("unused") Object indexReturn) { double[] data = vec.materialize().getDataCopy(); sort(data); return RDataFactory.createDoubleVector(data, vec.isComplete()); } @Specialization - public RIntVector qsort(RAbstractIntVector vec, @SuppressWarnings("unused") Object indexReturn) { + protected RIntVector qsort(RAbstractIntVector vec, @SuppressWarnings("unused") Object indexReturn) { int[] data = vec.materialize().getDataCopy(); sort(data); return RDataFactory.createIntVector(data, vec.isComplete()); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sprintf.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sprintf.java index 78d45645ee9d2f1fa048c529b9671efd7ece6df2..2e175a03047af2ed1d4529bc3f8da1b3f961d051 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sprintf.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sprintf.java @@ -47,29 +47,29 @@ public abstract class Sprintf extends RBuiltinNode { } @Specialization - public String sprintf(String fmt, @SuppressWarnings("unused") RMissing x) { + protected String sprintf(String fmt, @SuppressWarnings("unused") RMissing x) { controlVisibility(); return fmt; } @Specialization(guards = "fmtLengthOne") - public String sprintf(RAbstractStringVector fmt, RMissing x) { + protected String sprintf(RAbstractStringVector fmt, RMissing x) { return sprintf(fmt.getDataAt(0), x); } @Specialization - public String sprintf(String fmt, int x) { + protected String sprintf(String fmt, int x) { controlVisibility(); return format(fmt, x); } @Specialization(guards = "fmtLengthOne") - public String sprintf(RAbstractStringVector fmt, int x) { + protected String sprintf(RAbstractStringVector fmt, int x) { return sprintf(fmt.getDataAt(0), x); } @Specialization - public RStringVector sprintf(String fmt, RAbstractIntVector x) { + protected RStringVector sprintf(String fmt, RAbstractIntVector x) { controlVisibility(); String[] r = new String[x.getLength()]; for (int k = 0; k < r.length; ++k) { @@ -79,12 +79,12 @@ public abstract class Sprintf extends RBuiltinNode { } @Specialization(guards = "fmtLengthOne") - public RStringVector sprintf(RAbstractStringVector fmt, RAbstractIntVector x) { + protected RStringVector sprintf(RAbstractStringVector fmt, RAbstractIntVector x) { return sprintf(fmt.getDataAt(0), x); } @Specialization - public String sprintf(VirtualFrame frame, String fmt, double x) { + protected String sprintf(VirtualFrame frame, String fmt, double x) { controlVisibility(); char f = Character.toLowerCase(firstFormatChar(fmt)); if (f == 'x' || f == 'd') { @@ -97,12 +97,12 @@ public abstract class Sprintf extends RBuiltinNode { } @Specialization(guards = "fmtLengthOne") - public String sprintf(VirtualFrame frame, RAbstractStringVector fmt, double x) { + protected String sprintf(VirtualFrame frame, RAbstractStringVector fmt, double x) { return sprintf(frame, fmt.getDataAt(0), x); } @Specialization - public RStringVector sprintf(VirtualFrame frame, String fmt, RAbstractDoubleVector x) { + protected RStringVector sprintf(VirtualFrame frame, String fmt, RAbstractDoubleVector x) { controlVisibility(); String[] r = new String[x.getLength()]; for (int k = 0; k < r.length; ++k) { @@ -112,23 +112,23 @@ public abstract class Sprintf extends RBuiltinNode { } @Specialization(guards = "fmtLengthOne") - public RStringVector sprintf(VirtualFrame frame, RAbstractStringVector fmt, RAbstractDoubleVector x) { + protected RStringVector sprintf(VirtualFrame frame, RAbstractStringVector fmt, RAbstractDoubleVector x) { return sprintf(frame, fmt.getDataAt(0), x); } @Specialization - public String sprintf(String fmt, String x) { + protected String sprintf(String fmt, String x) { controlVisibility(); return format(fmt, x); } @Specialization(guards = "fmtLengthOne") - public String sprintf(RAbstractStringVector fmt, String x) { + protected String sprintf(RAbstractStringVector fmt, String x) { return sprintf(fmt.getDataAt(0), x); } @Specialization - public RStringVector sprintf(String fmt, RAbstractStringVector x) { + protected RStringVector sprintf(String fmt, RAbstractStringVector x) { controlVisibility(); String[] r = new String[x.getLength()]; for (int k = 0; k < r.length; ++k) { @@ -138,12 +138,12 @@ public abstract class Sprintf extends RBuiltinNode { } @Specialization(guards = "fmtLengthOne") - public RStringVector sprintf(RAbstractStringVector fmt, RAbstractStringVector x) { + protected RStringVector sprintf(RAbstractStringVector fmt, RAbstractStringVector x) { return sprintf(fmt.getDataAt(0), x); } @Specialization - public String sprintf(String fmt, Object[] args) { + protected String sprintf(String fmt, Object[] args) { controlVisibility(); return format(fmt, args); } @@ -273,7 +273,7 @@ public abstract class Sprintf extends RBuiltinNode { // format info parsing // - static class FormatInfo { + private static class FormatInfo { char conversion; int width; int precision; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sqrt.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sqrt.java index 5142855a96f0c20124904760f38b71b6d713f909..c9d20d1b929e103e15b1dae42bd36cfe6491e34d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sqrt.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sqrt.java @@ -46,7 +46,7 @@ public abstract class Sqrt extends RBuiltinNode { } @Specialization - public double sqrt(int x) { + protected double sqrt(int x) { controlVisibility(); na.enable(x); if (na.check(x)) { @@ -56,7 +56,7 @@ public abstract class Sqrt extends RBuiltinNode { } @Specialization - public double sqrt(byte x) { + protected double sqrt(byte x) { controlVisibility(); // sqrt for logical values: TRUE -> 1, FALSE -> 0, NA -> NA na.enable(x); @@ -67,7 +67,7 @@ public abstract class Sqrt extends RBuiltinNode { } @Specialization - public RDoubleVector sqrt(RIntSequence xs) { + protected RDoubleVector sqrt(RIntSequence xs) { controlVisibility(); double[] res = new double[xs.getLength()]; int current = xs.getStart(); @@ -81,7 +81,7 @@ public abstract class Sqrt extends RBuiltinNode { } @Specialization - public RDoubleVector sqrt(RDoubleVector xs) { + protected RDoubleVector sqrt(RDoubleVector xs) { controlVisibility(); double[] res = new double[xs.getLength()]; na.enable(xs); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Stop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Stop.java index 0e70ddb4a0a987b71ca57b03668cb82eb8de46a7..a25e307bf46061ab398cba411125deb9193fdb1a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Stop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Stop.java @@ -44,7 +44,7 @@ public abstract class Stop extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object stop(VirtualFrame frame, String msg, byte call, Object domain) { + protected Object stop(VirtualFrame frame, String msg, byte call, Object domain) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.GENERIC, msg); } @@ -64,7 +64,7 @@ public abstract class Stop extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public Object stop(VirtualFrame frame, RStringVector msg, byte call, Object domain) { + protected Object stop(VirtualFrame frame, RStringVector msg, byte call, Object domain) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.GENERIC, collapseStringVector(msg)); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Strsplit.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Strsplit.java index a81b1c3881e91039bed98a411de51a240d71a082..74e180bff07d1f66ea84b0fc4ec9610b0e527fd3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Strsplit.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Strsplit.java @@ -48,7 +48,7 @@ public abstract class Strsplit extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RList split(RAbstractStringVector x, String split, byte fixed, byte perl, byte useBytes) { + protected RList split(RAbstractStringVector x, String split, byte fixed, byte perl, byte useBytes) { controlVisibility(); RStringVector[] result = new RStringVector[x.getLength()]; na.enable(x); @@ -60,7 +60,7 @@ public abstract class Strsplit extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RList split(RAbstractStringVector x, RAbstractStringVector split, byte fixed, byte perl, byte useBytes) { + protected RList split(RAbstractStringVector x, RAbstractStringVector split, byte fixed, byte perl, byte useBytes) { controlVisibility(); RStringVector[] result = new RStringVector[x.getLength()]; na.enable(x); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Structure.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Structure.java index 49a7ebbccdc1dcded2f8b5e650aee3d42d296690..39636ef8cd76459c8cd37448a08ea5e7fa296e99 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Structure.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Structure.java @@ -38,12 +38,12 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class Structure extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object structure(VirtualFrame frame, RMissing obj, RMissing args) { + protected Object structure(VirtualFrame frame, RMissing obj, RMissing args) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENT_MISSING, ".Data"); } @Specialization - public Object structure(VirtualFrame frame, RAbstractContainer obj, Object args) { + protected Object structure(VirtualFrame frame, RAbstractContainer obj, Object args) { if (!(args instanceof RMissing)) { Object[] values = args instanceof Object[] ? (Object[]) args : new Object[]{args}; String[] argNames = getSuppliedArgsNames(); @@ -55,7 +55,7 @@ public abstract class Structure extends RBuiltinNode { return obj; } - Object fixupValue(Object value) { + private static Object fixupValue(Object value) { if (value instanceof String) { return RDataFactory.createStringVectorFromScalar((String) value); } 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 559960e1490005fbaf7934f87ccf56679d569334..3fa9343058223961b787e05f27cdccbd44070c46 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 @@ -54,7 +54,7 @@ public abstract class Substitute extends RBuiltinNode { } @Specialization - public Object doSubstitute(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") RMissing envMissing) { + protected Object doSubstitute(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") RMissing envMissing) { controlVisibility(); // In the global environment, substitute behaves like quote REnvironment env = REnvironment.checkNonFunctionFrame(frame); @@ -117,7 +117,7 @@ public abstract class Substitute extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public String doSubstitute(VirtualFrame frame, RPromise expr, REnvironment env) { + protected String doSubstitute(VirtualFrame frame, RPromise expr, REnvironment env) { controlVisibility(); throw RError.nyi(getEncapsulatingSourceSection(), "substitute(expr, env)"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substr.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substr.java index 13dd4a8947081a7ce42534bf50778c2736f035d1..5b0727bcfc5eee0dc7ed3ececa7ba53c905ed2b5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substr.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Substr.java @@ -38,7 +38,7 @@ public abstract class Substr extends RBuiltinNode { protected final NACheck na = NACheck.create(); - private BranchProfile everSeenIllegalRange = new BranchProfile(); + private final BranchProfile everSeenIllegalRange = new BranchProfile(); protected static boolean rangeOk(String x, int start, int stop) { return start <= stop && start > 0 && stop > 0 && start <= x.length() && stop <= x.length(); @@ -68,19 +68,19 @@ public abstract class Substr extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "emptyArg") - public RStringVector substrEmptyArg(VirtualFrame frame, RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop) { + protected RStringVector substrEmptyArg(VirtualFrame frame, RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop) { return RDataFactory.createEmptyStringVector(); } @SuppressWarnings("unused") @Specialization(guards = {"!emptyArg", "wrongParams"}) - public RNull substrWrongParams(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop) { + protected RNull substrWrongParams(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop) { assert false; // should never happen return RNull.instance; // dummy } @Specialization(guards = {"!emptyArg", "!wrongParams"}) - public RStringVector substr(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop) { + protected RStringVector substr(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop) { String[] res = new String[arg.getLength()]; for (int i = 0, j = 0, k = 0; i < arg.getLength(); ++i, j = Utils.incMod(j, start.getLength()), k = Utils.incMod(k, stop.getLength())) { res[i] = substr0(arg.getDataAt(i), start.getDataAt(j), stop.getDataAt(k)); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java index 8707b8790f2def938fe1e812949c2292820b7624..f69681438a7bd8d7782a73f9f106c5f49d5270e2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java @@ -40,7 +40,7 @@ public abstract class Switch extends RBuiltinNode { } @Specialization(guards = "isLengthOne") - public Object doSwitch(VirtualFrame frame, RAbstractStringVector x, Object[] optionalArgs) { + protected Object doSwitch(VirtualFrame frame, RAbstractStringVector x, Object[] optionalArgs) { controlVisibility(); Object currentDefaultValue = null; final String xStr = x.getDataAt(0); @@ -68,12 +68,12 @@ public abstract class Switch extends RBuiltinNode { } @Specialization - public Object doSwitch(VirtualFrame frame, int x, Object[] optionalArgs) { + protected Object doSwitch(VirtualFrame frame, int x, Object[] optionalArgs) { return doSwitchInt(frame, x, optionalArgs); } @Specialization - public Object doSwitch(VirtualFrame frame, Object x, Object[] optionalArgs) { + protected Object doSwitch(VirtualFrame frame, Object x, Object[] optionalArgs) { if (castIntNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); castIntNode = insert(CastIntegerNodeFactory.create(null, false, false, false)); @@ -88,7 +88,7 @@ public abstract class Switch extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object doSwitch(VirtualFrame frame, RMissing x, RMissing optionalArgs) { + protected Object doSwitch(VirtualFrame frame, RMissing x, RMissing optionalArgs) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.EXPR_MISSING); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SysFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SysFunctions.java index 93b8abbc9f920da20484c4140ddef6bc70f2fa3f..5f9af145b21bf6255a79e0ff3214079698592dbe 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SysFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/SysFunctions.java @@ -43,7 +43,7 @@ public class SysFunctions { public abstract static class SysGetpid extends RBuiltinNode { @Specialization - public Object sysGetPid() { + protected Object sysGetPid() { controlVisibility(); int pid = RFFIFactory.getRFFI().getBaseRFFI().getpid(); return RDataFactory.createIntVectorFromScalar(pid); @@ -59,7 +59,7 @@ public class SysFunctions { } @Specialization - public Object sysGetEnv(RAbstractStringVector x, String unset) { + protected Object sysGetEnv(RAbstractStringVector x, String unset) { controlVisibility(); Map<String, String> envMap = REnvVars.getMap(); int len = x.getLength(); @@ -91,7 +91,7 @@ public class SysFunctions { } @Specialization - public Object sysGetEnvGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object x, @SuppressWarnings("unused") Object unset) { + protected Object sysGetEnvGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object x, @SuppressWarnings("unused") Object unset) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.WRONG_TYPE); } @@ -108,12 +108,12 @@ public class SysFunctions { } @Specialization - public RLogicalVector doSysSetEnv(VirtualFrame frame, RAbstractStringVector argVec) { + protected RLogicalVector doSysSetEnv(VirtualFrame frame, RAbstractStringVector argVec) { return doSysSetEnv(frame, new Object[]{argVec.getDataAt(0)}); } @Specialization - public RLogicalVector doSysSetEnv(VirtualFrame frame, Object[] args) { + protected RLogicalVector doSysSetEnv(VirtualFrame frame, Object[] args) { controlVisibility(); String[] argNames = getSuppliedArgsNames(); validateArgNames(frame, argNames); @@ -144,7 +144,7 @@ public class SysFunctions { public abstract static class SysUnSetEnv extends RInvisibleBuiltinNode { @Specialization - public RLogicalVector doSysSetEnv(RAbstractStringVector argVec) { + protected RLogicalVector doSysSetEnv(RAbstractStringVector argVec) { byte[] data = new byte[argVec.getLength()]; for (int i = 0; i < data.length; i++) { data[i] = RRuntime.asLogical(REnvVars.unset(argVec.getDataAt(i))); @@ -157,14 +157,14 @@ public class SysFunctions { public abstract static class SysSleep extends RInvisibleBuiltinNode { @Specialization - public Object sysSleep(double seconds) { + protected Object sysSleep(double seconds) { controlVisibility(); sleep(convertToMillis(seconds)); return RNull.instance; } @Specialization - public Object sysSleep(VirtualFrame frame, String secondsString) { + protected Object sysSleep(VirtualFrame frame, String secondsString) { controlVisibility(); long millis = convertToMillis(checkValidString(frame, secondsString)); sleep(millis); @@ -172,7 +172,7 @@ public class SysFunctions { } @Specialization(guards = "lengthOne") - public Object sysSleep(VirtualFrame frame, RStringVector secondsVector) { + protected Object sysSleep(VirtualFrame frame, RStringVector secondsVector) { controlVisibility(); long millis = convertToMillis(checkValidString(frame, secondsVector.getDataAt(0))); sleep(millis); @@ -184,7 +184,7 @@ public class SysFunctions { } @Specialization - public Object sysSleep(VirtualFrame frame, @SuppressWarnings("unused") Object arg) throws RError { + protected Object sysSleep(VirtualFrame frame, @SuppressWarnings("unused") Object arg) throws RError { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_VALUE, "time"); } @@ -217,13 +217,13 @@ public class SysFunctions { public abstract static class SysReadlink extends RBuiltinNode { @Specialization - public Object sysReadLink(String path) { + protected Object sysReadLink(String path) { controlVisibility(); return RDataFactory.createStringVector(doSysReadLink(path)); } @Specialization - public Object sysReadlink(RStringVector vector) { + protected Object sysReadlink(RStringVector vector) { controlVisibility(); String[] paths = new String[vector.getLength()]; boolean complete = RDataFactory.COMPLETE_VECTOR; @@ -255,7 +255,7 @@ public class SysFunctions { } @Specialization - public Object sysReadlinkGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object path) { + protected Object sysReadlinkGeneric(VirtualFrame frame, @SuppressWarnings("unused") Object path) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "paths"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempDir.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempDir.java index 5ffb5b484d93b7ca7a6e0a8187faf96d639005b4..a9ac0b3eca818b0785186e77b8de93b86877bf7b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempDir.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempDir.java @@ -32,7 +32,7 @@ import com.oracle.truffle.r.runtime.*; public abstract class TempDir extends RBuiltinNode { @Specialization - public Object tempdir() { + protected Object tempdir() { controlVisibility(); return TempDirPath.tempDirPath(); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempFile.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempFile.java index b729027f3e482895b67ceda00b4b58139d3b17eb..670c59c54e5bd0a4585539fb83aaaa48a6448c7e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempFile.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TempFile.java @@ -51,7 +51,7 @@ public abstract class TempFile extends RBuiltinNode { } @Specialization(guards = "tempDirL1") - public RStringVector tempfile(String pattern, RAbstractStringVector tempDir, String fileExt) { + protected RStringVector tempfile(String pattern, RAbstractStringVector tempDir, String fileExt) { controlVisibility(); return RDataFactory.createStringVector(createFile(pattern, tempDir.getDataAt(0), fileExt)); } @@ -62,7 +62,7 @@ public abstract class TempFile extends RBuiltinNode { } @Specialization - public RStringVector tempfileGeneric(VirtualFrame frame, Object pattern, Object tempDir, Object fileExt) throws RError { + protected RStringVector tempfileGeneric(VirtualFrame frame, Object pattern, Object tempDir, Object fileExt) throws RError { controlVisibility(); RStringVector[] argVecs = new RStringVector[]{checkVector(frame, pattern, INVALID_PATTERN), checkVector(frame, tempDir, INVALID_TEMPDIR), checkVector(frame, fileExt, INVALID_FILEEXT)}; // Now we have RStringVectors of at least length 1 diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToLower.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToLower.java index 77ecfe914c1d266f7dfb36b62997eb71d86cf805..886d5057d0308e75280d4fda068d28fcb24ec108 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToLower.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToLower.java @@ -35,13 +35,13 @@ public abstract class ToLower extends RBuiltinNode { @Specialization @SlowPath - public String toLower(String value) { + protected String toLower(String value) { controlVisibility(); return value.toLowerCase(); } @Specialization - public RStringVector toLower(RStringVector vector) { + protected RStringVector toLower(RStringVector vector) { controlVisibility(); String[] stringVector = new String[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -52,7 +52,7 @@ public abstract class ToLower extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RStringVector tolower(RNull empty) { + protected RStringVector tolower(RNull empty) { controlVisibility(); return RDataFactory.createStringVector(0); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToUpper.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToUpper.java index e1c41c31b5adb3f5a59fcfcf3f930aed20a97cba..556d95febe97a918aa48da29b28b6cf51a719352 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToUpper.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ToUpper.java @@ -35,13 +35,13 @@ public abstract class ToUpper extends RBuiltinNode { @Specialization @SlowPath - public String toUpper(String value) { + protected String toUpper(String value) { controlVisibility(); return value.toUpperCase(); } @Specialization - public RStringVector toUpper(RStringVector vector) { + protected RStringVector toUpper(RStringVector vector) { controlVisibility(); String[] stringVector = new String[vector.getLength()]; for (int i = 0; i < vector.getLength(); i++) { @@ -54,7 +54,7 @@ public abstract class ToUpper extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RStringVector toupper(RNull empty) { + protected RStringVector toupper(RNull empty) { controlVisibility(); return RDataFactory.createStringVector(0); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java index bb7b91603a29e7b284a344a766edb4ef206eace9..00f249ee317eeee3c913a338ce3fc865c7ef6159 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Transpose.java @@ -49,38 +49,38 @@ public abstract class Transpose extends RBuiltinNode { public abstract Object execute(VirtualFrame frame, Object o); @Specialization - public RNull transpose(RNull value) { + protected RNull transpose(RNull value) { controlVisibility(); return value; } @Specialization - public int transpose(int value) { + protected int transpose(int value) { controlVisibility(); return value; } @Specialization - public double transpose(double value) { + protected double transpose(double value) { controlVisibility(); return value; } @Specialization - public byte transpose(byte value) { + protected byte transpose(byte value) { controlVisibility(); return value; } @Specialization(guards = "isEmpty2D") - public RAbstractVector transpose(RAbstractVector vector) { + protected RAbstractVector transpose(RAbstractVector vector) { controlVisibility(); int[] dim = vector.getDimensions(); return vector.copyWithNewDimensions(new int[]{dim[1], dim[0]}); } @Specialization(guards = "!isEmpty2D") - public RIntVector transpose(RAbstractIntVector vector) { + protected RIntVector transpose(RAbstractIntVector vector) { controlVisibility(); return performAbstractIntVector(vector, vector.isMatrix() ? vector.getDimensions() : new int[]{vector.getLength(), 1}); } @@ -107,7 +107,7 @@ public abstract class Transpose extends RBuiltinNode { } @Specialization(guards = "!isEmpty2D") - public RDoubleVector transpose(RAbstractDoubleVector vector) { + protected RDoubleVector transpose(RAbstractDoubleVector vector) { controlVisibility(); return performAbstractDoubleVector(vector, vector.isMatrix() ? vector.getDimensions() : new int[]{vector.getLength(), 1}); } @@ -134,7 +134,7 @@ public abstract class Transpose extends RBuiltinNode { } @Specialization(guards = "!isEmpty2D") - public RStringVector transpose(RAbstractStringVector vector) { + protected RStringVector transpose(RAbstractStringVector vector) { controlVisibility(); return performAbstractStringVector(vector, vector.isMatrix() ? vector.getDimensions() : new int[]{vector.getLength(), 1}); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java index 29673a9778b0a49b31d54986edaf6bf000df9ce7..c0c702143a849beaf31466bc73a9861c484a73c7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TrigExpFunctions.java @@ -46,7 +46,7 @@ public class TrigExpFunctions { } @Specialization - public byte isType(VirtualFrame frame, @SuppressWarnings("unused") RMissing value) { + protected byte isType(VirtualFrame frame, @SuppressWarnings("unused") RMissing value) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENTS_PASSED_0_1, getRBuiltin().name()); } @@ -93,25 +93,25 @@ public class TrigExpFunctions { @RBuiltin(name = "exp", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"}) public abstract static class Exp extends AdapterCall1 { @Specialization - public double exp(int x) { + protected double exp(int x) { controlVisibility(); return Math.exp(x); } @Specialization - public double exp(double x) { + protected double exp(double x) { controlVisibility(); return Math.exp(x); } @Specialization - public RDoubleVector exp(RIntVector x) { + protected RDoubleVector exp(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.exp(d)); } @Specialization - public RDoubleVector exp(RDoubleVector x) { + protected RDoubleVector exp(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.exp(d)); } @@ -121,25 +121,25 @@ public class TrigExpFunctions { @RBuiltin(name = "expm1", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"}) public abstract static class ExpM1 extends AdapterCall1 { @Specialization - public double expm1(int x) { + protected double expm1(int x) { controlVisibility(); return Math.expm1(x); } @Specialization - public double expm1(double x) { + protected double expm1(double x) { controlVisibility(); return Math.expm1(x); } @Specialization - public RDoubleVector expm1(RIntVector x) { + protected RDoubleVector expm1(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.expm1(d)); } @Specialization - public RDoubleVector expm1(RDoubleVector x) { + protected RDoubleVector expm1(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.expm1(d)); } @@ -149,25 +149,25 @@ public class TrigExpFunctions { @RBuiltin(name = "sin", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"}) public abstract static class Sin extends AdapterCall1 { @Specialization - public double sin(int x) { + protected double sin(int x) { controlVisibility(); return Math.sin(x); } @Specialization - public double sin(double x) { + protected double sin(double x) { controlVisibility(); return Math.sin(x); } @Specialization - public RDoubleVector sin(RIntVector x) { + protected RDoubleVector sin(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.sin(d)); } @Specialization - public RDoubleVector sin(RDoubleVector x) { + protected RDoubleVector sin(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.sin(d)); } @@ -177,25 +177,25 @@ public class TrigExpFunctions { public abstract static class Cos extends AdapterCall1 { @Specialization - public double cos(int x) { + protected double cos(int x) { controlVisibility(); return Math.cos(x); } @Specialization - public double cos(double x) { + protected double cos(double x) { controlVisibility(); return Math.cos(x); } @Specialization - public RDoubleVector cos(RIntVector x) { + protected RDoubleVector cos(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.cos(d)); } @Specialization - public RDoubleVector cos(RDoubleVector x) { + protected RDoubleVector cos(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.cos(d)); } @@ -205,25 +205,25 @@ public class TrigExpFunctions { public abstract static class Tan extends AdapterCall1 { @Specialization - public double tan(int x) { + protected double tan(int x) { controlVisibility(); return Math.tan(x); } @Specialization - public double tan(double x) { + protected double tan(double x) { controlVisibility(); return Math.tan(x); } @Specialization - public RDoubleVector tan(RIntVector x) { + protected RDoubleVector tan(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.tan(d)); } @Specialization - public RDoubleVector tan(RDoubleVector x) { + protected RDoubleVector tan(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.tan(d)); } @@ -232,25 +232,25 @@ public class TrigExpFunctions { @RBuiltin(name = "asin", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"}) public abstract static class Asin extends AdapterCall1 { @Specialization - public double asin(int x) { + protected double asin(int x) { controlVisibility(); return Math.asin(x); } @Specialization - public double asin(double x) { + protected double asin(double x) { controlVisibility(); return Math.asin(x); } @Specialization - public RDoubleVector asin(RIntVector x) { + protected RDoubleVector asin(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.asin(d)); } @Specialization - public RDoubleVector asin(RDoubleVector x) { + protected RDoubleVector asin(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.asin(d)); } @@ -259,25 +259,25 @@ public class TrigExpFunctions { @RBuiltin(name = "acos", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"}) public abstract static class Acos extends AdapterCall1 { @Specialization - public double acos(int x) { + protected double acos(int x) { controlVisibility(); return Math.acos(x); } @Specialization - public double acos(double x) { + protected double acos(double x) { controlVisibility(); return Math.acos(x); } @Specialization - public RDoubleVector acos(RIntVector x) { + protected RDoubleVector acos(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.acos(d)); } @Specialization - public RDoubleVector acos(RDoubleVector x) { + protected RDoubleVector acos(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.acos(d)); } @@ -286,25 +286,25 @@ public class TrigExpFunctions { @RBuiltin(name = "atan", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"x"}) public abstract static class Atan extends AdapterCall1 { @Specialization - public double atan(int x) { + protected double atan(int x) { controlVisibility(); return Math.atan(x); } @Specialization - public double atan(double x) { + protected double atan(double x) { controlVisibility(); return Math.atan(x); } @Specialization - public RDoubleVector atan(RIntVector x) { + protected RDoubleVector atan(RIntVector x) { controlVisibility(); return doFun(x, (double d) -> Math.atan(d)); } @Specialization - public RDoubleVector atan(RDoubleVector x) { + protected RDoubleVector atan(RDoubleVector x) { controlVisibility(); return doFun(x, (double d) -> Math.atan(d)); } @@ -362,36 +362,36 @@ public class TrigExpFunctions { } @Specialization - public Object atan(VirtualFrame frame, @SuppressWarnings("unused") RMissing x, @SuppressWarnings("unused") RMissing y) { + protected Object atan(VirtualFrame frame, @SuppressWarnings("unused") RMissing x, @SuppressWarnings("unused") RMissing y) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENT_MISSING, getRBuiltin().parameterNames()[0]); } @Specialization - public Object atan(VirtualFrame frame, @SuppressWarnings("unused") RAbstractDoubleVector x, @SuppressWarnings("unused") RMissing y) { + protected Object atan(VirtualFrame frame, @SuppressWarnings("unused") RAbstractDoubleVector x, @SuppressWarnings("unused") RMissing y) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENT_MISSING, getRBuiltin().parameterNames()[1]); } @Specialization - public double atan2(double x, double y) { + protected double atan2(double x, double y) { controlVisibility(); return Math.atan2(x, y); } @Specialization - public RDoubleVector atan2(RDoubleVector x, RDoubleVector y) { + protected RDoubleVector atan2(RDoubleVector x, RDoubleVector y) { controlVisibility(); return doFun(x, y, (double d1, double d2) -> Math.atan2(d1, d2)); } @Specialization - public RDoubleVector atan2(double x, RDoubleVector y) { + protected RDoubleVector atan2(double x, RDoubleVector y) { controlVisibility(); RDoubleVector xv = RDataFactory.createDoubleVectorFromScalar(x).copyResized(y.getLength(), false); return doFun(xv, y, (double d1, double d2) -> Math.atan2(d1, d2)); } @Specialization - public RDoubleVector atan2(RDoubleVector x, double y) { + protected RDoubleVector atan2(RDoubleVector x, double y) { controlVisibility(); RDoubleVector yv = RDataFactory.createDoubleVectorFromScalar(y); return doFun(x, yv, (double d1, double d2) -> Math.atan2(d1, d2)); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TryFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TryFunctions.java index f84b2c46aba2e7335438d4736c46356857565438..f8b4d43e362dbca165aa8c58fafd219dc040a81c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TryFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/TryFunctions.java @@ -44,7 +44,7 @@ public class TryFunctions { } @Specialization - public Object doTry(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") byte silent) { + protected Object doTry(VirtualFrame frame, RPromise expr, @SuppressWarnings("unused") byte silent) { controlVisibility(); return expr.evaluate(frame); } @@ -60,13 +60,13 @@ public class TryFunctions { } @Specialization - public Object doTryCatch(VirtualFrame frame, RPromise expr, RPromise arg) { + protected Object doTryCatch(VirtualFrame frame, RPromise expr, RPromise arg) { return doTryCatch(frame, expr, new Object[]{arg}); } @SuppressWarnings("unused") @Specialization - public Object doTryCatch(VirtualFrame frame, RPromise expr, Object[] args) { + protected Object doTryCatch(VirtualFrame frame, RPromise expr, Object[] args) { controlVisibility(); return expr.evaluate(frame); } 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 6614a1afb6d2b2807a9a1613375fa13c3cb1ca44..282f1ac5ba4d7db28d4792071e1fd7056eae7cd8 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 @@ -40,7 +40,7 @@ public abstract class Typeof extends RBuiltinNode { public abstract String execute(VirtualFrame frame, Object x); @Specialization - public String typeof(VirtualFrame frame, Object obj) { + protected String typeof(VirtualFrame frame, Object obj) { if (typeofNode == null) { typeofNode = insert(TypeofNodeFactory.create(null)); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UnClass.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UnClass.java index 6ef3cc9586306fdd7acd49bbc2e51232db904492..c026bab391be571120ae1a901b2c447f765eab81 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UnClass.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UnClass.java @@ -23,7 +23,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class UnClass extends RBuiltinNode { @Specialization - public Object unClass(RAbstractVector arg) { + protected Object unClass(RAbstractVector arg) { controlVisibility(); if (arg.isObject()) { RVector resultVector = arg.materialize(); @@ -36,7 +36,7 @@ public abstract class UnClass extends RBuiltinNode { } @Specialization - public Object unClass(RDataFrame arg) { + protected Object unClass(RDataFrame arg) { controlVisibility(); RDataFrame resultFrame = arg; if (resultFrame.isShared()) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unique.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unique.java index 3820f712be824c147670f67f9e1fc496ff394ba5..e1318e1d3c003d897b9707160d2111a236abe521 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unique.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unique.java @@ -50,7 +50,13 @@ public abstract class Unique extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RStringVector doUnique(RAbstractStringVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { + protected RNull doUnique(RNull vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { + return vec; + } + + @SuppressWarnings("unused") + @Specialization + protected RStringVector doUnique(RAbstractStringVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { ArrayList<String> dataList = new ArrayList<>(vec.getLength()); for (int i = 0; i < vec.getLength(); i++) { String s = vec.getDataAt(i); @@ -193,7 +199,7 @@ public abstract class Unique extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RIntVector doUnique(RAbstractIntVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { + protected RIntVector doUnique(RAbstractIntVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { IntArray dataList = new IntArray(vec.getLength()); for (int i = 0; i < vec.getLength(); i++) { int val = vec.getDataAt(i); @@ -206,7 +212,7 @@ public abstract class Unique extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RDoubleVector doUnique(RAbstractDoubleVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { + protected RDoubleVector doUnique(RAbstractDoubleVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { DoubleArray dataList = new DoubleArray(vec.getLength()); for (int i = 0; i < vec.getLength(); i++) { double val = vec.getDataAt(i); @@ -219,7 +225,7 @@ public abstract class Unique extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RLogicalVector doUnique(RAbstractLogicalVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { + protected RLogicalVector doUnique(RAbstractLogicalVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { ByteArray dataList = new ByteArray(vec.getLength()); for (int i = 0; i < vec.getLength(); i++) { byte val = vec.getDataAt(i); @@ -232,7 +238,7 @@ public abstract class Unique extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RComplexVector doUnique(RAbstractComplexVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { + protected RComplexVector doUnique(RAbstractComplexVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { DoubleArrayForComplex dataList = new DoubleArrayForComplex(vec.getLength()); for (int i = 0; i < vec.getLength(); i++) { RComplex s = vec.getDataAt(i); @@ -245,7 +251,7 @@ public abstract class Unique extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RRawVector doUnique(RAbstractRawVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { + protected RRawVector doUnique(RAbstractRawVector vec, byte incomparables, byte fromLast, byte nmax, RMissing vararg) { ByteArray dataList = new ByteArray(vec.getLength()); for (int i = 0; i < vec.getLength(); i++) { byte val = vec.getDataAt(i).getValue(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java index 2823eac2a321082bc9d671f3898c78a9e79b1429..03b2d3b1138b67f44f1ec0b5de8908ecf4e3fc56 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java @@ -62,17 +62,17 @@ public abstract class Unlist extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public int getLength(RNull vector) { + protected int getLength(RNull vector) { return 0; } @Specialization(guards = "!isVectorList") - public int getLength(RAbstractVector vector) { + protected int getLength(RAbstractVector vector) { return vector.getLength(); } @Specialization(guards = "isVectorList") - public int getLengthList(VirtualFrame frame, RAbstractVector vector) { + protected int getLengthList(VirtualFrame frame, RAbstractVector vector) { int totalSize = 0; for (int i = 0; i < vector.getLength(); ++i) { Object data = vector.getDataAtAsObject(i); @@ -104,21 +104,21 @@ public abstract class Unlist extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public RNull unlist(RNull vector, byte recursive, byte useNames) { + protected RNull unlist(RNull vector, byte recursive, byte useNames) { controlVisibility(); return RNull.instance; } @SuppressWarnings("unused") @Specialization(guards = "!isVectorList") - public RAbstractVector unlistVector(RAbstractVector vector, byte recursive, byte useNames) { + protected RAbstractVector unlistVector(RAbstractVector vector, byte recursive, byte useNames) { controlVisibility(); return vector; } @SuppressWarnings("unused") @Specialization(guards = "isEmpty") - public RNull unlistEmptyList(VirtualFrame frame, RList list, byte recursive, byte useNames) { + protected RNull unlistEmptyList(VirtualFrame frame, RList list, byte recursive, byte useNames) { controlVisibility(); return RNull.instance; } @@ -126,7 +126,7 @@ public abstract class Unlist extends RBuiltinNode { // TODO: initially unlist was on the slow path - hence initial recursive implementation is on // the slow path as well; ultimately we may consider (non-recursive) optimization @Specialization(guards = "!isEmpty") - public RAbstractVector unlistList(VirtualFrame frame, RList list, byte recursive, byte useNames) { + protected RAbstractVector unlistList(VirtualFrame frame, RList list, byte recursive, byte useNames) { controlVisibility(); boolean rec = recursive == RRuntime.LOGICAL_TRUE; boolean withNames = useNames == RRuntime.LOGICAL_TRUE; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttr.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttr.java index ea9c73728774b8edcd4884af791e01e5c59c4375..456679dc0afbd3dbbbec1fbab1e7804adca493f7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttr.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttr.java @@ -87,7 +87,7 @@ public abstract class UpdateAttr extends RInvisibleBuiltinNode { } @Specialization(guards = "nullValue") - public RAbstractContainer updateAttr(VirtualFrame frame, RAbstractContainer container, String name, RNull value) { + protected RAbstractContainer updateAttr(VirtualFrame frame, RAbstractContainer container, String name, RNull value) { controlVisibility(); RVector resultVector = container.materializeNonSharedVector(); if (name.equals(RRuntime.DIM_ATTR_KEY)) { @@ -118,7 +118,7 @@ public abstract class UpdateAttr extends RInvisibleBuiltinNode { } @Specialization(guards = "!nullValue") - public RAbstractContainer updateAttr(VirtualFrame frame, RAbstractContainer container, String name, Object value) { + protected RAbstractContainer updateAttr(VirtualFrame frame, RAbstractContainer container, String name, Object value) { controlVisibility(); RVector resultVector = container.materializeNonSharedVector(); if (name.equals(RRuntime.DIM_ATTR_KEY)) { @@ -144,7 +144,7 @@ public abstract class UpdateAttr extends RInvisibleBuiltinNode { } @Specialization(guards = "!nullValue") - public RAbstractContainer updateAttr(VirtualFrame frame, RAbstractVector vector, RStringVector name, Object value) { + protected RAbstractContainer updateAttr(VirtualFrame frame, RAbstractVector vector, RStringVector name, Object value) { controlVisibility(); return updateAttr(frame, vector, name.getDataAt(0), value); } @@ -156,14 +156,14 @@ public abstract class UpdateAttr extends RInvisibleBuiltinNode { } @Specialization(guards = "!nullValueforEnv") - public REnvironment updateAttr(VirtualFrame frame, REnvironment env, String name, Object value) { + protected REnvironment updateAttr(VirtualFrame frame, REnvironment env, String name, Object value) { controlVisibility(); env.setAttr(name, value); return env; } @Specialization(guards = "nullValueforEnv") - public REnvironment updateAttr(VirtualFrame frame, REnvironment env, String name, RNull value) { + protected REnvironment updateAttr(VirtualFrame frame, REnvironment env, String name, RNull value) { controlVisibility(); env.removeAttr(name); return env; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttributes.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttributes.java index ae010e527a5e29cf23aba651542aeacacf578dc0..42b655c5c18797e534a905bf0f04708e1343f53f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttributes.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttributes.java @@ -77,7 +77,7 @@ public abstract class UpdateAttributes extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateAttributes(VirtualFrame frame, RAbstractVector abstractVector, RNull list) { + protected RAbstractVector updateAttributes(VirtualFrame frame, RAbstractVector abstractVector, RNull list) { controlVisibility(); RVector resultVector = abstractVector.materialize(); resultVector.resetAllAttributes(true); @@ -85,7 +85,7 @@ public abstract class UpdateAttributes extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateAttributes(VirtualFrame frame, RAbstractContainer container, RList list) { + protected RAbstractVector updateAttributes(VirtualFrame frame, RAbstractContainer container, RList list) { controlVisibility(); Object listNamesObject = list.getNames(); if (listNamesObject == null || listNamesObject == RNull.instance) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateClass.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateClass.java index dc8a6aea3ff68f8b50c4e6ec53a39250aad89709..0bc41f939b86eb66bf172a87102b6593fdd3a078 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateClass.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateClass.java @@ -35,7 +35,7 @@ public abstract class UpdateClass extends RInvisibleBuiltinNode { public abstract Object execute(VirtualFrame frame, RAbstractContainer vector, Object o); @Specialization(guards = "!isStringVector") - public Object setClass(VirtualFrame frame, RAbstractContainer arg, RAbstractVector className) { + protected Object setClass(VirtualFrame frame, RAbstractContainer arg, RAbstractVector className) { controlVisibility(); if (className.getLength() == 0) { return setClass(arg, RNull.instance); @@ -49,14 +49,14 @@ public abstract class UpdateClass extends RInvisibleBuiltinNode { } @Specialization - public Object setClass(RAbstractContainer arg, @SuppressWarnings("unused") RNull className) { + protected Object setClass(RAbstractContainer arg, @SuppressWarnings("unused") RNull className) { controlVisibility(); RVector resultVector = arg.materializeNonSharedVector(); return RVector.setClassAttr(resultVector, null, arg.getElementClass() == RVector.class ? arg : null); } @Specialization - public Object setClass(VirtualFrame frame, RAbstractContainer arg, String className) { + protected Object setClass(VirtualFrame frame, RAbstractContainer arg, String className) { controlVisibility(); initTypeof(); if (!arg.isObject()) { @@ -94,7 +94,7 @@ public abstract class UpdateClass extends RInvisibleBuiltinNode { } @Specialization - public Object setClass(RAbstractContainer arg, RStringVector className) { + protected Object setClass(RAbstractContainer arg, RStringVector className) { controlVisibility(); RVector resultVector = arg.materializeNonSharedVector(); return RVector.setClassAttr(resultVector, className, arg.getElementClass() == RVector.class ? arg : null); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDiag.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDiag.java index 9ec97acd88f24294243e7c0eb6e3108760847464..30fcd1f4e9f13f8132e67f4d5097d4b9319f81f5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDiag.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDiag.java @@ -43,40 +43,40 @@ public abstract class UpdateDiag extends RInvisibleBuiltinNode { @Child protected CastDoubleNode castDouble; - public static boolean isMatrix(RAbstractVector vector) { + protected static boolean isMatrix(RAbstractVector vector) { return vector.hasDimensions() && vector.getDimensions().length == 2; } // FIXME The following two are workarounds for a Truffle-DSL bug. - public static boolean isMatrix(RAbstractIntVector vector) { + protected static boolean isMatrix(RAbstractIntVector vector) { return isMatrix((RAbstractVector) vector); } - public static boolean isMatrix(RAbstractDoubleVector vector) { + protected static boolean isMatrix(RAbstractDoubleVector vector) { return isMatrix((RAbstractVector) vector); } - public static boolean correctReplacementLength(RAbstractVector matrix, RAbstractVector replacement) { + protected static boolean correctReplacementLength(RAbstractVector matrix, RAbstractVector replacement) { return replacement.getLength() == 1 || Math.min(matrix.getDimensions()[0], matrix.getDimensions()[1]) == replacement.getLength(); } @SuppressWarnings("unused") @Specialization(guards = "!isMatrix") - public RIntVector updateDiagNoMatrix(VirtualFrame frame, RAbstractVector vector, RAbstractVector valueVector) { + protected RIntVector updateDiagNoMatrix(VirtualFrame frame, RAbstractVector vector, RAbstractVector valueVector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.ONLY_MATRIX_DIAGONALS); } @SuppressWarnings("unused") @Specialization(guards = {"isMatrix", "!correctReplacementLength"}) - public RIntVector updateDiagReplacementDiagonalLength(VirtualFrame frame, RAbstractVector vector, RAbstractVector valueVector) { + protected RIntVector updateDiagReplacementDiagonalLength(VirtualFrame frame, RAbstractVector vector, RAbstractVector valueVector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_DIAGONAL_LENGTH); } @Specialization(guards = {"isMatrix", "correctReplacementLength"}) - public RAbstractIntVector updateDiag(RIntVector vector, RAbstractIntVector valueVector) { + protected RAbstractIntVector updateDiag(RIntVector vector, RAbstractIntVector valueVector) { controlVisibility(); RIntVector resultVector = vector; if (vector.isShared()) { @@ -95,7 +95,7 @@ public abstract class UpdateDiag extends RInvisibleBuiltinNode { } @Specialization(guards = {"isMatrix", "correctReplacementLength"}) - public RAbstractDoubleVector updateDiag(RDoubleVector vector, RAbstractDoubleVector valueVector) { + protected RAbstractDoubleVector updateDiag(RDoubleVector vector, RAbstractDoubleVector valueVector) { controlVisibility(); RDoubleVector resultVector = vector; if (vector.isShared()) { @@ -114,7 +114,7 @@ public abstract class UpdateDiag extends RInvisibleBuiltinNode { } @Specialization(guards = {"isMatrix", "correctReplacementLength"}) - public RAbstractDoubleVector updateDiag(VirtualFrame frame, RIntVector vector, RAbstractDoubleVector valueVector) { + protected RAbstractDoubleVector updateDiag(VirtualFrame frame, RIntVector vector, RAbstractDoubleVector valueVector) { controlVisibility(); if (castDouble == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDim.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDim.java index 8d9fbe00cb2c963a1dc4a36d0470ebc28828c668..3aa22f994127f1367aa729202794cd73c5bce052 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDim.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDim.java @@ -49,7 +49,7 @@ public abstract class UpdateDim extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateDim(RAbstractVector vector, RNull dimensions) { + protected RAbstractVector updateDim(RAbstractVector vector, RNull dimensions) { controlVisibility(); RVector result = vector.materialize(); result.resetDimensions(null); @@ -57,7 +57,7 @@ public abstract class UpdateDim extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateDim(VirtualFrame frame, RAbstractVector vector, RAbstractVector dimensions) { + protected RAbstractVector updateDim(VirtualFrame frame, RAbstractVector vector, RAbstractVector dimensions) { controlVisibility(); if (dimensions.getLength() == 0) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.LENGTH_ZERO_DIM_INVALID); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDimNames.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDimNames.java index 44c8611a63d4c51fcdd5990273e526bc0fdd2808..7b24e103635c79f35c6099d21d1758482e31c225 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDimNames.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateDimNames.java @@ -72,7 +72,7 @@ public abstract class UpdateDimNames extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateDimnames(VirtualFrame frame, RAbstractVector vector, RNull list) { + protected RAbstractVector updateDimnames(VirtualFrame frame, RAbstractVector vector, RNull list) { RVector v = vector.materialize(); v.setDimNames(frame, null, getEncapsulatingSourceSection()); controlVisibility(); @@ -80,7 +80,7 @@ public abstract class UpdateDimNames extends RInvisibleBuiltinNode { } @Specialization(guards = "isZeroLength") - public RAbstractVector updateDimnamesEmpty(VirtualFrame frame, RAbstractVector vector, RList list) { + protected RAbstractVector updateDimnamesEmpty(VirtualFrame frame, RAbstractVector vector, RList list) { RVector v = vector.materialize(); v.setDimNames(frame, null, getEncapsulatingSourceSection()); controlVisibility(); @@ -88,7 +88,7 @@ public abstract class UpdateDimNames extends RInvisibleBuiltinNode { } @Specialization(guards = "!isZeroLength") - public RAbstractVector updateDimnames(VirtualFrame frame, RAbstractVector vector, RList list) { + protected RAbstractVector updateDimnames(VirtualFrame frame, RAbstractVector vector, RList list) { RVector v = vector.materialize(); v.setDimNames(frame, convertToListOfStrings(frame, list), getEncapsulatingSourceSection()); controlVisibility(); @@ -96,13 +96,13 @@ public abstract class UpdateDimNames extends RInvisibleBuiltinNode { } @Specialization(guards = "!isVectorList") - public RAbstractVector updateDimnamesError(VirtualFrame frame, RAbstractVector vector, RAbstractVector v) { + protected RAbstractVector updateDimnamesError(VirtualFrame frame, RAbstractVector vector, RAbstractVector v) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.DIMNAMES_LIST); } @Specialization - public RAbstractVector updateDimnamesError(VirtualFrame frame, RAbstractVector vector, RFunction v) { + protected RAbstractVector updateDimnamesError(VirtualFrame frame, RAbstractVector vector, RFunction v) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.DIMNAMES_LIST); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLength.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLength.java index 0681ff70d6d129fb9bd5956276e4dd87da888598..aa5680906df4532c75dd99d30d03c7c70935a089 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLength.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLength.java @@ -45,7 +45,7 @@ public abstract class UpdateLength extends RInvisibleBuiltinNode { } @Specialization(guards = "isLengthOne") - public RAbstractVector updateLength(RAbstractVector vector, RAbstractIntVector lengthVector) { + protected RAbstractVector updateLength(RAbstractVector vector, RAbstractIntVector lengthVector) { controlVisibility(); int length = lengthVector.getDataAt(0); RVector resultVector = vector.materialize(); @@ -59,14 +59,14 @@ public abstract class UpdateLength extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "!isLengthOne") - public RAbstractVector updateLengthError(VirtualFrame frame, RAbstractVector vector, RAbstractIntVector lengthVector) { + protected RAbstractVector updateLengthError(VirtualFrame frame, RAbstractVector vector, RAbstractIntVector lengthVector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.INVALID_UNNAMED_VALUE); } @SuppressWarnings("unused") @Specialization - public Object updateLengthError(VirtualFrame frame, Object vector, Object lengthVector) { + protected Object updateLengthError(VirtualFrame frame, Object vector, Object lengthVector) { controlVisibility(); throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.INVALID_UNNAMED_VALUE); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLevels.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLevels.java index 85b8434b6908208ffb85739b8081c08ab0d72ec6..dc1d8939f285462702e35d3e81b9e6a096684b05 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLevels.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateLevels.java @@ -22,7 +22,7 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class UpdateLevels extends RInvisibleBuiltinNode { @Specialization - public RAbstractVector updateLevels(RAbstractVector vector, @SuppressWarnings("unused") RNull levels) { + protected RAbstractVector updateLevels(RAbstractVector vector, @SuppressWarnings("unused") RNull levels) { controlVisibility(); RVector v = vector.materialize(); v.setLevels(null); @@ -30,7 +30,7 @@ public abstract class UpdateLevels extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateLevels(RAbstractVector vector, Object levels) { + protected RAbstractVector updateLevels(RAbstractVector vector, Object levels) { controlVisibility(); RVector v = vector.materialize(); v.setLevels(levels); 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 ef020def428522489b5238e3ff0d326dab875b76..24cae83a388f1eceed57862c19da8f66d35b1c06 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 @@ -52,7 +52,7 @@ public abstract class UpdateNames extends RInvisibleBuiltinNode { public abstract Object executeStringVector(VirtualFrame frame, RAbstractVector vector, Object o); @Specialization - public RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, @SuppressWarnings("unused") RNull names) { + protected RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, @SuppressWarnings("unused") RNull names) { controlVisibility(); RVector v = vector.materialize(); v.setNames(frame, null, getEncapsulatingSourceSection()); @@ -60,7 +60,7 @@ public abstract class UpdateNames extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, RStringVector names) { + protected RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, RStringVector names) { controlVisibility(); RVector v = vector.materialize(); RStringVector namesVector = names; @@ -72,7 +72,7 @@ public abstract class UpdateNames extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, String name) { + protected RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, String name) { controlVisibility(); RVector v = vector.materialize(); String[] names = new String[v.getLength()]; @@ -84,7 +84,7 @@ public abstract class UpdateNames extends RInvisibleBuiltinNode { } @Specialization - public RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, Object names) { + protected RAbstractVector updateNames(VirtualFrame frame, RAbstractVector vector, Object names) { controlVisibility(); if (names instanceof RAbstractVector) { return updateNames(frame, vector, (RStringVector) castString(frame, names)); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateOldClass.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateOldClass.java index 27ce456e5d5c30d768ea4b538cc576000c4494fa..ff6ea8301fbe18bf624c2c642f0aac5fd03c0d97 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateOldClass.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateOldClass.java @@ -47,7 +47,7 @@ public abstract class UpdateOldClass extends RInvisibleBuiltinNode { public abstract Object execute(VirtualFrame frame, RAbstractContainer vector, Object o); @Specialization(guards = "!isStringVector") - public Object setOldClass(VirtualFrame frame, RAbstractContainer arg, RAbstractVector className) { + protected Object setOldClass(VirtualFrame frame, RAbstractContainer arg, RAbstractVector className) { controlVisibility(); if (className.getLength() == 0) { return setOldClass(arg, RNull.instance); @@ -61,19 +61,19 @@ public abstract class UpdateOldClass extends RInvisibleBuiltinNode { } @Specialization - public Object setOldClass(RAbstractContainer arg, String className) { + protected Object setOldClass(RAbstractContainer arg, String className) { return setOldClass(arg, RDataFactory.createStringVector(className)); } @Specialization - public Object setOldClass(RAbstractContainer arg, RStringVector className) { + protected Object setOldClass(RAbstractContainer arg, RStringVector className) { controlVisibility(); RVector resultVector = arg.materializeNonSharedVector(); return RVector.setClassAttr(resultVector, className, arg.getElementClass() == RVector.class ? arg : null); } @Specialization - public Object setOldClass(RAbstractContainer arg, @SuppressWarnings("unused") RNull className) { + protected Object setOldClass(RAbstractContainer arg, @SuppressWarnings("unused") RNull className) { controlVisibility(); RVector resultVector = arg.materializeNonSharedVector(); return RVector.setClassAttr(resultVector, null, arg.getElementClass() == RVector.class ? arg : null); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateStorageMode.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateStorageMode.java index 6e12f72b7448db16c688fc1d3238e2990447d6f4..e3b0ce9a3a9719c5eef361e61d1f83e9619f5da8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateStorageMode.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateStorageMode.java @@ -33,7 +33,7 @@ public abstract class UpdateStorageMode extends RBuiltinNode { @Child private IsFactorNode isFactor; @Specialization(guards = {"!isReal", "!isSingle"}) - public Object update(VirtualFrame frame, final Object x, final String value) { + protected Object update(VirtualFrame frame, final Object x, final String value) { controlVisibility(); if (typeof == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -74,21 +74,21 @@ public abstract class UpdateStorageMode extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "isReal") - public Object updateReal(VirtualFrame frame, final Object x, final String value) { + protected Object updateReal(VirtualFrame frame, final Object x, final String value) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.USE_DEFUNCT, RRuntime.REAL, RRuntime.TYPE_DOUBLE); } @SuppressWarnings("unused") @Specialization(guards = "isSingle") - public Object updateSingle(VirtualFrame frame, final Object x, final String value) { + protected Object updateSingle(VirtualFrame frame, final Object x, final String value) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.USE_DEFUNCT, RRuntime.SINGLE, "mode<-"); } @SuppressWarnings("unused") @Specialization - public Object update(VirtualFrame frame, final Object x, final Object value) { + protected Object update(VirtualFrame frame, final Object x, final Object value) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NULL_VALUE); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateSubstr.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateSubstr.java index 183e5f8e699ba7fc15be437145d4e8cd55c6ced6..26d853894e2c7916e47642d770bcacf38f6428a2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateSubstr.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateSubstr.java @@ -40,7 +40,7 @@ public abstract class UpdateSubstr extends RBuiltinNode { protected final NACheck na = NACheck.create(); - private BranchProfile everSeenIllegalRange = new BranchProfile(); + private final BranchProfile everSeenIllegalRange = new BranchProfile(); protected static boolean rangeOk(String x, int start, int stop) { return start <= stop && start > 0 && stop > 0 && start <= x.length() && stop <= x.length(); @@ -80,31 +80,31 @@ public abstract class UpdateSubstr extends RBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "emptyArg") - public RStringVector substrEmptyArg(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, Object value) { + protected RStringVector substrEmptyArg(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, Object value) { return RDataFactory.createEmptyStringVector(); } @SuppressWarnings("unused") @Specialization(guards = {"!emptyArg", "wrongParams"}) - public RNull substrWrongParams(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, Object value) { + protected RNull substrWrongParams(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, Object value) { assert false; // should never happen return RNull.instance; // dummy } @SuppressWarnings("unused") @Specialization(guards = {"!emptyArg", "!wrongParams"}) - public RStringVector substr(VirtualFrame frame, RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, RNull value) { + protected RStringVector substr(VirtualFrame frame, RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, RNull value) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_UNNAMED_VALUE); } @SuppressWarnings("unused") @Specialization(guards = {"!emptyArg", "!wrongParams", "wrongValue"}) - public RStringVector substr(VirtualFrame frame, RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, RAbstractVector value) { + protected RStringVector substr(VirtualFrame frame, RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, RAbstractVector value) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_UNNAMED_VALUE); } @Specialization(guards = {"!emptyArg", "!wrongParams", "!wrongValue"}) - public RStringVector substr(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, RAbstractStringVector value) { + protected RStringVector substr(RAbstractStringVector arg, RAbstractIntVector start, RAbstractIntVector stop, RAbstractStringVector value) { String[] res = new String[arg.getLength()]; for (int i = 0, j = 0, k = 0, l = 0; i < arg.getLength(); ++i, j = Utils.incMod(j, start.getLength()), k = Utils.incMod(k, stop.getLength()), l = Utils.incMod(k, value.getLength())) { res[i] = substr0(arg.getDataAt(i), start.getDataAt(j), stop.getDataAt(k), value.getDataAt(l)); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpperTri.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpperTri.java index 9858be9ac80a376b888ed438c91529ca2278d92e..4bc8cfba58d5fbf2d854615752d8498bc98ccc76 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpperTri.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpperTri.java @@ -42,7 +42,7 @@ public abstract class UpperTri extends RBuiltinNode { } @Specialization - public RLogicalVector upperTri(RAbstractVector vector, byte diag) { + protected RLogicalVector upperTri(RAbstractVector vector, byte diag) { controlVisibility(); int[] dim = preprocessDim(vector); int size = Math.min(dim[0], dim[1]); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UseMethod.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UseMethod.java index 23b547951d969893a906ec2c36c08197d0f517a6..2bee3d7632309969abfdb3f92652335c992a48c9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UseMethod.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UseMethod.java @@ -35,7 +35,6 @@ public abstract class UseMethod extends RBuiltinNode { @Child UseMethodNode useMethodNode; public UseMethod() { - super(); this.useMethodNode = new UninitializedUseMethodNode(0, getSuppliedArgsNames()); } @@ -45,7 +44,7 @@ public abstract class UseMethod extends RBuiltinNode { } @Specialization - public Object execute(VirtualFrame frame, String generic, Object arg) { + protected Object execute(VirtualFrame frame, String generic, Object arg) { controlVisibility(); throw new ReturnException(useMethodNode.execute(frame, generic, arg)); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/VApply.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/VApply.java index af67eb54dcd3287ef753219e5911aa11d2d37904..ea663b5882f28db20022eddeb129ba87c611d516 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/VApply.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/VApply.java @@ -40,7 +40,7 @@ public abstract class VApply extends RBuiltinNode { // TODO complete the implementation so that it works for all types of x and fun @Specialization - public Object vapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object[] optionalArgs) { + protected Object vapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object[] optionalArgs) { controlVisibility(); // The first element of optionalArgs is FUN_VALUE Object funValue = optionalArgs[0]; @@ -71,7 +71,7 @@ public abstract class VApply extends RBuiltinNode { } @Specialization - public Object vapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object optionalArg) { + protected Object vapply(VirtualFrame frame, RAbstractVector x, RFunction fun, Object optionalArg) { Object[] optionalArgs = new Object[]{optionalArg}; return vapply(frame, x, fun, optionalArgs); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Vector.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Vector.java index 31928feb4c18575cdf2854a236cffeb17e736aa9..40bcc03cba71f4fc643dbf0fd47d78776c5027ff 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Vector.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Vector.java @@ -53,7 +53,7 @@ public abstract class Vector extends RBuiltinNode { } @Specialization - public RAbstractVector vector(VirtualFrame frame, String mode, int length) { + protected RAbstractVector vector(VirtualFrame frame, String mode, int length) { controlVisibility(); switch (mode) { case "character": diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java index 16d19de00f4b5520c15b1c84be711dd65e99cc8a..6a8660d26af51b03bfcb2dd302806ad2b557fb91 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WhichFunctions.java @@ -49,7 +49,7 @@ public class WhichFunctions { } @Specialization - public RIntVector which(RAbstractLogicalVector x) { + protected RIntVector which(RAbstractLogicalVector x) { controlVisibility(); ArrayList<Integer> w = new ArrayList<>(); for (int i = 0; i < x.getLength(); ++i) { @@ -75,7 +75,7 @@ public class WhichFunctions { } @Specialization - public int which(RAbstractDoubleVector x) { + protected int which(RAbstractDoubleVector x) { controlVisibility(); double max = x.getDataAt(0); int maxIndex = 0; @@ -100,7 +100,7 @@ public class WhichFunctions { } @Specialization - public int which(RAbstractDoubleVector x) { + protected int which(RAbstractDoubleVector x) { controlVisibility(); double minimum = x.getDataAt(0); int minIndex = 0; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRCompileBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRCompileBuiltin.java index d71ac64451b02f7cf4bab3cd623e1a7dd7e5bd89..d55b8379999f9453ba0bfb3510eae5460aecdb4d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRCompileBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRCompileBuiltin.java @@ -36,7 +36,7 @@ import com.oracle.truffle.r.runtime.data.*; @RBuiltin(name = "fastr.compile", kind = PRIMITIVE, parameterNames = {"func"}) public abstract class FastRCompileBuiltin extends RBuiltinNode { - static final class Compiler { + private static final class Compiler { private Class<?> optimizedCallTarget; private Method compileMethod; @@ -71,7 +71,7 @@ public abstract class FastRCompileBuiltin extends RBuiltinNode { private static final Compiler compiler = Compiler.getCompiler(); @Specialization - public byte compileFunction(VirtualFrame frame, RFunction function) { + protected byte compileFunction(VirtualFrame frame, RFunction function) { controlVisibility(); if (compiler != null) { try { @@ -86,7 +86,7 @@ public abstract class FastRCompileBuiltin extends RBuiltinNode { } @Specialization - public byte compileFunction(VirtualFrame frame, @SuppressWarnings("unused") Object arg) { + protected byte compileFunction(VirtualFrame frame, @SuppressWarnings("unused") Object arg) { controlVisibility(); throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARGUMENT, "function"); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRDumpBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRDumpBuiltin.java index 3d8b59e917def0b5dbf13a63eef7f13c9966f3b6..af9421f367b1e8afb1093a0700234084ca58b33a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRDumpBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRDumpBuiltin.java @@ -54,7 +54,7 @@ public abstract class FastRDumpBuiltin extends RInvisibleBuiltinNode { } @Specialization - public Object dump(RFunction function, byte igvDump, byte verbose) { + protected Object dump(RFunction function, byte igvDump, byte verbose) { controlVisibility(); RootNode root = function.getTarget().getRootNode(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInfoBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInfoBuiltin.java index 40b00afa51a492cb1253940d62438a069a28cc60..3c5b84118ba74a459c5d3d38205b2b0416e7927f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInfoBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInfoBuiltin.java @@ -37,7 +37,7 @@ public abstract class FastRInfoBuiltin extends RBuiltinNode { @SlowPath @Specialization - public Object printTree() { + protected Object printTree() { controlVisibility(); RContext.getInstance(); StringBuilder b = new StringBuilder(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRRunDump.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRRunDump.java index 56916e88206ccf6cf1d8066ffc7eb6c632d04c53..65329f33aacb10e0b9ea9b40dd9da5636b7b3f40 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRRunDump.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRRunDump.java @@ -40,7 +40,7 @@ import com.oracle.truffle.r.runtime.data.*; * Run a FastR function, and dump its AST to IGV before and after running. If no function is passed, * this builtin does not do anything. */ -@RBuiltin(name = "fastr.rundump", parameterNames = {"function"}, kind = PRIMITIVE) +@RBuiltin(name = "fastr.rundump", parameterNames = {"func"}, kind = PRIMITIVE) public abstract class FastRRunDump extends RInvisibleBuiltinNode { // TODO Make this more versatile by allowing actual function calls with arguments to be @@ -56,12 +56,12 @@ public abstract class FastRRunDump extends RInvisibleBuiltinNode { } @Specialization - public Object runDump(RNull function) { + protected Object runDump(RNull function) { return function; } @Specialization - public Object runDump(VirtualFrame frame, RFunction function) { + protected Object runDump(VirtualFrame frame, RFunction function) { controlVisibility(); Object r = RNull.instance; graphPrinter.beginGroup(RRuntime.toString(function)); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSetField.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSetField.java new file mode 100644 index 0000000000000000000000000000000000000000..ed9964c835d5e36e520ba9a69562895a18fdbe50 --- /dev/null +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSetField.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.nodes.builtin.fastr; + +import java.lang.reflect.*; + +import com.oracle.truffle.api.dsl.*; +import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.r.nodes.builtin.*; +import com.oracle.truffle.r.runtime.*; +import com.oracle.truffle.r.runtime.RError.*; +import com.oracle.truffle.r.runtime.data.*; +import com.oracle.truffle.r.runtime.data.model.*; + +@RBuiltin(name = "fastr.setfield", kind = RBuiltinKind.PRIMITIVE, parameterNames = {"field", "value"}) +public abstract class FastRSetField extends RInvisibleBuiltinNode { + + @Specialization + protected RNull setField(VirtualFrame frame, RAbstractStringVector vec, Object value) { + controlVisibility(); + String qualFieldName = vec.getDataAt(0); + int lx = qualFieldName.lastIndexOf('.'); + String simpleName = qualFieldName.substring(lx + 1); + String className = qualFieldName.substring(0, lx); + if (!className.startsWith("com")) { + className = "com.oracle.truffle.r." + className; + } + try { + Class<?> klass = Class.forName(className); + Field field = klass.getDeclaredField(simpleName); + field.setAccessible(true); + Class<?> fieldType = field.getType(); + switch (fieldType.getSimpleName()) { + case "boolean": + if (value instanceof Byte) { + field.setBoolean(null, RRuntime.fromLogical((byte) value)); + } else { + error(frame, qualFieldName); + } + } + } catch (Exception ex) { + throw RError.error(frame, Message.GENERIC, ex.getMessage()); + } + return RNull.instance; + } + + private static void error(VirtualFrame frame, String fieldName) throws RError { + throw RError.error(frame, Message.GENERIC, "value is wrong type for %s", fieldName); + } + +} diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSource.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSource.java index 2d54651ba5820ab2bd26f04dc4fd655303e8285e..80ccc4619c92eed260783cbce9cc92f8b4d184ec 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSource.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSource.java @@ -41,7 +41,7 @@ public abstract class FastRSource extends RBuiltinNode { @SlowPath @Specialization - public String debugSource(RFunction f) { + protected String debugSource(RFunction f) { controlVisibility(); CallTarget ct = f.getTarget(); if (!(ct instanceof DefaultCallTarget)) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTreeBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTreeBuiltin.java index 3f3c9e8b83af5a598f008eb18f85e2e5001f969c..9992945e5a507e423c4f45bd4c92713aaa2fc3d8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTreeBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTreeBuiltin.java @@ -43,7 +43,7 @@ public abstract class FastRTreeBuiltin extends RBuiltinNode { } @Specialization - public Object printTree(RFunction function, byte verbose) { + protected Object printTree(RFunction function, byte verbose) { controlVisibility(); RootNode root = function.getTarget().getRootNode(); if (verbose == RRuntime.LOGICAL_TRUE) { @@ -54,7 +54,7 @@ public abstract class FastRTreeBuiltin extends RBuiltinNode { } @Specialization - public RNull printTree(VirtualFrame frame, Object function, @SuppressWarnings("unused") Object verbose) { + protected RNull printTree(VirtualFrame frame, Object function, @SuppressWarnings("unused") Object verbose) { controlVisibility(); throw RError.error(frame, RError.Message.INVALID_VALUE, RRuntime.toString(function)); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTypeOfBuiltin.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTypeOfBuiltin.java index 2f5a54b0aa53f6b5532ebdcce61e0491cfea745f..df5301661abcd57bcdc0281859894ee72a7d3e11 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTypeOfBuiltin.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRTypeOfBuiltin.java @@ -33,7 +33,7 @@ import com.oracle.truffle.r.runtime.*; public abstract class FastRTypeOfBuiltin extends RBuiltinNode { @Specialization - public String type(Object value) { + protected String type(Object value) { controlVisibility(); return value.getClass().getSimpleName(); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRUsePromises.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRUsePromises.java index bf9f722c03d27a17171f178022b5772df4908bfd..5455da8cb70e5bdfb34c7adfc9869b2399f0dd17 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRUsePromises.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRUsePromises.java @@ -39,7 +39,7 @@ public abstract class FastRUsePromises extends RInvisibleBuiltinNode { } @Specialization - public Object debugPromise(RFunction function) { + protected Object debugPromise(RFunction function) { controlVisibility(); function.setUsePromises(); return RNull.instance; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Rnorm.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Rnorm.java index 99a8e5634c941b9c935293fad51b2050ac28c23a..ad889af91689a5033d84d62acf6347372bbc1231 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Rnorm.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Rnorm.java @@ -35,7 +35,7 @@ public abstract class Rnorm extends RBuiltinNode { } @Specialization - public RDoubleVector rnorm(int n, double mean, double standardd) { + protected RDoubleVector rnorm(int n, double mean, double standardd) { controlVisibility(); double[] result = new double[n]; for (int i = 0; i < n; i++) { @@ -45,13 +45,13 @@ public abstract class Rnorm extends RBuiltinNode { } @Specialization - public RDoubleVector rnorm(int n, int mean, int standardd) { + protected RDoubleVector rnorm(int n, int mean, int standardd) { controlVisibility(); return rnorm(n, (double) mean, (double) standardd); } @Specialization - public RDoubleVector rnorm(double n, double mean, double standardd) { + protected RDoubleVector rnorm(double n, double mean, double standardd) { controlVisibility(); return rnorm((int) n, mean, standardd); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Runif.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Runif.java index 3478c7acfa61b05c6a2efa2623bb16618a87d6a0..121f59c13fd01d4ab9f67a49460ddb2e27aff8de 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Runif.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Runif.java @@ -45,7 +45,7 @@ public abstract class Runif extends RBuiltinNode { } @Specialization - public RDoubleVector runif(int n) { + protected RDoubleVector runif(int n) { controlVisibility(); double[] result = new double[n]; for (int i = 0; i < n; i++) { @@ -55,7 +55,7 @@ public abstract class Runif extends RBuiltinNode { } @Specialization - public RDoubleVector runif(double d) { + protected RDoubleVector runif(double d) { controlVisibility(); return runif((int) d); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Sd.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Sd.java index fc78ff686ff8036da096eeb78d96eff5bd555557..544e53f342222eb526f391aea2768dd9eb78e4e3 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Sd.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Sd.java @@ -52,7 +52,7 @@ public abstract class Sd extends RBuiltinNode { @Specialization @SuppressWarnings("unused") - public double sd(VirtualFrame frame, RDoubleVector x, byte narm) { + protected double sd(VirtualFrame frame, RDoubleVector x, byte narm) { controlVisibility(); double xmean = (double) mean.executeDouble(frame, x); double distSum = 0.0; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RProxyNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RProxyNode.java index c4bcc268d65c69efded0cc3251bc1fd35c4e6542..e984652a35f7f5791dcb794dc8a6b3c484baf543 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RProxyNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RProxyNode.java @@ -46,7 +46,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RNull wrap(RNull x) { + protected RNull wrap(RNull x) { return proxy(x); } @@ -55,7 +55,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public byte wrap(byte x) { + protected byte wrap(byte x) { return proxy(x); } @@ -64,7 +64,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public int wrap(int x) { + protected int wrap(int x) { return proxy(x); } @@ -73,7 +73,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public double wrap(double x) { + protected double wrap(double x) { return proxy(x); } @@ -82,7 +82,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RRaw wrap(RRaw x) { + protected RRaw wrap(RRaw x) { return proxy(x); } @@ -91,7 +91,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RComplex wrap(RComplex x) { + protected RComplex wrap(RComplex x) { return proxy(x); } @@ -100,7 +100,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public String wrap(String x) { + protected String wrap(String x) { return proxy(x); } @@ -109,7 +109,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RFunction wrap(RFunction x) { + protected RFunction wrap(RFunction x) { return proxy(x); } @@ -118,7 +118,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RIntSequence wrap(RIntSequence x) { + protected RIntSequence wrap(RIntSequence x) { return proxy(x); } @@ -127,7 +127,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RDoubleSequence wrap(RDoubleSequence x) { + protected RDoubleSequence wrap(RDoubleSequence x) { return x; } @@ -136,7 +136,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RLogicalVector wrap(RLogicalVector x) { + protected RLogicalVector wrap(RLogicalVector x) { return proxy(x); } @@ -145,7 +145,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RIntVector wrap(RIntVector x) { + protected RIntVector wrap(RIntVector x) { return proxy(x); } @@ -154,7 +154,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RDoubleVector wrap(RDoubleVector x) { + protected RDoubleVector wrap(RDoubleVector x) { return proxy(x); } @@ -163,7 +163,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RRawVector wrap(RRawVector x) { + protected RRawVector wrap(RRawVector x) { return proxy(x); } @@ -172,7 +172,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RComplexVector wrap(RComplexVector x) { + protected RComplexVector wrap(RComplexVector x) { return proxy(x); } @@ -181,7 +181,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RStringVector wrap(RStringVector x) { + protected RStringVector wrap(RStringVector x) { return proxy(x); } @@ -190,7 +190,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RList wrap(RList x) { + protected RList wrap(RList x) { return proxy(x); } @@ -199,7 +199,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RDataFrame wrap(RDataFrame x) { + protected RDataFrame wrap(RDataFrame x) { return proxy(x); } @@ -208,7 +208,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RMissing wrap(RMissing x) { + protected RMissing wrap(RMissing x) { return proxy(x); } @@ -217,7 +217,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public REnvironment wrap(REnvironment x) { + protected REnvironment wrap(REnvironment x) { return proxy(x); } @@ -226,7 +226,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RConnection wrap(RConnection x) { + protected RConnection wrap(RConnection x) { return proxy(x); } @@ -235,7 +235,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RExpression wrap(RExpression x) { + protected RExpression wrap(RExpression x) { return proxy(x); } @@ -244,7 +244,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RSymbol wrap(RSymbol x) { + protected RSymbol wrap(RSymbol x) { return proxy(x); } @@ -253,7 +253,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RLanguage wrap(RLanguage x) { + protected RLanguage wrap(RLanguage x) { return proxy(x); } @@ -262,7 +262,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RPromise wrap(RPromise x) { + protected RPromise wrap(RPromise x) { return proxy(x); } @@ -271,7 +271,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RPairList wrap(RPairList x) { + protected RPairList wrap(RPairList x) { return proxy(x); } @@ -280,7 +280,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public Object[] wrap(Object[] x) { + protected Object[] wrap(Object[] x) { return proxy(x); } @@ -289,7 +289,7 @@ public abstract class RProxyNode extends RNode { } @Specialization - public RFormula wrap(RFormula x) { + protected RFormula wrap(RFormula x) { return proxy(x); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java index 114d3bf061e3fc639a4dc3a11e24b33c91c5886b..7fc287c813e647ba0e5c54138f1f1c4632e569e4 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RRootNode.java @@ -75,5 +75,4 @@ public abstract class RRootNode extends RootNode { public boolean isSplittable() { return true; } - } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java index 2947c3d48c49a55edbcf5a3dedfdf6d07b125bdb..5deb320e667b5d8efa88a952b5459ce93abfeb1a 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java @@ -76,15 +76,15 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { case DOUBLE: return ConstantNode.create(src, RRuntime.string2double(c.getValues()[0])); case BOOL: - String value = c.getValues()[0]; - if (value.equals("NA")) { - return ConstantNode.create(src, RRuntime.LOGICAL_NA); - } else if (value.equals("1")) { - return ConstantNode.create(src, true); - } else if (value.equals("0")) { - return ConstantNode.create(src, false); - } else { - throw new AssertionError(); + switch (c.getValues()[0]) { + case "NA": + return ConstantNode.create(src, RRuntime.LOGICAL_NA); + case "1": + return ConstantNode.create(src, true); + case "0": + return ConstantNode.create(src, false); + default: + throw new AssertionError(); } case STRING: return ConstantNode.create(src, c.getValues()[0]); @@ -107,9 +107,9 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { SourceSection callSource = call.getSource(); int index = 0; - String[] argumentNames = new String[call.getArgs().size()]; - RNode[] nodes = new RNode[call.getArgs().size()]; - for (ArgNode e : call.getArgs()) { + String[] argumentNames = new String[call.getArguments().size()]; + RNode[] nodes = new RNode[call.getArguments().size()]; + for (ArgNode e : call.getArguments()) { Symbol argName = e.getName(); argumentNames[index] = (argName == null ? null : RRuntime.toString(argName)); ASTNode val = e.getValue(); @@ -225,7 +225,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { @Override public RNode visit(Sequence seq) { - ASTNode[] exprs = seq.getExprs(); + ASTNode[] exprs = seq.getExpressions(); RNode[] rexprs = new RNode[exprs.length]; for (int i = 0; i < exprs.length; i++) { rexprs[i] = exprs[i].accept(this); @@ -290,7 +290,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { public RNode visit(AccessVector a) { RNode vector = a.getVector().accept(this); RNode dropDim = ConstantNode.create(true); - List<ArgNode> args = a.getArgs(); + List<ArgNode> args = a.getArguments(); int argLength = args.size(); if (argLength > 0) { for (ArgNode e : args) { @@ -399,13 +399,13 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { } private RNode createVectorUpdate(AccessVector a, RNode rhs, boolean isSuper, SourceSection source, boolean recursive) { - int argLength = a.getArgs().size(); + int argLength = a.getArguments().size(); if (!recursive) { argLength--; // last argument == RHS } if (a.getVector() instanceof SimpleAccessVariable) { SimpleAccessVariable varAST = (SimpleAccessVariable) a.getVector(); - String vSymbol = RRuntime.toString(varAST.getSymbol()); + String vSymbol = RRuntime.toString(varAST.getVariable()); RNode[] seq = createReplacementSequence(); ReadVariableNode v = isSuper ? ReadVariableSuperMaterializedNode.create(varAST.getSource(), vSymbol, RRuntime.TYPE_ANY) : ReadVariableNode.create(varAST.getSource(), vSymbol, @@ -415,7 +415,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { RNode rhsAccess = ReadVariableNode.create(null, rhsSymbolString, RRuntime.TYPE_ANY, false); RNode tmpVarAccess = ReadVariableNode.create(null, varSymbol, RRuntime.TYPE_ANY, false); - RNode positions = createPositions(a.getArgs(), argLength, a.isSubset(), true); + RNode positions = createPositions(a.getArguments(), argLength, a.isSubset(), true); CoerceVector coerceVector = CoerceVectorFactory.create(null, null, null); UpdateArrayHelperNode updateOp = UpdateArrayHelperNodeFactory.create(a.isSubset(), tmpVarAccess, rhsAccess, ConstantNode.create(0), (PositionsArrayNodeValue) positions, coerceVector); RNode assignFromTemp = WriteVariableNode.create(vSymbol, updateOp, false, isSuper, WriteVariableNode.Mode.TEMP); @@ -427,7 +427,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { AccessVector vecAST = (AccessVector) a.getVector(); SimpleAccessVariable varAST = getVectorVariable(vecAST); - String vSymbol = RRuntime.toString(varAST.getSymbol()); + String vSymbol = RRuntime.toString(varAST.getVariable()); RNode[] seq = new RNode[3]; ReadVariableNode v = isSuper ? ReadVariableSuperMaterializedNode.create(varAST.getSource(), vSymbol, RRuntime.TYPE_ANY) : ReadVariableNode.create(varAST.getSource(), vSymbol, @@ -436,7 +436,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { RNode rhsAccess = AccessVariable.create(null, rhsSymbol).accept(this); - RNode positions = createPositions(a.getArgs(), argLength, a.isSubset(), true); + RNode positions = createPositions(a.getArguments(), argLength, a.isSubset(), true); CoerceVector coerceVector = CoerceVectorFactory.create(null, null, null); UpdateArrayHelperNode updateOp = UpdateArrayHelperNodeFactory.create(a.isSubset(), vecAST.accept(this), rhsAccess, ConstantNode.create(0), (PositionsArrayNodeValue) positions, coerceVector); @@ -445,7 +445,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { FieldAccess accessAST = (FieldAccess) a.getVector(); SimpleAccessVariable varAST = getFieldAccessVariable(accessAST); - String vSymbol = RRuntime.toString(varAST.getSymbol()); + String vSymbol = RRuntime.toString(varAST.getVariable()); RNode[] seq = createReplacementSequence(); ReadVariableNode v = isSuper ? ReadVariableSuperMaterializedNode.create(varAST.getSource(), vSymbol, RRuntime.TYPE_ANY) : ReadVariableNode.create(varAST.getSource(), vSymbol, RRuntime.TYPE_ANY, varAST.shouldCopyValue()); @@ -458,7 +458,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { return constructReplacementSuffix(seq, assignFromTemp, rhsSymbol, source); } else if (a.getVector() instanceof FunctionCall) { FunctionCall callAST = (FunctionCall) a.getVector(); - RNode positions = createPositions(a.getArgs(), argLength, a.isSubset(), true); + RNode positions = createPositions(a.getArguments(), argLength, a.isSubset(), true); CoerceVector coerceVector = CoerceVectorFactory.create(null, null, null); return UpdateArrayHelperNodeFactory.create(a.isSubset(), callAST.accept(this), rhs, ConstantNode.create(0), (PositionsArrayNodeValue) positions, coerceVector); } else { @@ -483,7 +483,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { @Override public RNode visit(SimpleAssignVariable n) { RNode expression = n.getExpr().accept(this); - return WriteVariableNode.create(n.getSource(), n.getSymbol(), expression, false, n.isSuper()); + return WriteVariableNode.create(n.getSource(), n.getVariable(), expression, false, n.isSuper()); } private RCallNode prepareReplacementCall(FunctionCall f, List<ArgNode> args, final Object rhsSymbol, boolean simpleReplacement) { @@ -523,12 +523,12 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { // preparations ASTNode rhsAst = replacement.getExpr(); RNode rhs = rhsAst.accept(this); - FunctionCall f = replacement.getBuiltin(); - List<ArgNode> args = f.getArgs(); + FunctionCall f = replacement.getReplacementFunctionCall(); + List<ArgNode> args = f.getArguments(); ASTNode val = args.get(0).getValue(); if (val instanceof SimpleAccessVariable) { SimpleAccessVariable callArg = (SimpleAccessVariable) val; - String vSymbol = RRuntime.toString(callArg.getSymbol()); + String vSymbol = RRuntime.toString(callArg.getVariable()); RNode[] seq = createReplacementSequence(); ReadVariableNode replacementCallArg = createReplacementForVariableUsing(callArg, vSymbol, replacement); final Object rhsSymbol = constructReplacementPrefix(seq, rhs, replacementCallArg, WriteVariableNode.Mode.COPY); @@ -542,7 +542,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { final Object rhsSymbol = constructReplacementPrefix(seq, rhs, replacementArg, WriteVariableNode.Mode.COPY); RNode replacementCall = prepareReplacementCall(f, args, rhsSymbol, false); // see AssignVariable.writeVector (number of args must match) - callArgAst.getArgs().add(ArgNode.create(rhsAst.getSource(), "value", rhsAst)); + callArgAst.getArguments().add(ArgNode.create(rhsAst.getSource(), "value", rhsAst)); RNode assignFromTemp = createVectorUpdate(callArgAst, replacementCall, replacement.isSuper(), replacement.getSource(), false); return constructReplacementSuffix(seq, assignFromTemp, rhsSymbol, replacement.getSource()); } else { @@ -568,7 +568,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { @Override public RNode visit(SimpleAccessVariable n) { - String symbol = RRuntime.toString(n.getSymbol()); + String symbol = RRuntime.toString(n.getVariable()); return ReadVariableNode.create(n.getSource(), symbol, RRuntime.TYPE_ANY, n.shouldCopyValue()); } @@ -580,7 +580,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { @Override public RNode visit(If n) { - RNode condition = n.getCond().accept(this); + RNode condition = n.getCondition().accept(this); RNode thenPart = n.getTrueCase().accept(this); RNode elsePart = n.getFalseCase() != null ? n.getFalseCase().accept(this) : null; return IfNode.create(n.getSource(), condition, thenPart, elsePart); @@ -588,7 +588,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { @Override public RNode visit(While loop) { - RNode condition = loop.getCond().accept(this); + RNode condition = loop.getCondition().accept(this); RNode body = loop.getBody().accept(this); return WhileNode.create(loop.getSource(), condition, body); } @@ -611,7 +611,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { @Override public RNode visit(For loop) { - WriteVariableNode cvar = WriteVariableNode.create(loop.getCVar(), null, false, false); + WriteVariableNode cvar = WriteVariableNode.create(loop.getVariable(), null, false, false); RNode range = loop.getRange().accept(this); RNode body = loop.getBody().accept(this); return ForNode.create(cvar, range, body); @@ -631,7 +631,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { } else { Utils.nyi(); } - String vSymbol = RRuntime.toString(varAST.getSymbol()); + String vSymbol = RRuntime.toString(varAST.getVariable()); RNode[] seq = createReplacementSequence(); ReadVariableNode v = isSuper ? ReadVariableSuperMaterializedNode.create(varAST.getSource(), vSymbol, RRuntime.TYPE_ANY) : ReadVariableNode.create(varAST.getSource(), vSymbol, diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArrayNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArrayNode.java index e143e27e2f79a9bb6372464e30d39ea37811bddd..c5fc6b98343b046b774bf335faf4a9b08b040e00 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArrayNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessArrayNode.java @@ -56,7 +56,7 @@ public abstract class AccessArrayNode extends RNode { @Child private GetNamesNode getNamesNode; @Child private GetDimNamesNode getDimNamesNode; - abstract RNode getVector(); + protected abstract RNode getVector(); public abstract Object executeAccess(VirtualFrame frame, Object vector, int recLevel, Object operand, RAbstractLogicalVector dropDim); @@ -177,55 +177,55 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"inRecursion", "isFirstPositionPositive"}) - RNull accessNullInRecursionPosPositive(VirtualFrame frame, RNull vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { + protected RNull accessNullInRecursionPosPositive(VirtualFrame frame, RNull vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBSCRIPT_BOUNDS); } @SuppressWarnings("unused") @Specialization(guards = {"inRecursion", "!isFirstPositionPositive"}) - RNull accessNullInRecursion(VirtualFrame frame, RNull vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { + protected RNull accessNullInRecursion(VirtualFrame frame, RNull vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @SuppressWarnings("unused") @Specialization - RNull access(RNull vector, int recLevel, Object positions, RAbstractLogicalVector dropDim) { + protected RNull access(RNull vector, int recLevel, Object positions, RAbstractLogicalVector dropDim) { return RNull.instance; } @SuppressWarnings("unused") @Specialization(guards = {"inRecursion", "isFirstPositionOne"}) - RNull accessFunctionInRecursionPosOne(VirtualFrame frame, RFunction vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { + protected RNull accessFunctionInRecursionPosOne(VirtualFrame frame, RFunction vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_LENGTH, "closure", 1); } @SuppressWarnings("unused") @Specialization(guards = {"inRecursion", "isFirstPositionPositive", "!isFirstPositionOne"}) - RNull accessFunctionInRecursionPosPositive(VirtualFrame frame, RFunction vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { + protected RNull accessFunctionInRecursionPosPositive(VirtualFrame frame, RFunction vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBSCRIPT_BOUNDS); } @SuppressWarnings("unused") @Specialization(guards = {"inRecursion", "!isFirstPositionPositive"}) - RNull accessFunctionInRecursion(VirtualFrame frame, RFunction vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { + protected RNull accessFunctionInRecursion(VirtualFrame frame, RFunction vector, int recLevel, RAbstractIntVector positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @SuppressWarnings("unused") @Specialization(guards = "inRecursion") - RNull accessFunctionInRecursionString(VirtualFrame frame, RFunction vector, int recLevel, RAbstractStringVector positions, RAbstractLogicalVector dropDim) { + protected RNull accessFunctionInRecursionString(VirtualFrame frame, RFunction vector, int recLevel, RAbstractStringVector positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBSCRIPT_BOUNDS); } @SuppressWarnings("unused") @Specialization - RNull accessFunction(VirtualFrame frame, RFunction vector, int recLevel, Object position, RAbstractLogicalVector dropDim) { + protected RNull accessFunction(VirtualFrame frame, RFunction vector, int recLevel, Object position, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.OBJECT_NOT_SUBSETTABLE, "closure"); } @SuppressWarnings("unused") @Specialization - RNull access(RAbstractContainer container, int recLevel, RNull positions, RAbstractLogicalVector dropDim) { + protected RNull access(RAbstractContainer container, int recLevel, RNull positions, RAbstractLogicalVector dropDim) { // this is a special case (see ArrayPositionCast) - RNull can only appear to represent the // x[NA] case which has to return null and not a null vector return RNull.instance; @@ -233,7 +233,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - Object access(VirtualFrame frame, RAbstractContainer container, int recLevel, RMissing positions, RAbstractLogicalVector dropDim) { + protected Object access(VirtualFrame frame, RAbstractContainer container, int recLevel, RMissing positions, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "symbol"); } else { @@ -243,13 +243,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = "wrongDimensions") - Object access(VirtualFrame frame, RAbstractContainer container, int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected Object access(VirtualFrame frame, RAbstractContainer container, int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INCORRECT_DIMENSIONS); } @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "!isSubset"}) - RIntVector accessNA(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RIntVector accessNA(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBSCRIPT_BOUNDS); } @@ -332,7 +332,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - RList access(VirtualFrame frame, RList vector, int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected RList access(VirtualFrame frame, RList vector, int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { // compute length of dimensions array and of the resulting vector DimsAndResultLength res = getDimsAndResultLength(positions, dropDim.getLength() == 0 ? RRuntime.TRUE : dropDim.getDataAt(0)); int[] dimensions = res.dimensions; @@ -380,7 +380,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = "isSubset") - RList accessSubset(RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected RList accessSubset(RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int resLength = p.getLength(); Object[] data = new Object[resLength]; elementNACheck.enable(!vector.isComplete() || !p.isComplete()); @@ -413,12 +413,12 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = "!hasNames") - RList accessStringNoNames(VirtualFrame frame, RList vector, int recLevel, RStringVector p, RAbstractLogicalVector dropDim) { + protected RList accessStringNoNames(VirtualFrame frame, RList vector, int recLevel, RStringVector p, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NO_SUCH_INDEX, 1); } @Specialization(guards = {"hasNames", "!isSubset", "twoPosition"}) - Object accessStringTwoPosRec(VirtualFrame frame, RList vector, int recLevel, RStringVector p, RAbstractLogicalVector dropDim) { + protected Object accessStringTwoPosRec(VirtualFrame frame, RList vector, int recLevel, RStringVector p, RAbstractLogicalVector dropDim) { int position = getPositionInRecursion(frame, vector, p.getDataAt(0), recLevel, getEncapsulatingSourceSection()); Object newVector = castVector(frame, vector.getDataAt(position - 1)); Object newPosition = castPosition(frame, newVector, convertOperand(frame, newVector, p.getDataAt(1))); @@ -426,7 +426,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization(guards = {"hasNames", "!isSubset", "!twoPosition"}) - Object accessString(VirtualFrame frame, RList vector, int recLevel, RStringVector p, RAbstractLogicalVector dropDim) { + protected Object accessString(VirtualFrame frame, RList vector, int recLevel, RStringVector p, RAbstractLogicalVector dropDim) { int position = getPositionInRecursion(frame, vector, p.getDataAt(0), recLevel, getEncapsulatingSourceSection()); RStringVector newP = popHead(p, posNACheck); return accessRecursive(frame, vector.getDataAt(position - 1), newP, recLevel + 1, dropDim); @@ -434,7 +434,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isSubset", "onePosition", "!inRecursion"}) - Object accessOnePos(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected Object accessOnePos(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int position = p.getDataAt(0); if (RRuntime.isNA(position)) { return RNull.instance; @@ -448,7 +448,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isSubset", "noPosition"}) - Object accessNoPos(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected Object accessNoPos(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -479,14 +479,14 @@ public abstract class AccessArrayNode extends RNode { } @Specialization(guards = {"!isSubset", "onePosition", "inRecursion"}) - Object accessSubscript(VirtualFrame frame, RList vector, int recLevel, RIntVector p, @SuppressWarnings("unused") RAbstractLogicalVector dropDim) { + protected Object accessSubscript(VirtualFrame frame, RList vector, int recLevel, RIntVector p, @SuppressWarnings("unused") RAbstractLogicalVector dropDim) { int position = p.getDataAt(0); position = getPositionInRecursion(frame, vector, position, recLevel); return vector.getDataAt(position - 1); } @Specialization(guards = {"!isSubset", "twoPosition"}) - Object accessTwoPosRec(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected Object accessTwoPosRec(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int position = p.getDataAt(0); position = getPositionInRecursion(frame, vector, position, recLevel); Object newVector = castVector(frame, vector.getDataAt(position - 1)); @@ -495,7 +495,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization(guards = {"!isSubset", "multiPos"}) - Object access(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected Object access(VirtualFrame frame, RList vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int position = p.getDataAt(0); position = getPositionInRecursion(frame, vector, position, recLevel); RIntVector newP = popHead(p, posNACheck); @@ -504,7 +504,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "isSubset"}) - RList accessNA(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RList accessNA(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (vector.getNames() == RNull.instance) { return RDataFactory.createList(new Object[]{RNull.instance}); } else { @@ -515,56 +515,56 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionNA", "isPositionNegative", "!outOfBoundsNegative"}) - RList accessNegativeInBounds(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RList accessNegativeInBounds(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @SuppressWarnings("unused") @Specialization(guards = {"!isPositionNA", "isPositionNegative", "outOfBoundsNegative", "oneElemVector"}) - RList accessNegativeOutOfBoundsOneElemVector(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RList accessNegativeOutOfBoundsOneElemVector(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @SuppressWarnings("unused") @Specialization(guards = {"!isPositionNA", "isPositionNegative", "outOfBoundsNegative", "!oneElemVector"}) - RList accessNegativeOutOfBounds(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RList accessNegativeOutOfBounds(VirtualFrame frame, RAbstractContainer container, int recLevel, int position, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RList accessNamesSubset(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RList accessNamesSubset(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { Object val = vector.getDataAt(position - 1); return RDataFactory.createList(new Object[]{val}, getName(vector, position)); } @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "!isSubset", "!isPositionNA", "!isPositionNegative", "!outOfBounds"}) - Object accessNames(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected Object accessNames(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RList accessSubset(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RList accessSubset(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return RDataFactory.createList(new Object[]{vector.getDataAt(position - 1)}); } @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!hasNames", "!isSubset", "!isPositionNA", "!isPositionNegative", "!outOfBounds"}) - Object access(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected Object access(RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = {"!isSubset", "outOfBounds"}) - Object accessOutOfBounds(VirtualFrame frame, RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected Object accessOutOfBounds(VirtualFrame frame, RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBSCRIPT_BOUNDS); } @SuppressWarnings("unused") @Specialization(guards = "isPositionZero") - RList accessPosZero(VirtualFrame frame, RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RList accessPosZero(VirtualFrame frame, RList vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -577,18 +577,18 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isSubset", "inRecursion", "multiPos", "!isVectorList"}) - Object accessRecFailedRec(VirtualFrame frame, RAbstractContainer container, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected Object accessRecFailedRec(VirtualFrame frame, RAbstractContainer container, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.RECURSIVE_INDEXING_FAILED, recLevel + 1); } @SuppressWarnings("unused") @Specialization(guards = {"!isSubset", "!inRecursion", "multiPos", "!isVectorList"}) - Object accessRecFailed(VirtualFrame frame, RAbstractContainer container, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected Object accessRecFailed(VirtualFrame frame, RAbstractContainer container, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization - RIntVector access(VirtualFrame frame, RAbstractIntVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected RIntVector access(VirtualFrame frame, RAbstractIntVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { // compute length of dimensions array and of the resulting vector DimsAndResultLength res = getDimsAndResultLength(positions, dropDim.getLength() == 0 ? RRuntime.TRUE : dropDim.getDataAt(0)); int[] dimensions = res.dimensions; @@ -636,7 +636,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - RIntVector access(RAbstractIntVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected RIntVector access(RAbstractIntVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int resLength = p.getLength(); int[] data = new int[resLength]; elementNACheck.enable(!vector.isComplete() || !p.isComplete()); @@ -655,7 +655,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "isSubset"}) - RIntVector accessNA(RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RIntVector accessNA(RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (vector.getNames() == RNull.instance) { return RDataFactory.createIntVector(new int[]{RRuntime.INT_NA}, RDataFactory.INCOMPLETE_VECTOR); } else { @@ -666,7 +666,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RIntVector accessNames(RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RIntVector accessNames(RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { int val = vector.getDataAt(position - 1); elementNACheck.check(val); return RDataFactory.createIntVector(new int[]{val}, elementNACheck.neverSeenNA(), getName(vector, position)); @@ -674,13 +674,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!isPositionNA", "!isPositionNegative"}) - int access(RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected int access(RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = "isPositionZero") - RIntVector accessPosZero(VirtualFrame frame, RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RIntVector accessPosZero(VirtualFrame frame, RAbstractIntVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -692,7 +692,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RDoubleVector access(VirtualFrame frame, RAbstractDoubleVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected RDoubleVector access(VirtualFrame frame, RAbstractDoubleVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { // compute length of dimensions array and of the resulting vector DimsAndResultLength res = getDimsAndResultLength(positions, dropDim.getLength() == 0 ? RRuntime.TRUE : dropDim.getDataAt(0)); int[] dimensions = res.dimensions; @@ -740,7 +740,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - RDoubleVector access(RAbstractDoubleVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected RDoubleVector access(RAbstractDoubleVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int resLength = p.getLength(); double[] data = new double[resLength]; elementNACheck.enable(!vector.isComplete() || !p.isComplete()); @@ -759,7 +759,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "isSubset"}) - RDoubleVector accessNA(RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RDoubleVector accessNA(RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (vector.getNames() == RNull.instance) { return RDataFactory.createDoubleVector(new double[]{RRuntime.DOUBLE_NA}, RDataFactory.INCOMPLETE_VECTOR); } else { @@ -770,7 +770,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RDoubleVector accessNames(RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RDoubleVector accessNames(RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { double val = vector.getDataAt(position - 1); elementNACheck.check(val); return RDataFactory.createDoubleVector(new double[]{val}, elementNACheck.neverSeenNA(), getName(vector, position)); @@ -778,13 +778,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!isPositionNA", "!isPositionNegative"}) - double access(RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected double access(RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = "isPositionZero") - RDoubleVector accessPosZero(VirtualFrame frame, RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RDoubleVector accessPosZero(VirtualFrame frame, RAbstractDoubleVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -796,7 +796,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RLogicalVector access(VirtualFrame frame, RLogicalVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected RLogicalVector access(VirtualFrame frame, RLogicalVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { // compute length of dimensions array and of the resulting vector DimsAndResultLength res = getDimsAndResultLength(positions, dropDim.getLength() == 0 ? RRuntime.TRUE : dropDim.getDataAt(0)); int[] dimensions = res.dimensions; @@ -844,7 +844,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - RLogicalVector access(RLogicalVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected RLogicalVector access(RLogicalVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int resLength = p.getLength(); byte[] data = new byte[resLength]; elementNACheck.enable(!vector.isComplete() || !p.isComplete()); @@ -863,7 +863,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "isSubset"}) - RLogicalVector accessNA(RLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RLogicalVector accessNA(RLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (vector.getNames() == RNull.instance) { return RDataFactory.createLogicalVector(new byte[]{RRuntime.LOGICAL_NA}, RDataFactory.INCOMPLETE_VECTOR); } else { @@ -874,7 +874,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RLogicalVector accessNames(RAbstractLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RLogicalVector accessNames(RAbstractLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { byte val = vector.getDataAt(position - 1); elementNACheck.check(val); return RDataFactory.createLogicalVector(new byte[]{val}, elementNACheck.neverSeenNA(), getName(vector, position)); @@ -882,13 +882,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!isPositionNA", "!isPositionNegative"}) - byte access(RLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected byte access(RLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = "isPositionZero") - RLogicalVector accessPosZero(VirtualFrame frame, RLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RLogicalVector accessPosZero(VirtualFrame frame, RLogicalVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -900,7 +900,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RStringVector access(VirtualFrame frame, RStringVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected RStringVector access(VirtualFrame frame, RStringVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { // compute length of dimensions array and of the resulting vector DimsAndResultLength res = getDimsAndResultLength(positions, dropDim.getLength() == 0 ? RRuntime.TRUE : dropDim.getDataAt(0)); int[] dimensions = res.dimensions; @@ -948,7 +948,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - RStringVector access(RStringVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected RStringVector access(RStringVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int resLength = p.getLength(); String[] data = new String[resLength]; elementNACheck.enable(!vector.isComplete() || !p.isComplete()); @@ -967,7 +967,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "isSubset"}) - RStringVector accessNA(RStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RStringVector accessNA(RStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (vector.getNames() == RNull.instance) { return RDataFactory.createStringVector(new String[]{RRuntime.STRING_NA}, RDataFactory.INCOMPLETE_VECTOR); } else { @@ -978,7 +978,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RStringVector accessNames(RAbstractStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RStringVector accessNames(RAbstractStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { String val = vector.getDataAt(position - 1); elementNACheck.check(val); return RDataFactory.createStringVector(new String[]{val}, elementNACheck.neverSeenNA(), getName(vector, position)); @@ -986,13 +986,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!isPositionNA", "!isPositionNegative"}) - String access(RStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected String access(RStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = "isPositionZero") - RStringVector accessPosZero(VirtualFrame frame, RStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RStringVector accessPosZero(VirtualFrame frame, RStringVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -1004,7 +1004,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RComplexVector access(VirtualFrame frame, RComplexVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected RComplexVector access(VirtualFrame frame, RComplexVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { // compute length of dimensions array and of the resulting vector DimsAndResultLength res = getDimsAndResultLength(positions, dropDim.getLength() == 0 ? RRuntime.TRUE : dropDim.getDataAt(0)); int[] dimensions = res.dimensions; @@ -1052,7 +1052,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - RComplexVector access(RComplexVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected RComplexVector access(RComplexVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int resLength = p.getLength(); double[] data = new double[resLength << 1]; elementNACheck.enable(!vector.isComplete() || !p.isComplete()); @@ -1075,7 +1075,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "isSubset"}) - RComplexVector accessNA(RComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RComplexVector accessNA(RComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (vector.getNames() == RNull.instance) { return RDataFactory.createComplexVector(new double[]{RRuntime.COMPLEX_NA_REAL_PART, RRuntime.COMPLEX_NA_IMAGINARY_PART}, RDataFactory.INCOMPLETE_VECTOR); } else { @@ -1086,7 +1086,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RComplexVector accessNames(RAbstractComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RComplexVector accessNames(RAbstractComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { RComplex val = vector.getDataAt(position - 1); elementNACheck.check(val); return RDataFactory.createComplexVector(new double[]{val.getRealPart(), val.getImaginaryPart()}, elementNACheck.neverSeenNA(), getName(vector, position)); @@ -1094,13 +1094,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!isPositionNA", "!isPositionNegative"}) - RComplex access(RComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RComplex access(RComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = "isPositionZero") - RComplexVector accessPosZero(VirtualFrame frame, RComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RComplexVector accessPosZero(VirtualFrame frame, RComplexVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -1112,7 +1112,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RRawVector access(VirtualFrame frame, RRawVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { + protected RRawVector access(VirtualFrame frame, RRawVector vector, @SuppressWarnings("unused") int recLevel, Object[] positions, RAbstractLogicalVector dropDim) { // compute length of dimensions array and of the resulting vector DimsAndResultLength res = getDimsAndResultLength(positions, dropDim.getLength() == 0 ? RRuntime.TRUE : dropDim.getDataAt(0)); int[] dimensions = res.dimensions; @@ -1160,7 +1160,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - RRawVector access(RRawVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { + protected RRawVector access(RRawVector vector, int recLevel, RIntVector p, RAbstractLogicalVector dropDim) { int resLength = p.getLength(); byte[] data = new byte[resLength]; elementNACheck.enable(!vector.isComplete() || !p.isComplete()); @@ -1179,7 +1179,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"isPositionNA", "isSubset"}) - RRawVector accessNA(RRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RRawVector accessNA(RRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (vector.getNames() == RNull.instance) { return RDataFactory.createRawVector(new byte[]{0}); } else { @@ -1190,20 +1190,20 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "hasNames", "isSubset", "!isPositionNA", "!isPositionNegative"}) - RRawVector accessNames(RAbstractRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RRawVector accessNames(RAbstractRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { RRaw val = vector.getDataAt(position - 1); return RDataFactory.createRawVector(new byte[]{val.getValue()}, getName(vector, position)); } @SuppressWarnings("unused") @Specialization(guards = {"!isPositionZero", "!isPositionNA", "!isPositionNegative"}) - RRaw access(RRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RRaw access(RRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { return vector.getDataAt(position - 1); } @SuppressWarnings("unused") @Specialization(guards = "isPositionZero") - RRawVector accessPosZero(VirtualFrame frame, RRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected RRawVector accessPosZero(VirtualFrame frame, RRawVector vector, int recLevel, int position, RAbstractLogicalVector dropDim) { if (!isSubset) { RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @@ -1216,7 +1216,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = "noPosition") - Object accessListEmptyPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RList positions, RAbstractLogicalVector dropDim) { + protected Object accessListEmptyPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RList positions, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -1226,19 +1226,19 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = "onePosition") - Object accessListOnePos(VirtualFrame frame, RAbstractContainer container, int recLevel, RList positions, RAbstractLogicalVector dropDim) { + protected Object accessListOnePos(VirtualFrame frame, RAbstractContainer container, int recLevel, RList positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @SuppressWarnings("unused") @Specialization(guards = "multiPos") - Object accessListMultiPosList(VirtualFrame frame, RList vector, int recLevel, RList positions, RAbstractLogicalVector dropDim) { + protected Object accessListMultiPosList(VirtualFrame frame, RList vector, int recLevel, RList positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @SuppressWarnings("unused") @Specialization(guards = {"multiPos", "!isVectorList"}) - Object accessListMultiPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RList positions, RAbstractLogicalVector dropDim) { + protected Object accessListMultiPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RList positions, RAbstractLogicalVector dropDim) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else { @@ -1248,36 +1248,36 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - Object accessListMultiPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RComplex positions, RAbstractLogicalVector dropDim) { + protected Object accessListMultiPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RComplex positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @SuppressWarnings("unused") @Specialization - Object accessListMultiPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RRaw positions, RAbstractLogicalVector dropDim) { + protected Object accessListMultiPos(VirtualFrame frame, RAbstractContainer container, int recLevel, RRaw positions, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } // this should really be implemented in R @Specialization(guards = "!isSubset") - Object access(VirtualFrame frame, RDataFrame dataFrame, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected Object access(VirtualFrame frame, RDataFrame dataFrame, int recLevel, int position, RAbstractLogicalVector dropDim) { return accessRecursive(frame, dataFrame.getVector(), position, recLevel, dropDim); } @SuppressWarnings("unused") @Specialization(guards = "isSubset") - Object accessSubset(VirtualFrame frame, RDataFrame dataFrame, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected Object accessSubset(VirtualFrame frame, RDataFrame dataFrame, int recLevel, int position, RAbstractLogicalVector dropDim) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.DATA_FRAMES_SUBSET_ACCESS); } @Specialization - Object access(VirtualFrame frame, RExpression expression, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected Object access(VirtualFrame frame, RExpression expression, int recLevel, int position, RAbstractLogicalVector dropDim) { return accessRecursive(frame, expression.getList(), position, recLevel, dropDim); } @SuppressWarnings("unused") @Specialization - Object access(RPairList pairlist, int recLevel, int position, RAbstractLogicalVector dropDim) { + protected Object access(RPairList pairlist, int recLevel, int position, RAbstractLogicalVector dropDim) { return pairlist.getDataAtAsObject(position - 1); } @@ -1422,12 +1422,12 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RStringVector getNames(VirtualFrame frame, RAbstractVector vector, Object[] positions, int currentDimLevel, byte allNull, RStringVector names) { + protected RStringVector getNames(VirtualFrame frame, RAbstractVector vector, Object[] positions, int currentDimLevel, byte allNull, RStringVector names) { return getNamesInternal(frame, vector, positions, currentDimLevel, allNull, names); } @Specialization - RStringVector getNamesNull(VirtualFrame frame, RAbstractVector vector, Object[] positions, int currentDimLevel, byte allNull, @SuppressWarnings("unused") RNull names) { + protected RStringVector getNamesNull(VirtualFrame frame, RAbstractVector vector, Object[] positions, int currentDimLevel, byte allNull, @SuppressWarnings("unused") RNull names) { return getNamesInternal(frame, vector, positions, currentDimLevel, allNull, null); } @@ -1494,7 +1494,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - Object getDimNames(VirtualFrame frame, RList dstDimNames, RAbstractVector vector, Object[] positions, int currentSrcDimLevel, int currentDstDimLevel) { + protected Object getDimNames(VirtualFrame frame, RList dstDimNames, RAbstractVector vector, Object[] positions, int currentSrcDimLevel, int currentDstDimLevel) { if (currentSrcDimLevel == 0) { return null; } @@ -1567,7 +1567,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RList getData(VirtualFrame frame, Object d, RList vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { + protected RList getData(VirtualFrame frame, Object d, RList vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { Object[] data = (Object[]) d; int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; @@ -1596,7 +1596,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RAbstractIntVector getData(VirtualFrame frame, Object d, RAbstractIntVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RAbstractIntVector getData(VirtualFrame frame, Object d, RAbstractIntVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] data = (int[]) d; int[] srcDimensions = vector.getDimensions(); @@ -1627,7 +1627,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RAbstractDoubleVector getData(VirtualFrame frame, Object d, RAbstractDoubleVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RAbstractDoubleVector getData(VirtualFrame frame, Object d, RAbstractDoubleVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { double[] data = (double[]) d; int[] srcDimensions = vector.getDimensions(); @@ -1658,7 +1658,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RAbstractLogicalVector getData(VirtualFrame frame, Object d, RAbstractLogicalVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RAbstractLogicalVector getData(VirtualFrame frame, Object d, RAbstractLogicalVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { byte[] data = (byte[]) d; int[] srcDimensions = vector.getDimensions(); @@ -1689,7 +1689,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RAbstractStringVector getData(VirtualFrame frame, Object d, RAbstractStringVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RAbstractStringVector getData(VirtualFrame frame, Object d, RAbstractStringVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { String[] data = (String[]) d; int[] srcDimensions = vector.getDimensions(); @@ -1720,7 +1720,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RAbstractComplexVector getData(VirtualFrame frame, Object d, RAbstractComplexVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RAbstractComplexVector getData(VirtualFrame frame, Object d, RAbstractComplexVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { double[] data = (double[]) d; int[] srcDimensions = vector.getDimensions(); @@ -1753,7 +1753,7 @@ public abstract class AccessArrayNode extends RNode { } @Specialization - RAbstractRawVector getData(VirtualFrame frame, Object d, RAbstractRawVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RAbstractRawVector getData(VirtualFrame frame, Object d, RAbstractRawVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { byte[] data = (byte[]) d; int[] srcDimensions = vector.getDimensions(); @@ -1828,12 +1828,12 @@ public abstract class AccessArrayNode extends RNode { } @Specialization(guards = {"!singleOpNegative", "!multiPos"}) - public RAbstractIntVector doIntVector(@SuppressWarnings("unused") Object vector, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVector(@SuppressWarnings("unused") Object vector, RAbstractIntVector positions) { return positions; } @Specialization(guards = {"!singleOpNegative", "multiPos"}) - public RAbstractIntVector doIntVectorMultiPos(VirtualFrame frame, @SuppressWarnings("unused") Object vector, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVectorMultiPos(VirtualFrame frame, @SuppressWarnings("unused") Object vector, RAbstractIntVector positions) { if (isSubset) { return positions; } else { @@ -1843,7 +1843,7 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"singleOpNA"}) - public RAbstractIntVector doIntVectorNA(VirtualFrame frame, Object vector, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVectorNA(VirtualFrame frame, Object vector, RAbstractIntVector positions) { if (isSubset) { return positions; } else { @@ -1853,13 +1853,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = {"singleOpNegative", "!singleOpNA"}) - public RAbstractIntVector doIntVectorNegative(VirtualFrame frame, Object vector, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVectorNegative(VirtualFrame frame, Object vector, RAbstractIntVector positions) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @SuppressWarnings("unused") @Specialization(guards = "noPosition") - Object accessListEmptyPos(VirtualFrame frame, RAbstractVector vector, RList positions) { + protected Object accessListEmptyPos(VirtualFrame frame, RAbstractVector vector, RList positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -1869,13 +1869,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization(guards = "onePosition") - Object accessListOnePos(VirtualFrame frame, RAbstractVector vector, RList positions) { + protected Object accessListOnePos(VirtualFrame frame, RAbstractVector vector, RList positions) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @SuppressWarnings("unused") @Specialization(guards = "multiPos") - Object accessListMultiPos(VirtualFrame frame, RAbstractVector vector, RList positions) { + protected Object accessListMultiPos(VirtualFrame frame, RAbstractVector vector, RList positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else { @@ -1885,13 +1885,13 @@ public abstract class AccessArrayNode extends RNode { @SuppressWarnings("unused") @Specialization - Object accessListOnePos(VirtualFrame frame, RAbstractVector vector, RComplex positions) { + protected Object accessListOnePos(VirtualFrame frame, RAbstractVector vector, RComplex positions) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @SuppressWarnings("unused") @Specialization - Object accessListOnePos(VirtualFrame frame, RAbstractVector vector, RRaw positions) { + protected Object accessListOnePos(VirtualFrame frame, RAbstractVector vector, RRaw positions) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessEnclosingFrameNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessEnclosingFrameNode.java index 4df68de46835fb576d747e4e3bc4b354f292638f..7e3e75cb1c20066b91691bafec6c7e166c386b97 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessEnclosingFrameNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessEnclosingFrameNode.java @@ -35,7 +35,7 @@ public abstract class AccessEnclosingFrameNode extends RNode { @Specialization @ExplodeLoop - public MaterializedFrame doMaterializedFrame(VirtualFrame frame, int level) { + protected MaterializedFrame doMaterializedFrame(VirtualFrame frame, int level) { MaterializedFrame enclosingFrame = RArguments.getFunction(frame).getEnclosingFrame(); for (int i = 1; i < level; i++) { enclosingFrame = RArguments.getFunction(enclosingFrame).getEnclosingFrame(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessFieldNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessFieldNode.java index bab75c3a6be7943f1d2b499174ae20c242770116..16f27ec847b422f753bd5a548bf56f8c4584ed4a 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessFieldNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessFieldNode.java @@ -42,7 +42,7 @@ public abstract class AccessFieldNode extends RNode { private final BranchProfile inexactMatch = new BranchProfile(); @Specialization(guards = "hasNames") - public Object accessField(RList object) { + protected Object accessField(RList object) { int index = object.getElementIndexByName(getField()); if (index == -1) { inexactMatch.enter(); @@ -52,18 +52,18 @@ public abstract class AccessFieldNode extends RNode { } @Specialization(guards = "!hasNames") - public Object accessFieldNoNames(@SuppressWarnings("unused") RList object) { + protected Object accessFieldNoNames(@SuppressWarnings("unused") RList object) { return RNull.instance; } @Specialization - public Object accessField(REnvironment env) { + protected Object accessField(REnvironment env) { Object obj = env.get(getField()); return obj == null ? RNull.instance : obj; } @Specialization - public Object accessField(VirtualFrame frame, @SuppressWarnings("unused") RAbstractVector object) { + protected Object accessField(VirtualFrame frame, @SuppressWarnings("unused") RAbstractVector object) { throw RError.error(frame, RError.Message.DOLLAR_ATOMIC_VECTORS); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ArrayPositionCast.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ArrayPositionCast.java index 14dff6f49c53a688919768c12a8c58ba0fe1ba50..23e1f6952543179779b379e7eed8715968b494b8 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ArrayPositionCast.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ArrayPositionCast.java @@ -46,7 +46,7 @@ public abstract class ArrayPositionCast extends RNode { public abstract Object executeArg(VirtualFrame frame, Object op, Object vector, Object operand); - abstract RNode getVector(); + protected abstract RNode getVector(); private final int dimension; @@ -89,17 +89,17 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization - public RIntVector doMissingVector(Object op, RNull vector, RAbstractIntVector operand) { + protected RIntVector doMissingVector(Object op, RNull vector, RAbstractIntVector operand) { return operand.materialize(); } @Specialization - public Object doFuncOp(Object op, RFunction vector, Object operand) { + protected Object doFuncOp(Object op, RFunction vector, Object operand) { return operand; } @Specialization - public RIntVector doMissingVector(VirtualFrame frame, Object op, RAbstractContainer container, RMissing operand) { + protected RIntVector doMissingVector(VirtualFrame frame, Object op, RAbstractContainer container, RMissing operand) { verifyDimensions(frame, container, dimension, numDimensions, assignment, isSubset, getEncapsulatingSourceSection()); int[] data = new int[numDimensions == 1 ? container.getLength() : container.getDimensions()[dimension]]; for (int i = 0; i < data.length; i++) { @@ -110,66 +110,66 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization - public RNull doNullSubset(Object op, RAbstractContainer container, RNull operand) { + protected RNull doNullSubset(Object op, RAbstractContainer container, RNull operand) { // this is a special case - RNull can only appear to represent the x[[NA]] case which has to // return null and not a null vector return operand; } @Specialization - public RStringVector doStringVector(Object op, RList vector, RStringVector operand) { + protected RStringVector doStringVector(Object op, RList vector, RStringVector operand) { // recursive access to the list return operand; } @Specialization - public RList doList(Object op, RAbstractContainer container, RList operand) { + protected RList doList(Object op, RAbstractContainer container, RList operand) { return operand; } @Specialization - public RComplex doList(Object op, RAbstractContainer container, RComplex operand) { + protected RComplex doList(Object op, RAbstractContainer container, RComplex operand) { return operand; } @Specialization - public RRaw doList(Object op, RAbstractContainer container, RRaw operand) { + protected RRaw doList(Object op, RAbstractContainer container, RRaw operand) { return operand; } @Specialization(guards = {"sizeOneOp", "numDimensionsOne", "!operandHasNames"}) - public int doIntVectorSizeOne(Object op, RAbstractContainer container, RAbstractIntVector operand) { + protected int doIntVectorSizeOne(Object op, RAbstractContainer container, RAbstractIntVector operand) { int val = operand.getDataAt(0); return val; } @Specialization(guards = {"sizeOneOp", "numDimensionsOne", "operandHasNames"}) - public RIntVector doIntVectorSizeOneNames(Object op, RAbstractContainer container, RAbstractIntVector operand) { + protected RIntVector doIntVectorSizeOneNames(Object op, RAbstractContainer container, RAbstractIntVector operand) { assert operand.getDataAt(0) != 0; return operand.materialize(); } @Specialization(guards = {"sizeOneOp", "!numDimensionsOne"}) - public RIntVector doIntVectorSizeOneMultiDim(Object op, RAbstractContainer container, RAbstractIntVector operand) { + protected RIntVector doIntVectorSizeOneMultiDim(Object op, RAbstractContainer container, RAbstractIntVector operand) { return operand.materialize(); } @Specialization(guards = {"!emptyOperand", "!sizeOneOp", "!numDimensionsOne"}) - public RIntVector doIntVectorMultiDim(Object op, RAbstractContainer container, RAbstractIntVector operand) { + protected RIntVector doIntVectorMultiDim(Object op, RAbstractContainer container, RAbstractIntVector operand) { return operand.materialize(); } @Specialization(guards = {"!emptyOperand", "!sizeOneOp", "numDimensionsOne"}) - public RIntVector doIntVectorOneDim(Object op, RAbstractContainer container, RAbstractIntVector operand) { + protected RIntVector doIntVectorOneDim(Object op, RAbstractContainer container, RAbstractIntVector operand) { return operand.materialize(); } @Specialization(guards = "emptyOperand") - public int doIntVectorZero(Object op, RAbstractContainer container, RAbstractIntVector operand) { + protected int doIntVectorZero(Object op, RAbstractContainer container, RAbstractIntVector operand) { return 0; } - public static boolean sizeOneOp(Object op, RAbstractContainer container, RAbstractIntVector operand) { + protected static boolean sizeOneOp(Object op, RAbstractContainer container, RAbstractIntVector operand) { return operand.getLength() == 1; } @@ -267,17 +267,17 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization - public RList doList(RAbstractContainer container, RList operand) { + protected RList doList(RAbstractContainer container, RList operand) { return operand; } @Specialization - public RMissing doFuncOp(VirtualFrame frame, RAbstractContainer container, RFunction operand) { + protected RMissing doFuncOp(VirtualFrame frame, RAbstractContainer container, RFunction operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "closure"); } @Specialization(guards = "dimLengthOne") - public int doMissingDimLengthOne(VirtualFrame frame, RAbstractContainer container, RMissing operand) { + protected int doMissingDimLengthOne(VirtualFrame frame, RAbstractContainer container, RMissing operand) { if (!isSubset) { if (assignment) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MISSING_SUBSCRIPT); @@ -289,7 +289,7 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = "!dimLengthOne") - public RMissing doMissing(VirtualFrame frame, RAbstractContainer container, RMissing operand) { + protected RMissing doMissing(VirtualFrame frame, RAbstractContainer container, RMissing operand) { if (!isSubset) { if (assignment) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MISSING_SUBSCRIPT); @@ -301,7 +301,7 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization - public int doNull(VirtualFrame frame, RAbstractContainer container, RNull operand) { + protected int doNull(VirtualFrame frame, RAbstractContainer container, RNull operand) { if (isSubset) { return 0; } else { @@ -310,27 +310,27 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"indNA", "isSubset", "numDimensionsOne"}) - public int doIntNASubset(RList vector, int operand) { + protected int doIntNASubset(RList vector, int operand) { return operand; } @Specialization(guards = {"indNA", "!isSubset", "numDimensionsOne"}) - public RNull doIntNA(RList vector, int operand) { + protected RNull doIntNA(RList vector, int operand) { return RNull.instance; } @Specialization(guards = {"indNA", "!numDimensionsOne"}) - public int doIntNAMultiDim(RList vector, int operand) { + protected int doIntNAMultiDim(RList vector, int operand) { return operand; } @Specialization(guards = {"indNA", "isSubset", "!isVectorList"}) - public int doIntNASubset(RAbstractContainer container, int operand) { + protected int doIntNASubset(RAbstractContainer container, int operand) { return operand; } @Specialization(guards = {"indNA", "!isSubset", "!isVectorList"}) - public int doIntNA(VirtualFrame frame, RAbstractContainer container, int operand) { + protected int doIntNA(VirtualFrame frame, RAbstractContainer container, int operand) { if (!assignment) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBSCRIPT_BOUNDS); } else { @@ -340,17 +340,17 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"!indNA", "!isSubset", "!isNegative"}) - public int doIntNegative(RList vector, int operand) { + protected int doIntNegative(RList vector, int operand) { return operand; } @Specialization(guards = {"!indNA", "!isSubset", "outOfBoundsNegative"}) - public int doIntOutOfBoundsNegative(RList vector, int operand) { + protected int doIntOutOfBoundsNegative(RList vector, int operand) { return operand; } @Specialization(guards = {"!indNA", "outOfBounds", "numDimensionsOne"}) - public int doIntOutOfBoundsOneDim(VirtualFrame frame, RAbstractContainer container, int operand) { + protected int doIntOutOfBoundsOneDim(VirtualFrame frame, RAbstractContainer container, int operand) { if (assignment) { return operand; } else { @@ -363,46 +363,46 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"!indNA", "outOfBounds", "!numDimensionsOne"}) - public int doIntOutOfBounds(VirtualFrame frame, RAbstractContainer container, int operand) { + protected int doIntOutOfBounds(VirtualFrame frame, RAbstractContainer container, int operand) { throw RError.error(frame, assignment ? getEncapsulatingSourceSection() : null, RError.Message.SUBSCRIPT_BOUNDS); } @Specialization(guards = {"!indNA", "outOfBoundsNegative", "dimLengthOne", "isSubset"}) - public int doIntOutOfBoundsNegativeOneElementSubset(RAbstractContainer container, int operand) { + protected int doIntOutOfBoundsNegativeOneElementSubset(RAbstractContainer container, int operand) { // there is only one element to be picked return 1; } @Specialization(guards = {"!indNA", "outOfBoundsNegative", "dimLengthOne", "!isSubset"}) - public int doIntOutOfBoundsNegativeOneElementAccess(RAbstractContainer container, int operand) { + protected int doIntOutOfBoundsNegativeOneElementAccess(RAbstractContainer container, int operand) { return operand; } @Specialization(guards = {"!indNA", "outOfBoundsNegative", "!dimLengthOne", "isSubset"}) - public RMissing doIntOutOfBoundsNegativeSubset(RAbstractContainer container, int operand) { + protected RMissing doIntOutOfBoundsNegativeSubset(RAbstractContainer container, int operand) { // all indexes - result is the same as with missing index return RMissing.instance; } @Specialization(guards = {"!indNA", "outOfBoundsNegative", "!dimLengthOne", "!isSubset"}) - public int doIntOutOfBoundsNegativeAccess(RAbstractContainer container, int operand) { + protected int doIntOutOfBoundsNegativeAccess(RAbstractContainer container, int operand) { return operand; } @Specialization(guards = {"!indNA", "!outOfBounds", "!isNegative"}) - public int doInt(RAbstractContainer container, int operand) { + protected int doInt(RAbstractContainer container, int operand) { return operand; } @Specialization(guards = {"!indNA", "isNegative", "!outOfBoundsNegative", "dimLengthOne"}) - public int doIntNegativeNoDimLeft(RAbstractContainer container, int operand) { + protected int doIntNegativeNoDimLeft(RAbstractContainer container, int operand) { // it's negative, but not out of bounds and dimension has length one - result is no // dimensions left return 0; } @Specialization(guards = {"isSubset", "!indNA", "isNegative", "!outOfBoundsNegative", "!dimLengthOne", "!vecLengthTwo"}) - public RIntVector doIntNegativeSubset(RAbstractContainer container, int operand) { + protected RIntVector doIntNegativeSubset(RAbstractContainer container, int operand) { // it's negative, but not out of bounds - pick all indexes apart from the negative one int dimLength = numDimensions == 1 ? container.getLength() : container.getDimensions()[dimension]; int[] positions = new int[dimLength - 1]; @@ -416,48 +416,48 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"!isSubset", "!indNA", "isNegative", "!outOfBoundsNegative", "!dimLengthOne", "!vecLengthTwo"}) - public int doIntNegative(RAbstractContainer container, int operand) { + protected int doIntNegative(RAbstractContainer container, int operand) { return operand; } @Specialization(guards = {"opNegOne", "vecLengthTwo"}) - public int doIntNegOne(RAbstractContainer container, int operand) { + protected int doIntNegOne(RAbstractContainer container, int operand) { return 2; } @Specialization(guards = {"opNegTwo", "vecLengthTwo"}) - public int doIntNegTow(RAbstractContainer container, int operand) { + protected int doIntNegTow(RAbstractContainer container, int operand) { return 1; } @Specialization(guards = "!isNegative") - public Object doDouble(VirtualFrame frame, RAbstractContainer container, double operand) { + protected Object doDouble(VirtualFrame frame, RAbstractContainer container, double operand) { return convertOperatorRecursive(frame, container, castInteger(frame, operand)); } @Specialization(guards = "isNegative") - public Object doDoubleNegative(VirtualFrame frame, RAbstractContainer container, double operand) { + protected Object doDoubleNegative(VirtualFrame frame, RAbstractContainer container, double operand) { // returns object as it may return either int or RIntVector due to conversion return convertOperatorRecursive(frame, container, castInteger(frame, operand)); } @Specialization(guards = {"indNA", "numDimensionsOne", "!isSubset"}) - public RNull doLogicalDimLengthOne(RList vector, byte operand) { + protected RNull doLogicalDimLengthOne(RList vector, byte operand) { return RNull.instance; } @Specialization(guards = {"indNA", "numDimensionsOne", "!isSubset", "!isVectorList"}) - public int doLogicalDimLengthOne(RAbstractContainer container, byte operand) { + protected int doLogicalDimLengthOne(RAbstractContainer container, byte operand) { return RRuntime.INT_NA; } @Specialization(guards = {"indNA", "numDimensionsOne", "isSubset", "isAssignment"}) - public int doLogicalNASubsetDimOneAssignment(RAbstractContainer container, byte operand) { + protected int doLogicalNASubsetDimOneAssignment(RAbstractContainer container, byte operand) { return RRuntime.INT_NA; } @Specialization(guards = {"indNA", "numDimensionsOne", "isSubset", "!isAssignment"}) - public RIntVector doLogicalNASubsetDimOne(RAbstractContainer container, byte operand) { + protected RIntVector doLogicalNASubsetDimOne(RAbstractContainer container, byte operand) { int dimLength = numDimensions == 1 ? (container.getLength() == 0 ? 1 : container.getLength()) : container.getDimensions()[dimension]; int[] data = new int[dimLength]; Arrays.fill(data, RRuntime.INT_NA); @@ -465,17 +465,17 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"indNA", "!numDimensionsOne", "isSubset", "dimLengthOne"}) - public int doLogicalDimLengthOneSubset(VirtualFrame frame, RAbstractContainer container, byte operand) { + protected int doLogicalDimLengthOneSubset(VirtualFrame frame, RAbstractContainer container, byte operand) { return (int) castInteger(frame, operand); } @Specialization(guards = {"indNA", "!numDimensionsOne", "isSubset", "!dimLengthOne", "isAssignment"}) - public int doLogicalNASubsetAssignment(RAbstractContainer container, byte operand) { + protected int doLogicalNASubsetAssignment(RAbstractContainer container, byte operand) { return RRuntime.INT_NA; } @Specialization(guards = {"indNA", "!numDimensionsOne", "isSubset", "!dimLengthOne", "!isAssignment"}) - public RIntVector doLogicalNASubset(RAbstractContainer container, byte operand) { + protected RIntVector doLogicalNASubset(RAbstractContainer container, byte operand) { int dimLength = numDimensions == 1 ? (container.getLength() == 0 ? 1 : container.getLength()) : container.getDimensions()[dimension]; int[] data = new int[dimLength]; Arrays.fill(data, RRuntime.INT_NA); @@ -483,12 +483,12 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"indNA", "!numDimensionsOne", "!isSubset"}) - public int doLogicalNA(RAbstractContainer container, byte operand) { + protected int doLogicalNA(RAbstractContainer container, byte operand) { return RRuntime.INT_NA; } @Specialization(guards = {"indTrue", "isSubset"}) - public RIntVector doLogicalIndTrue(RAbstractContainer container, byte operand) { + protected RIntVector doLogicalIndTrue(RAbstractContainer container, byte operand) { int dimLength = numDimensions == 1 ? container.getLength() : container.getDimensions()[dimension]; int[] data = new int[dimLength]; for (int i = 0; i < dimLength; i++) { @@ -498,22 +498,22 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"!indTrue", "!indNA", "isSubset"}) - public int doLogicalIndFalse(VirtualFrame frame, RAbstractContainer container, byte operand) { + protected int doLogicalIndFalse(VirtualFrame frame, RAbstractContainer container, byte operand) { return 0; } @Specialization(guards = {"!indNA", "!isSubset"}) - public int doLogical(VirtualFrame frame, RAbstractContainer container, byte operand) { + protected int doLogical(VirtualFrame frame, RAbstractContainer container, byte operand) { return (int) castInteger(frame, operand); } @Specialization - public RComplex doComplexValLengthZero(RAbstractContainer container, RComplex operand) { + protected RComplex doComplexValLengthZero(RAbstractContainer container, RComplex operand) { return operand; } @Specialization - public RRaw doRaw(RAbstractContainer container, RRaw operand) { + protected RRaw doRaw(RAbstractContainer container, RRaw operand) { return operand; } @@ -553,35 +553,35 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"indNA", "!numDimensionsOne"}) - public Object doStringNA(VirtualFrame frame, RAbstractContainer container, String operand) { + protected Object doStringNA(VirtualFrame frame, RAbstractContainer container, String operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBSCRIPT_BOUNDS); } @Specialization(guards = {"indNA", "isAssignment", "numDimensionsOne"}) - public RIntVector doStringNANumDimsOneAssignment(VirtualFrame frame, RAbstractContainer container, String operand) { + protected RIntVector doStringNANumDimsOneAssignment(VirtualFrame frame, RAbstractContainer container, String operand) { RStringVector resNames = RDataFactory.createStringVector(new String[]{operand}, RDataFactory.INCOMPLETE_VECTOR); return RDataFactory.createIntVector(new int[]{container.getLength() + 1}, RDataFactory.COMPLETE_VECTOR, resNames); } @Specialization(guards = {"indNA", "!isAssignment", "numDimensionsOne"}) - public Object doStringNANumDimsOne(VirtualFrame frame, RAbstractContainer container, String operand) { + protected Object doStringNANumDimsOne(VirtualFrame frame, RAbstractContainer container, String operand) { return convertOperatorRecursive(frame, container, RRuntime.INT_NA); } @Specialization(guards = {"hasNames", "isAssignment", "numDimensionsOne"}) - public RIntVector doStringOneDimNamesAssignment(RAbstractContainer container, String operand) { + protected RIntVector doStringOneDimNamesAssignment(RAbstractContainer container, String operand) { RStringVector names = (RStringVector) container.getNames(); return findPositionWithNames(container, names, operand); } @Specialization(guards = {"isSubset", "hasNames", "!isAssignment", "numDimensionsOne"}) - public Object doStringOneDimNamesSubset(VirtualFrame frame, RList vector, String operand) { + protected Object doStringOneDimNamesSubset(VirtualFrame frame, RList vector, String operand) { RStringVector names = (RStringVector) vector.getNames(); return findPosition(frame, vector, names, operand); } @Specialization(guards = {"!isSubset", "hasNames", "!isAssignment", "numDimensionsOne"}) - public Object doStringOneDimNames(VirtualFrame frame, RList vector, String operand) { + protected Object doStringOneDimNames(VirtualFrame frame, RList vector, String operand) { // we need to return either an int or null - is there a prettier way to handle this? RStringVector names = (RStringVector) vector.getNames(); int result = findPosition(frame, vector, names, operand); @@ -593,31 +593,31 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"hasNames", "!isAssignment", "numDimensionsOne"}) - public int doStringOneDimNames(VirtualFrame frame, RAbstractContainer container, String operand) { + protected int doStringOneDimNames(VirtualFrame frame, RAbstractContainer container, String operand) { RStringVector names = (RStringVector) container.getNames(); return findPosition(frame, container, names, operand); } @Specialization(guards = {"!hasNames", "isAssignment", "numDimensionsOne"}) - public RIntVector doStringOneDimAssignment(RAbstractContainer container, String operand) { + protected RIntVector doStringOneDimAssignment(RAbstractContainer container, String operand) { return findPositionWithNames(container, null, operand); } @Specialization(guards = {"isAssignment", "numDimensionsOne"}) - public RIntVector doStringOneDimAssignment(RNull vector, String operand) { + protected RIntVector doStringOneDimAssignment(RNull vector, String operand) { RStringVector resNames = RDataFactory.createStringVector(new String[]{operand}, !RRuntime.isNA(operand)); return RDataFactory.createIntVector(new int[]{1}, RDataFactory.COMPLETE_VECTOR, resNames); } @Specialization(guards = {"hasDimNames", "!numDimensionsOne"}) - public int doString(VirtualFrame frame, RAbstractContainer container, String operand) { + protected int doString(VirtualFrame frame, RAbstractContainer container, String operand) { RList dimNames = container.getDimNames(); Object names = dimNames.getDataAt(dimension); return findPosition(frame, container, names, operand); } @Specialization(guards = "isSubset") - public int doStringNoNamesSubset(VirtualFrame frame, RList vector, String operand) { + protected int doStringNoNamesSubset(VirtualFrame frame, RList vector, String operand) { if (numDimensions == 1) { return RRuntime.INT_NA; } else { @@ -626,7 +626,7 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = "!isSubset") - public RNull doStringNoNames(VirtualFrame frame, RList vector, String operand) { + protected RNull doStringNoNames(VirtualFrame frame, RList vector, String operand) { if (numDimensions == 1) { return RNull.instance; } else { @@ -635,7 +635,7 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization - public int doStringNoNames(VirtualFrame frame, RAbstractContainer container, String operand) { + protected int doStringNoNames(VirtualFrame frame, RAbstractContainer container, String operand) { if (isSubset) { if (numDimensions == 1) { return RRuntime.INT_NA; @@ -648,69 +648,69 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"!isSubset", "!opLengthZero", "!opLengthOne"}) - public RAbstractIntVector doIntVectorOp(RAbstractContainer container, RAbstractIntVector operand) { + protected RAbstractIntVector doIntVectorOp(RAbstractContainer container, RAbstractIntVector operand) { // no transformation - if it's a list, then it's handled during recursive access, if // it's not then it's an error dependent on the value return operand; } @Specialization(guards = {"!isSubset", "opLengthZero"}) - public RAbstractIntVector doIntVectorOp(VirtualFrame frame, RList vector, RAbstractVector operand) { + protected RAbstractIntVector doIntVectorOp(VirtualFrame frame, RList vector, RAbstractVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @Specialization(guards = {"!isSubset", "!opLengthZero", "!opLengthOne"}) - public RAbstractIntVector doIntVectorOp(VirtualFrame frame, RList vector, RAbstractDoubleVector operand) { + protected RAbstractIntVector doIntVectorOp(VirtualFrame frame, RList vector, RAbstractDoubleVector operand) { return (RIntVector) castInteger(frame, operand); } @Specialization(guards = {"!isSubset", "!opLengthZero", "!opLengthOne"}) - public RAbstractIntVector doIntVectorOp(VirtualFrame frame, RList vector, RAbstractLogicalVector operand) { + protected RAbstractIntVector doIntVectorOp(VirtualFrame frame, RList vector, RAbstractLogicalVector operand) { return (RIntVector) castInteger(frame, operand); } @Specialization(guards = {"!isSubset", "opLengthZero"}) - public int doIntEmptyOp(VirtualFrame frame, RAbstractContainer container, RAbstractVector operand) { + protected int doIntEmptyOp(VirtualFrame frame, RAbstractContainer container, RAbstractVector operand) { return 0; } @Specialization(guards = "opLengthOne") - public Object doIntVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractIntVector operand) { + protected Object doIntVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractIntVector operand) { return convertOperatorRecursive(frame, container, operand.getDataAt(0)); } @Specialization(guards = {"isSubset", "!opLengthOne", "!opLengthZero"}) - public RAbstractIntVector doIntVectorOpSubset(VirtualFrame frame, RAbstractContainer container, RAbstractIntVector operand) { + protected RAbstractIntVector doIntVectorOpSubset(VirtualFrame frame, RAbstractContainer container, RAbstractIntVector operand) { return transformIntoPositive(frame, container, operand); } @Specialization(guards = {"isSubset", "opLengthZero"}) - public int doIntVectorFewManySelected(RAbstractContainer container, RAbstractIntVector operand) { + protected int doIntVectorFewManySelected(RAbstractContainer container, RAbstractIntVector operand) { return 0; } @Specialization(guards = "opLengthOne") - public Object doDoubleVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractDoubleVector operand) { + protected Object doDoubleVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractDoubleVector operand) { return convertOperatorRecursive(frame, container, operand.getDataAt(0)); } @Specialization(guards = "!opLengthOne") - public Object doDoubleVector(VirtualFrame frame, RAbstractContainer container, RAbstractDoubleVector operand) { + protected Object doDoubleVector(VirtualFrame frame, RAbstractContainer container, RAbstractDoubleVector operand) { return convertOperatorRecursive(frame, container, castInteger(frame, operand)); } @Specialization(guards = "opLengthOne") - public Object doLogicalVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { + protected Object doLogicalVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { return convertOperatorRecursive(frame, container, operand.getDataAt(0)); } @Specialization(guards = {"outOfBounds", "isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doLogicalVectorOutOfBounds(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { + protected RIntVector doLogicalVectorOutOfBounds(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { throw RError.error(frame, isSubset ? null : getEncapsulatingSourceSection(), RError.Message.LOGICAL_SUBSCRIPT_LONG); } @Specialization(guards = {"outOfBounds", "!isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doLogicalVectorOutOfBoundsTooManySelected(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { + protected RIntVector doLogicalVectorOutOfBoundsTooManySelected(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @@ -728,7 +728,7 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"!outOfBounds", "isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doLogicalVector(RAbstractContainer container, RAbstractLogicalVector operand) { + protected RIntVector doLogicalVector(RAbstractContainer container, RAbstractLogicalVector operand) { int resultLength = numDimensions == 1 ? Math.max(operand.getLength(), container.getLength()) : container.getDimensions()[dimension]; int logicalVectorLength = operand.getLength(); int logicalVectorInd = 0; @@ -767,7 +767,7 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"!outOfBounds", "!isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doLogicalVectorTooManySelected(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { + protected RIntVector doLogicalVectorTooManySelected(VirtualFrame frame, RAbstractContainer container, RAbstractLogicalVector operand) { if (operand.getLength() == 2 && operand.getDataAt(0) == RRuntime.LOGICAL_FALSE) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -776,22 +776,22 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"isSubset", "opLengthZero"}) - public int doDoubleVectorTooFewSelected(RAbstractContainer container, RAbstractLogicalVector operand) { + protected int doDoubleVectorTooFewSelected(RAbstractContainer container, RAbstractLogicalVector operand) { return 0; } @Specialization(guards = "opLengthOne") - public Object doComplexVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { + protected Object doComplexVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { return convertOperatorRecursive(frame, container, operand.getDataAt(0)); } @Specialization(guards = {"isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doComplexVectorSubset(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { + protected RIntVector doComplexVectorSubset(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization(guards = {"!isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doComplexVector(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { + protected RIntVector doComplexVector(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { if (operand.getLength() == 2) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } else { @@ -800,22 +800,22 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"isSubset", "opLengthZero"}) - public RIntVector doComplexVectoTooFewSelectedSubset(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { + protected RIntVector doComplexVectoTooFewSelectedSubset(VirtualFrame frame, RAbstractContainer container, RAbstractComplexVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization(guards = "opLengthOne") - public Object doRawVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { + protected Object doRawVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { return convertOperatorRecursive(frame, container, operand.getDataAt(0)); } @Specialization(guards = {"isSubset", "!opLengthOne", "!opLengthZero"}) - public RAbstractIntVector doRawVectorSubset(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { + protected RAbstractIntVector doRawVectorSubset(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @Specialization(guards = {"!isSubset", "!opLengthOne", "!opLengthZero"}) - public RAbstractIntVector doRawVector(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { + protected RAbstractIntVector doRawVector(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { if (operand.getLength() == 2) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } else { @@ -824,7 +824,7 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"isSubset", "opLengthZero"}) - public RIntVector doRawVectorTooFewSelectedSubset(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { + protected RIntVector doRawVectorTooFewSelectedSubset(VirtualFrame frame, RAbstractContainer container, RAbstractRawVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @@ -902,29 +902,29 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = "opLengthOne") - public Object doStringlVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { + protected Object doStringlVectorOpLengthOne(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { return convertOperatorRecursive(frame, container, operand.getDataAt(0)); } @Specialization(guards = {"hasNames", "isAssignment", "numDimensionsOne", "isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doStringVectorOneDimNamesAssignment(RAbstractContainer container, RAbstractStringVector operand) { + protected RIntVector doStringVectorOneDimNamesAssignment(RAbstractContainer container, RAbstractStringVector operand) { RStringVector names = (RStringVector) container.getNames(); return findPositionsWithNames(container, names, operand, assignment); } @Specialization(guards = {"hasNames", "!isAssignment", "numDimensionsOne", "isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doStringVectorOneDimNames(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { + protected RIntVector doStringVectorOneDimNames(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { RStringVector names = (RStringVector) container.getNames(); return findPositions(frame, container, names, operand, assignment); } @Specialization(guards = {"!hasNames", "isAssignment", "numDimensionsOne", "isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doStringVectorOneDimAssignment(RAbstractContainer container, RAbstractStringVector operand) { + protected RIntVector doStringVectorOneDimAssignment(RAbstractContainer container, RAbstractStringVector operand) { return findPositionsWithNames(container, null, operand, assignment); } @Specialization(guards = {"isAssignment", "numDimensionsOne", "isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doStringVectorOneDimAssignment(VirtualFrame frame, RNull vector, RAbstractStringVector operand) { + protected RIntVector doStringVectorOneDimAssignment(VirtualFrame frame, RNull vector, RAbstractStringVector operand) { // we need to get rid of duplicates but retain all NAs int[] data = new int[operand.getLength()]; int initialPos = 0; @@ -936,25 +936,25 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = {"hasDimNames", "!numDimensionsOne", "isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doStringVector(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { + protected RIntVector doStringVector(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { RList dimNames = container.getDimNames(); RStringVector names = (RStringVector) dimNames.getDataAt(dimension); return findPositions(frame, container, names, operand, false); } @Specialization(guards = {"!isSubset", "!opLengthOne", "!opLengthZero", "numDimensionsOne"}) - public RAbstractStringVector doStringVectorTooManySelected(RList vector, RAbstractStringVector operand) { + protected RAbstractStringVector doStringVectorTooManySelected(RList vector, RAbstractStringVector operand) { // for recursive access return operand; } @Specialization(guards = {"!isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doStringVectorTooManySelected(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { + protected RIntVector doStringVectorTooManySelected(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"isSubset", "!opLengthOne", "!opLengthZero"}) - public RIntVector doStringVectorNoDimNames(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { + protected RIntVector doStringVectorNoDimNames(VirtualFrame frame, RAbstractContainer container, RAbstractStringVector operand) { if (numDimensions == 1) { int[] data = new int[operand.getLength()]; Arrays.fill(data, RRuntime.INT_NA); @@ -965,59 +965,59 @@ public abstract class ArrayPositionCast extends RNode { } @Specialization(guards = "opLengthZero") - public int doStringVectorTooFewSelected(RAbstractContainer container, RAbstractStringVector operand) { + protected int doStringVectorTooFewSelected(RAbstractContainer container, RAbstractStringVector operand) { return 0; } @Specialization(guards = {"numDimensionsOne", "operandHasNames", "!opLengthOne", "!opLengthZero"}) - public RAbstractIntVector doMissingVector(RNull vector, RAbstractIntVector operand) { + protected RAbstractIntVector doMissingVector(RNull vector, RAbstractIntVector operand) { RIntVector resPositions = (RIntVector) operand.copy(); resPositions.setNames(null); return resPositions; } @Specialization(guards = {"numDimensionsOne", "operandHasNames", "opLengthZero"}) - public Object doMissingVectorOpLengthZero(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { + protected Object doMissingVectorOpLengthZero(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { return castInteger(frame, operand); } @Specialization(guards = {"numDimensionsOne", "operandHasNames", "opLengthOne"}) - public Object doMissingVectorOpLengthOne(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { + protected Object doMissingVectorOpLengthOne(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { return castInteger(frame, operand); } @Specialization(guards = {"numDimensionsOne", "!operandHasNames"}) - public Object doMissingVectorNoNames(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { + protected Object doMissingVectorNoNames(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { return castInteger(frame, operand); } @Specialization(guards = "!numDimensionsOne") - public Object doMissingVectorDimGreaterThanOne(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { + protected Object doMissingVectorDimGreaterThanOne(VirtualFrame frame, RNull vector, RAbstractIntVector operand) { return castInteger(frame, operand); } @Specialization - public Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractDoubleVector operand) { + protected Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractDoubleVector operand) { return castInteger(frame, operand); } @Specialization - public Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractLogicalVector operand) { + protected Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractLogicalVector operand) { return castInteger(frame, operand); } @Specialization - public Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractComplexVector operand) { + protected Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractComplexVector operand) { return castInteger(frame, operand); } @Specialization - public Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractRawVector operand) { + protected Object doMissingVector(VirtualFrame frame, RNull vector, RAbstractRawVector operand) { return castInteger(frame, operand); } @Specialization - public Object doFuncOp(RFunction vector, Object operand) { + protected Object doFuncOp(RFunction vector, Object operand) { return operand; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/CoerceBinaryNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/CoerceBinaryNode.java index 5a7cab5ea743b151265be4adb5ce0edf1041b510..8f0e61d35df210666b46970c07d3dfe661daf6ec 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/CoerceBinaryNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/CoerceBinaryNode.java @@ -178,360 +178,360 @@ public abstract class CoerceBinaryNode extends RNode { // Left side is RNull @Specialization - public RNull access(VirtualFrame frame, RNull left, RNull right) { + protected RNull access(VirtualFrame frame, RNull left, RNull right) { return left; } @Specialization - public RLogicalVector access(VirtualFrame frame, RNull left, byte right) { + protected RLogicalVector access(VirtualFrame frame, RNull left, byte right) { return doLogical(frame, RDataFactory.createEmptyLogicalVector(), right); } @Specialization - public RIntVector access(VirtualFrame frame, RNull left, int right) { + protected RIntVector access(VirtualFrame frame, RNull left, int right) { return doInt(frame, RDataFactory.createEmptyIntVector(), right); } @Specialization - public RDoubleVector access(VirtualFrame frame, RNull left, double right) { + protected RDoubleVector access(VirtualFrame frame, RNull left, double right) { return doDouble(frame, RDataFactory.createEmptyDoubleVector(), right); } @Specialization - public RComplexVector access(VirtualFrame frame, RNull left, RComplex right) { + protected RComplexVector access(VirtualFrame frame, RNull left, RComplex right) { return doComplex(frame, RDataFactory.createEmptyComplexVector(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RNull left, String right) { + protected RStringVector access(VirtualFrame frame, RNull left, String right) { return doString(frame, RDataFactory.createEmptyStringVector(), right); } @Specialization - public RLogicalVector access(VirtualFrame frame, RNull left, RLogicalVector right) { + protected RLogicalVector access(VirtualFrame frame, RNull left, RLogicalVector right) { return doLogical(frame, RDataFactory.createEmptyLogicalVector(), right); } @Specialization - public RIntVector access(VirtualFrame frame, RNull left, RIntVector right) { + protected RIntVector access(VirtualFrame frame, RNull left, RIntVector right) { return doInt(frame, RDataFactory.createEmptyIntVector(), right); } @Specialization - public RDoubleVector access(VirtualFrame frame, RNull left, RDoubleVector right) { + protected RDoubleVector access(VirtualFrame frame, RNull left, RDoubleVector right) { return doDouble(frame, RDataFactory.createEmptyDoubleVector(), right); } @Specialization - public RComplexVector access(VirtualFrame frame, RNull left, RComplexVector right) { + protected RComplexVector access(VirtualFrame frame, RNull left, RComplexVector right) { return doComplex(frame, RDataFactory.createEmptyComplexVector(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RNull left, RStringVector right) { + protected RStringVector access(VirtualFrame frame, RNull left, RStringVector right) { return doString(frame, RDataFactory.createEmptyStringVector(), right); } // Left side is RLogicalVector @Specialization - public RLogicalVector access(VirtualFrame frame, RLogicalVector left, RNull right) { + protected RLogicalVector access(VirtualFrame frame, RLogicalVector left, RNull right) { return doLogical(frame, left, RDataFactory.createEmptyLogicalVector()); } @Specialization - public RLogicalVector access(VirtualFrame frame, RLogicalVector left, byte right) { + protected RLogicalVector access(VirtualFrame frame, RLogicalVector left, byte right) { return doLogical(frame, left, right); } @Specialization - public RIntVector access(VirtualFrame frame, RLogicalVector left, int right) { + protected RIntVector access(VirtualFrame frame, RLogicalVector left, int right) { leftNACheck.enable(left); return doInt(frame, RClosures.createLogicalToIntVector(left, leftNACheck).materialize(), right); } @Specialization - public RDoubleVector access(VirtualFrame frame, RLogicalVector left, double right) { + protected RDoubleVector access(VirtualFrame frame, RLogicalVector left, double right) { leftNACheck.enable(left); return doDouble(frame, RClosures.createLogicalToDoubleVector(left, leftNACheck).materialize(), right); } @Specialization - public RComplexVector access(VirtualFrame frame, RLogicalVector left, RComplex right) { + protected RComplexVector access(VirtualFrame frame, RLogicalVector left, RComplex right) { leftNACheck.enable(left); return doComplex(frame, RClosures.createLogicalToComplexVector(left, leftNACheck).materialize(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RLogicalVector left, String right) { + protected RStringVector access(VirtualFrame frame, RLogicalVector left, String right) { return doString(frame, left.toStringVector(), right); } @Specialization - public RLogicalVector access(VirtualFrame frame, RLogicalVector left, RLogicalVector right) { + protected RLogicalVector access(VirtualFrame frame, RLogicalVector left, RLogicalVector right) { return doLogical(frame, left, right); } @Specialization - public RIntVector access(VirtualFrame frame, RLogicalVector left, RIntVector right) { + protected RIntVector access(VirtualFrame frame, RLogicalVector left, RIntVector right) { leftNACheck.enable(left); return doInt(frame, RClosures.createLogicalToIntVector(left, leftNACheck).materialize(), right); } @Specialization - public RDoubleVector access(VirtualFrame frame, RLogicalVector left, RDoubleVector right) { + protected RDoubleVector access(VirtualFrame frame, RLogicalVector left, RDoubleVector right) { leftNACheck.enable(left); return doDouble(frame, RClosures.createLogicalToDoubleVector(left, leftNACheck).materialize(), right); } @Specialization - public RComplexVector access(VirtualFrame frame, RLogicalVector left, RComplexVector right) { + protected RComplexVector access(VirtualFrame frame, RLogicalVector left, RComplexVector right) { leftNACheck.enable(left); return doComplex(frame, RClosures.createLogicalToComplexVector(left, leftNACheck).materialize(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RLogicalVector left, RStringVector right) { + protected RStringVector access(VirtualFrame frame, RLogicalVector left, RStringVector right) { return doString(frame, left.toStringVector(), right); } // Left side is RIntVector @Specialization - public RIntVector access(VirtualFrame frame, RIntVector left, RNull right) { + protected RIntVector access(VirtualFrame frame, RIntVector left, RNull right) { return doInt(frame, left, RDataFactory.createEmptyIntVector()); } @Specialization - public RIntVector access(VirtualFrame frame, RIntVector left, byte right) { + protected RIntVector access(VirtualFrame frame, RIntVector left, byte right) { return doInt(frame, left, rightNACheck.convertLogicalToInt(right)); } @Specialization - public RIntVector access(VirtualFrame frame, RIntVector left, int right) { + protected RIntVector access(VirtualFrame frame, RIntVector left, int right) { return doInt(frame, left, right); } @Specialization - public RDoubleVector access(VirtualFrame frame, RIntVector left, double right) { + protected RDoubleVector access(VirtualFrame frame, RIntVector left, double right) { return doDouble(frame, RClosures.createIntToDoubleVector(left, leftNACheck).materialize(), right); } @Specialization - public RComplexVector access(VirtualFrame frame, RIntVector left, RComplex right) { + protected RComplexVector access(VirtualFrame frame, RIntVector left, RComplex right) { return doComplex(frame, RClosures.createIntToComplexVector(left, leftNACheck).materialize(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RIntVector left, String right) { + protected RStringVector access(VirtualFrame frame, RIntVector left, String right) { return doString(frame, left.toStringVector(), right); } @Specialization - public RIntVector access(VirtualFrame frame, RIntVector left, RLogicalVector right) { + protected RIntVector access(VirtualFrame frame, RIntVector left, RLogicalVector right) { return doInt(frame, left, RClosures.createLogicalToIntVector(right, rightNACheck).materialize()); } @Specialization - public RIntVector access(VirtualFrame frame, RIntVector left, RIntVector right) { + protected RIntVector access(VirtualFrame frame, RIntVector left, RIntVector right) { return doInt(frame, left, right); } @Specialization - public RDoubleVector access(VirtualFrame frame, RIntVector left, RDoubleVector right) { + protected RDoubleVector access(VirtualFrame frame, RIntVector left, RDoubleVector right) { return doDouble(frame, RClosures.createIntToDoubleVector(left, leftNACheck).materialize(), right); } @Specialization - public RComplexVector access(VirtualFrame frame, RIntVector left, RComplexVector right) { + protected RComplexVector access(VirtualFrame frame, RIntVector left, RComplexVector right) { return doComplex(frame, RClosures.createIntToComplexVector(left, leftNACheck).materialize(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RIntVector left, RStringVector right) { + protected RStringVector access(VirtualFrame frame, RIntVector left, RStringVector right) { return doString(frame, left.toStringVector(), right); } // Left side is RDoubleVector @Specialization - public RDoubleVector access(VirtualFrame frame, RDoubleVector left, RNull right) { + protected RDoubleVector access(VirtualFrame frame, RDoubleVector left, RNull right) { return doDouble(frame, left, RDataFactory.createEmptyDoubleVector()); } @Specialization - public RDoubleVector access(VirtualFrame frame, RDoubleVector left, byte right) { + protected RDoubleVector access(VirtualFrame frame, RDoubleVector left, byte right) { return doDouble(frame, left, rightNACheck.convertLogicalToDouble(right)); } @Specialization - public RDoubleVector access(VirtualFrame frame, RDoubleVector left, int right) { + protected RDoubleVector access(VirtualFrame frame, RDoubleVector left, int right) { return doDouble(frame, left, rightNACheck.convertIntToDouble(right)); } @Specialization - public RDoubleVector access(VirtualFrame frame, RDoubleVector left, double right) { + protected RDoubleVector access(VirtualFrame frame, RDoubleVector left, double right) { return doDouble(frame, left, right); } @Specialization - public RComplexVector access(VirtualFrame frame, RDoubleVector left, RComplex right) { + protected RComplexVector access(VirtualFrame frame, RDoubleVector left, RComplex right) { return doComplex(frame, RClosures.createDoubleToComplexVector(left, leftNACheck).materialize(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RDoubleVector left, String right) { + protected RStringVector access(VirtualFrame frame, RDoubleVector left, String right) { return doString(frame, left.toStringVector(), right); } @Specialization - public RDoubleVector access(VirtualFrame frame, RDoubleVector left, RLogicalVector right) { + protected RDoubleVector access(VirtualFrame frame, RDoubleVector left, RLogicalVector right) { return doDouble(frame, left, RClosures.createLogicalToDoubleVector(right, rightNACheck).materialize()); } @Specialization - public RDoubleVector access(VirtualFrame frame, RDoubleVector left, RIntVector right) { + protected RDoubleVector access(VirtualFrame frame, RDoubleVector left, RIntVector right) { return doDouble(frame, left, RClosures.createIntToDoubleVector(right, rightNACheck).materialize()); } @Specialization - public RDoubleVector access(VirtualFrame frame, RDoubleVector left, RDoubleVector right) { + protected RDoubleVector access(VirtualFrame frame, RDoubleVector left, RDoubleVector right) { return doDouble(frame, left, right); } @Specialization - public RComplexVector access(VirtualFrame frame, RDoubleVector left, RComplexVector right) { + protected RComplexVector access(VirtualFrame frame, RDoubleVector left, RComplexVector right) { return doComplex(frame, RClosures.createDoubleToComplexVector(left, leftNACheck).materialize(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RDoubleVector left, RStringVector right) { + protected RStringVector access(VirtualFrame frame, RDoubleVector left, RStringVector right) { return doString(frame, left.toStringVector(), right); } // Left side is RComplexVector @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, RNull right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, RNull right) { return doComplex(frame, left, RDataFactory.createEmptyComplexVector()); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, byte right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, byte right) { return doComplex(frame, left, rightNACheck.convertLogicalToComplex(right)); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, int right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, int right) { return doComplex(frame, left, rightNACheck.convertIntToComplex(right)); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, double right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, double right) { return doComplex(frame, left, rightNACheck.convertDoubleToComplex(right)); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, RComplex right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, RComplex right) { return doComplex(frame, left, right); } @Specialization - public RStringVector access(VirtualFrame frame, RComplexVector left, String right) { + protected RStringVector access(VirtualFrame frame, RComplexVector left, String right) { return doString(frame, left.toStringVector(), right); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, RLogicalVector right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, RLogicalVector right) { return doComplex(frame, left, RClosures.createLogicalToComplexVector(right, rightNACheck).materialize()); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, RIntVector right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, RIntVector right) { return doComplex(frame, left, RClosures.createIntToComplexVector(right, rightNACheck).materialize()); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, RDoubleVector right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, RDoubleVector right) { return doComplex(frame, left, RClosures.createDoubleToComplexVector(right, rightNACheck).materialize()); } @Specialization - public RComplexVector access(VirtualFrame frame, RComplexVector left, RComplexVector right) { + protected RComplexVector access(VirtualFrame frame, RComplexVector left, RComplexVector right) { return doComplex(frame, left, right); } @Specialization - public RStringVector access(VirtualFrame frame, RComplexVector left, RStringVector right) { + protected RStringVector access(VirtualFrame frame, RComplexVector left, RStringVector right) { return doString(frame, left.toStringVector(), right); } // Left side is RStringVector @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, RNull right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, RNull right) { return doString(frame, left, RDataFactory.createEmptyStringVector()); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, byte right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, byte right) { return doString(frame, left, rightNACheck.convertLogicalToString(right)); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, int right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, int right) { return doString(frame, left, rightNACheck.convertIntToString(right)); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, double right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, double right) { return doString(frame, left, rightNACheck.convertDoubleToString(right)); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, RComplex right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, RComplex right) { return doString(frame, left, rightNACheck.convertComplexToString(right)); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, String right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, String right) { return doString(frame, left.toStringVector(), right); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, RLogicalVector right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, RLogicalVector right) { return doString(frame, left, right.toStringVector()); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, RIntVector right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, RIntVector right) { return doString(frame, left, right.toStringVector()); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, RDoubleVector right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, RDoubleVector right) { return doString(frame, left, right.toStringVector()); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, RComplexVector right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, RComplexVector right) { return doString(frame, left, right.toStringVector()); } @Specialization - public RStringVector access(VirtualFrame frame, RStringVector left, RStringVector right) { + protected RStringVector access(VirtualFrame frame, RStringVector left, RStringVector right) { return doString(frame, left, right); } // left side is RList @Specialization - public RAbstractVector access(VirtualFrame frame, RList left, RAbstractVector right) { + protected RAbstractVector access(VirtualFrame frame, RList left, RAbstractVector right) { return doList(frame, left, right); } @Specialization - public RAbstractVector access(VirtualFrame frame, RList left, RNull right) { + protected RAbstractVector access(VirtualFrame frame, RList left, RNull right) { return doList(frame, left, right); } @@ -542,79 +542,79 @@ public abstract class CoerceBinaryNode extends RNode { protected abstract NACheck getNACheck(); @Specialization - public int doInt(int operand) { + protected int doInt(int operand) { getNACheck().enable(RRuntime.isNA(operand)); return operand; } @Specialization - public double doDouble(double operand) { + protected double doDouble(double operand) { getNACheck().enable(operand); return operand; } @Specialization - public RComplex doComplex(RComplex operand) { + protected RComplex doComplex(RComplex operand) { getNACheck().enable(operand); return operand; } @Specialization - public byte doBoolean(byte operand) { + protected byte doBoolean(byte operand) { getNACheck().enable(operand); return operand; } @Specialization - public String doString(String operand) { + protected String doString(String operand) { getNACheck().enable(operand); return operand; } @Specialization - public RIntVector doIntVector(RIntSequence operand) { + protected RIntVector doIntVector(RIntSequence operand) { // NACheck may keep disabled. return (RIntVector) operand.createVector(); } @Specialization - public RIntVector doIntVector(RIntVector operand) { + protected RIntVector doIntVector(RIntVector operand) { getNACheck().enable(!operand.isComplete()); return operand; } @Specialization - public RDoubleVector doDoubleVector(RDoubleVector operand) { + protected RDoubleVector doDoubleVector(RDoubleVector operand) { getNACheck().enable(!operand.isComplete()); return operand; } @Specialization - public RComplexVector doComplexVector(RComplexVector operand) { + protected RComplexVector doComplexVector(RComplexVector operand) { getNACheck().enable(!operand.isComplete()); return operand; } @Specialization - public RLogicalVector doLogicalVector(RLogicalVector operand) { + protected RLogicalVector doLogicalVector(RLogicalVector operand) { getNACheck().enable(!operand.isComplete()); return operand; } @Specialization - public RStringVector doStringVector(RStringVector operand) { + protected RStringVector doStringVector(RStringVector operand) { getNACheck().enable(!operand.isComplete()); return operand; } @Specialization - public RList doList(RList operand) { + protected RList doList(RList operand) { getNACheck().enable(!operand.isComplete()); return operand; } @Specialization - public RNull doNull(RNull operand) { + protected RNull doNull(RNull operand) { return operand; } } @@ -630,84 +630,84 @@ public abstract class CoerceBinaryNode extends RNode { BranchProfile seenShared = new BranchProfile(); @Specialization - public RNull doNull(RNull operand) { + protected RNull doNull(RNull operand) { return operand; } @Specialization - public RIntVector doInt(int operand) { + protected RIntVector doInt(int operand) { getNACheck().enable(RRuntime.isNA(operand)); return RDataFactory.createIntVectorFromScalar(operand); } @Specialization - public RDoubleVector doDouble(double operand) { + protected RDoubleVector doDouble(double operand) { getNACheck().enable(operand); return RDataFactory.createDoubleVectorFromScalar(operand); } @Specialization - public RComplexVector doComplex(RComplex operand) { + protected RComplexVector doComplex(RComplex operand) { getNACheck().enable(operand); return RDataFactory.createComplexVectorFromScalar(operand); } @Specialization - public RLogicalVector doBoolean(byte operand) { + protected RLogicalVector doBoolean(byte operand) { getNACheck().enable(operand); return RDataFactory.createLogicalVector(operand); } @Specialization - public RStringVector doString(String operand) { + protected RStringVector doString(String operand) { getNACheck().enable(operand); return RDataFactory.createStringVector(operand); } @Specialization - public RDoubleVector doDoubleVector(RDoubleSequence operand) { + protected RDoubleVector doDoubleVector(RDoubleSequence operand) { // NACheck may keep disabled. return (RDoubleVector) operand.createVector(); } @Specialization - public RIntVector doIntVector(RIntSequence operand) { + protected RIntVector doIntVector(RIntSequence operand) { // NACheck may keep disabled. return (RIntVector) operand.createVector(); } @Specialization - public RIntVector doIntVector(RIntVector operand) { + protected RIntVector doIntVector(RIntVector operand) { getNACheck().enable(!operand.isComplete()); return doVector(operand); } @Specialization - public RDoubleVector doDoubleVector(RDoubleVector operand) { + protected RDoubleVector doDoubleVector(RDoubleVector operand) { getNACheck().enable(!operand.isComplete()); return doVector(operand); } @Specialization - public RComplexVector doComplexVector(RComplexVector operand) { + protected RComplexVector doComplexVector(RComplexVector operand) { getNACheck().enable(!operand.isComplete()); return doVector(operand); } @Specialization - public RLogicalVector doLogicalVector(RLogicalVector operand) { + protected RLogicalVector doLogicalVector(RLogicalVector operand) { getNACheck().enable(!operand.isComplete()); return doVector(operand); } @Specialization - public RStringVector doStringVector(RStringVector operand) { + protected RStringVector doStringVector(RStringVector operand) { getNACheck().enable(!operand.isComplete()); return doVector(operand); } @Specialization - public RList doList(RList operand) { + protected RList doList(RList operand) { getNACheck().enable(!operand.isComplete()); return doVector(operand); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java index 756787737a2a6239119b6776c6359330eb43621f..cc72d73238d0c333579557db3cb8bec364ab7895 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ConstantNode.java @@ -99,7 +99,6 @@ public abstract class ConstantNode extends RNode implements VisibilityController controlVisibility(); return doubleValue; } - } private static final class ConstantLogicalScalarNode extends ConstantNode { @@ -143,7 +142,6 @@ public abstract class ConstantNode extends RNode implements VisibilityController controlVisibility(); return doubleValue; } - } private static final class ConstantIntegerScalarNode extends ConstantNode { @@ -175,7 +173,6 @@ public abstract class ConstantNode extends RNode implements VisibilityController controlVisibility(); return doubleValue; } - } private static final class ConstantStringScalarNode extends ConstantNode { @@ -197,7 +194,6 @@ public abstract class ConstantNode extends RNode implements VisibilityController controlVisibility(); return objectValue; } - } private static final class ConstantComplexNode extends ConstantNode { @@ -219,7 +215,6 @@ public abstract class ConstantNode extends RNode implements VisibilityController controlVisibility(); return complexValue; } - } private static final class ConstantNullNode extends ConstantNode { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariableNode.java index 866ac7d601be8bdaf57ebe912356464f6c613ad6..279df5eb5da3d23e4d62f46ffe75bca1bef183c4 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariableNode.java @@ -137,7 +137,7 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro public abstract Symbol getSymbol(); /** - * Checks every value read from a variable whether it is a {@link RPromise} or not. If yes, it + * Checks every value read from a variable whether it is an {@link RPromise} or not. If yes, it * replaces itself with a {@link ReadPromiseNode}, else with a standard {@link ReadVariableNode} */ public static class ReadCheckPromiseNode extends ReadVariableNode { @@ -147,7 +147,6 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro private final ReadVariableNode readNodeInitial; public ReadCheckPromiseNode(ReadVariableNode readNode) { - super(); this.readNode = readNode; this.readNodeInitial = NodeUtil.cloneNode(readNode); } @@ -171,7 +170,7 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro private Object specializeAndExecute(VirtualFrame frame, Object value) { CompilerAsserts.neverPartOfCompilation(); - if (value != null && value instanceof RPromise) { + if (value instanceof RPromise) { // Force promise execution to get (back to) the future! ;) RPromise promise = (RPromise) value; Object promiseValue = promise.evaluate(frame); @@ -207,7 +206,6 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro @Child private ReadVariableNode readNode; public ReadPromiseNode(Symbol symbol, RPromise promise, ReadVariableNode readNode) { - super(); this.symbol = symbol; this.promise = promise; this.readNode = readNode; @@ -245,7 +243,7 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro } } - interface HasMode { + private interface HasMode { String getMode(); } @@ -543,25 +541,25 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro public abstract Symbol getSymbol(); @Specialization(rewriteOn = FrameSlotTypeException.class) - public byte doLogical(VirtualFrame frame, FrameSlot frameSlot) throws FrameSlotTypeException { + protected byte doLogical(VirtualFrame frame, FrameSlot frameSlot) throws FrameSlotTypeException { controlVisibility(); return frame.getByte(frameSlot); } @Specialization(rewriteOn = FrameSlotTypeException.class) - public int doInteger(VirtualFrame frame, FrameSlot frameSlot) throws FrameSlotTypeException { + protected int doInteger(VirtualFrame frame, FrameSlot frameSlot) throws FrameSlotTypeException { controlVisibility(); return frame.getInt(frameSlot); } @Specialization(rewriteOn = FrameSlotTypeException.class) - public double doDouble(VirtualFrame frame, FrameSlot frameSlot) throws FrameSlotTypeException { + protected double doDouble(VirtualFrame frame, FrameSlot frameSlot) throws FrameSlotTypeException { controlVisibility(); return frame.getDouble(frameSlot); } @Specialization - public Object doObject(VirtualFrame frame, FrameSlot frameSlot) { + protected Object doObject(VirtualFrame frame, FrameSlot frameSlot) { controlVisibility(); try { return frame.getObject(frameSlot); @@ -582,25 +580,25 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro public abstract Symbol getSymbol(); @Specialization(rewriteOn = FrameSlotTypeException.class) - public byte doLogical(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) throws FrameSlotTypeException { + protected byte doLogical(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) throws FrameSlotTypeException { controlVisibility(); return enclosingFrame.getByte(frameSlot); } @Specialization(rewriteOn = FrameSlotTypeException.class) - public int doInteger(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) throws FrameSlotTypeException { + protected int doInteger(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) throws FrameSlotTypeException { controlVisibility(); return enclosingFrame.getInt(frameSlot); } @Specialization(rewriteOn = FrameSlotTypeException.class) - public double doDouble(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) throws FrameSlotTypeException { + protected double doDouble(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) throws FrameSlotTypeException { controlVisibility(); return enclosingFrame.getDouble(frameSlot); } @Specialization - public Object doObject(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + protected Object doObject(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { controlVisibility(); try { return enclosingFrame.getObject(frameSlot); @@ -614,7 +612,7 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro @Override @Specialization - public Object doObject(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + protected Object doObject(VirtualFrame frame, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { controlVisibility(); try { Object result = enclosingFrame.getObject(frameSlot); @@ -638,7 +636,7 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro public abstract Symbol getSymbol(); @Specialization - public Object doObject(@SuppressWarnings("unused") VirtualFrame frame) { + protected Object doObject(@SuppressWarnings("unused") VirtualFrame frame) { controlVisibility(); return getFunction(); } @@ -654,7 +652,7 @@ public abstract class ReadVariableNode extends RNode implements VisibilityContro public abstract String getMode(); @Specialization - public Object doObject(VirtualFrame frame) { + protected Object doObject(VirtualFrame frame) { controlVisibility(); throw RError.error(frame, getMode() == RRuntime.TYPE_FUNCTION ? RError.Message.UNKNOWN_FUNCTION : RError.Message.UNKNOWN_OBJECT, getSymbol()); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/Symbol.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/Symbol.java index 457a64cc682eaab14d5dac8eeadae465a6865dce..a414aa33a46f55f4fc8af7a1a7f2c8f90aa398ce 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/Symbol.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/Symbol.java @@ -63,7 +63,7 @@ public class Symbol { * @param name {@link #name} * @see Symbol */ - Symbol(String name) { + private Symbol(String name) { this.name = name; this.isVarArg = name.equals("..."); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateArrayHelperNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateArrayHelperNode.java index 7df3ddc0122059febcde2494b2582430ebd06285..40cc15e8ca71c8eb4be8b74bcb59b0a12ba3bc9d 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateArrayHelperNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateArrayHelperNode.java @@ -56,11 +56,11 @@ public abstract class UpdateArrayHelperNode extends RNode { private final NACheck posNACheck = NACheck.create(); private final NACheck namesNACheck = NACheck.create(); - abstract RNode getVector(); + protected abstract RNode getVector(); - abstract RNode getNewValue(); + protected abstract RNode getNewValue(); - abstract Object executeUpdate(VirtualFrame frame, Object v, Object value, int recLevel, Object positions, Object vector); + protected abstract Object executeUpdate(VirtualFrame frame, Object v, Object value, int recLevel, Object positions, Object vector); @Child private UpdateArrayHelperNode updateRecursive; @Child private CastComplexNode castComplex; @@ -168,7 +168,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "emptyValue") - RAbstractVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, Object[] positions, RAbstractVector vector) { + protected RAbstractVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, Object[] positions, RAbstractVector vector) { if (isSubset) { int replacementLength = getReplacementLength(frame, positions, value, false); if (replacementLength == 0) { @@ -179,12 +179,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RNull accessFunction(VirtualFrame frame, Object v, Object value, int recLevel, Object position, RFunction vector) { + protected RNull accessFunction(VirtualFrame frame, Object v, Object value, int recLevel, Object position, RFunction vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.OBJECT_NOT_SUBSETTABLE, "closure"); } @Specialization - RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, Object[] positions, RList vector) { + protected RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, Object[] positions, RList vector) { if (isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NOT_MULTIPLE_REPLACEMENT); } else { @@ -193,7 +193,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "isPosZero") - RAbstractVector updateNAOrZero(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { + protected RAbstractVector updateNAOrZero(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -202,7 +202,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, Object[] positions, RAbstractVector vector) { + protected RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, Object[] positions, RAbstractVector vector) { if (isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NOT_MULTIPLE_REPLACEMENT); } else { @@ -211,7 +211,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"emptyValue", "isPosZero"}) - RAbstractVector updatePosZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updatePosZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } @@ -219,27 +219,27 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"emptyValue", "!isPosZero", "!isPosNA", "!isVectorList"}) - RAbstractVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } @Specialization(guards = "!isVectorLongerThanOne") - RAbstractVector updateVectorLongerThanOne(VirtualFrame frame, Object v, RNull value, int recLevel, RNull position, RList vector) { + protected RAbstractVector updateVectorLongerThanOne(VirtualFrame frame, Object v, RNull value, int recLevel, RNull position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @Specialization(guards = "isVectorLongerThanOne") - RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, RNull position, RList vector) { + protected RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, RNull position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization - RAbstractVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RNull position, RAbstractVector vector) { + protected RAbstractVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RNull position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"isPosNA", "isValueLengthOne", "isVectorLongerThanOne"}) - RAbstractVector updateNAValueLengthOneLongVector(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updateNAValueLengthOneLongVector(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else { @@ -248,7 +248,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"isPosNA", "isValueLengthOne", "!isVectorLongerThanOne"}) - RAbstractVector updateNAValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updateNAValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -257,7 +257,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"isPosNA", "!isValueLengthOne"}) - RAbstractVector updateNA(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updateNA(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { if (isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NA_SUBSCRIPTED); } else { @@ -266,7 +266,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"isPosZero", "isValueLengthOne"}) - RAbstractVector updateZeroValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updateZeroValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -275,7 +275,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"isPosZero", "!isValueLengthOne"}) - RAbstractVector updateZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updateZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -389,17 +389,17 @@ public abstract class UpdateArrayHelperNode extends RNode { // null @Specialization - RNull updateWrongDimensions(Object v, RNull value, int recLevel, Object[] positions, RNull vector) { + protected RNull updateWrongDimensions(Object v, RNull value, int recLevel, Object[] positions, RNull vector) { return vector; } @Specialization(guards = {"!wrongDimensionsMatrix", "!wrongDimensions"}) - RNull updateWrongDimensions(Object v, RAbstractVector value, int recLevel, Object[] positions, RNull vector) { + protected RNull updateWrongDimensions(Object v, RAbstractVector value, int recLevel, Object[] positions, RNull vector) { return vector; } @Specialization(guards = "emptyValue") - RNull updatePosZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RNull vector) { + protected RNull updatePosZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RNull vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } @@ -407,7 +407,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "emptyValue") - RNull updatePosZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RNull vector) { + protected RNull updatePosZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RNull vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } @@ -415,7 +415,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "!emptyValue") - RIntVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RNull vector) { + protected RIntVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RNull vector) { int highestPos = getHighestPos(positions); int[] data = new int[highestPos]; Arrays.fill(data, RRuntime.INT_NA); @@ -423,7 +423,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "!isPosNA", "!isPosZero"}) - RIntVector update(Object v, RAbstractIntVector value, int recLevel, int position, RNull vector) { + protected RIntVector update(Object v, RAbstractIntVector value, int recLevel, int position, RNull vector) { if (position > 1) { int[] data = new int[position]; Arrays.fill(data, RRuntime.INT_NA); @@ -434,7 +434,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "!emptyValue") - RDoubleVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RNull vector) { + protected RDoubleVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RNull vector) { int highestPos = getHighestPos(positions); double[] data = new double[highestPos]; Arrays.fill(data, RRuntime.DOUBLE_NA); @@ -442,7 +442,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "!isPosNA", "!isPosZero"}) - RDoubleVector update(Object v, RAbstractDoubleVector value, int recLevel, int position, RNull vector) { + protected RDoubleVector update(Object v, RAbstractDoubleVector value, int recLevel, int position, RNull vector) { if (position > 1) { double[] data = new double[position]; Arrays.fill(data, RRuntime.DOUBLE_NA); @@ -453,7 +453,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "!emptyValue") - RLogicalVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RNull vector) { + protected RLogicalVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RNull vector) { int highestPos = getHighestPos(positions); byte[] data = new byte[highestPos]; Arrays.fill(data, RRuntime.LOGICAL_NA); @@ -461,7 +461,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "!isPosNA", "!isPosZero"}) - RLogicalVector update(Object v, RAbstractLogicalVector value, int recLevel, int position, RNull vector) { + protected RLogicalVector update(Object v, RAbstractLogicalVector value, int recLevel, int position, RNull vector) { if (position > 1) { byte[] data = new byte[position]; Arrays.fill(data, RRuntime.LOGICAL_NA); @@ -472,7 +472,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "!emptyValue") - RStringVector update(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RNull vector) { + protected RStringVector update(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RNull vector) { int highestPos = getHighestPos(positions); String[] data = new String[highestPos]; Arrays.fill(data, RRuntime.STRING_NA); @@ -480,7 +480,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "!isPosNA", "!isPosZero"}) - RStringVector update(Object v, RAbstractStringVector value, int recLevel, int position, RNull vector) { + protected RStringVector update(Object v, RAbstractStringVector value, int recLevel, int position, RNull vector) { if (position > 1) { String[] data = new String[position]; Arrays.fill(data, RRuntime.STRING_NA); @@ -491,7 +491,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "!emptyValue") - RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RNull vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RNull vector) { int highestPos = getHighestPos(positions); double[] data = new double[highestPos << 1]; int ind = 0; @@ -503,7 +503,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "!isPosNA", "!isPosZero"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, int position, RNull vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, int position, RNull vector) { if (position > 1) { double[] data = new double[position << 1]; int ind = 0; @@ -518,47 +518,47 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "!emptyValue") - RRawVector update(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RNull vector) { + protected RRawVector update(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RNull vector) { return updateSingleDimVector(frame, value, 0, RDataFactory.createRawVector(getHighestPos(positions)), positions); } @Specialization(guards = {"!emptyValue", "!isPosNA", "!isPosZero"}) - RRawVector update(Object v, RAbstractRawVector value, int recLevel, int position, RNull vector) { + protected RRawVector update(Object v, RAbstractRawVector value, int recLevel, int position, RNull vector) { return updateSingleDim(value, RDataFactory.createRawVector(position), position); } @Specialization(guards = {"!isPosNA", "isPositionNegative", "!isVectorList"}) - RList updateNegativeNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RAbstractVector vector) { + protected RList updateNegativeNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } @Specialization(guards = {"!isPosNA", "isPositionNegative", "!outOfBoundsNegative"}) - RList updateNegativeNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { + protected RList updateNegativeNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"!isPosNA", "isPositionNegative", "outOfBoundsNegative", "oneElemVector"}) - RList updateNegativeOutOfBoundsOneElemNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { + protected RList updateNegativeOutOfBoundsOneElemNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @Specialization(guards = {"!isPosNA", "isPositionNegative", "outOfBoundsNegative", "!oneElemVector"}) - RList updateNegativeOutOfBoundsNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { + protected RList updateNegativeOutOfBoundsNull(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"!isPosNA", "isPositionNegative", "!outOfBoundsNegative"}) - RList updateNegative(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RList updateNegative(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"!isPosNA", "isPositionNegative", "outOfBoundsNegative", "oneElemVector"}) - RList updateNegativeOneElem(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RList updateNegativeOneElem(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @Specialization(guards = {"!isPosNA", "isPositionNegative", "outOfBoundsNegative", "!oneElemVector"}) - RList updateOutOfBoundsNegative(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { + protected RList updateOutOfBoundsNegative(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @@ -711,60 +711,60 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RList update(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, Object[] positions, RList vector) { + protected RList update(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, Object[] positions, RList vector) { return updateVector(frame, value, vector, positions); } @Specialization - Object updateString(VirtualFrame frame, Object v, RNull value, int recLevel, RStringVector positions, RList vector) { + protected Object updateString(VirtualFrame frame, Object v, RNull value, int recLevel, RStringVector positions, RList vector) { return updateListRecursive(frame, v, value, vector, recLevel, positions); } @Specialization - Object updateString(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RStringVector positions, RList vector) { + protected Object updateString(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RStringVector positions, RList vector) { return updateListRecursive(frame, v, value, vector, recLevel, positions); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RList update(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector positions, RList vector) { + protected RList update(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector positions, RList vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions), false), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateOne(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector positions, RList vector) { + protected Object updateOne(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector positions, RList vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RList updateNames(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector positions, RList vector) { + protected RList updateNames(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector positions, RList vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions), false), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero", "!isPositionNegative"}) - RList updateTooManyValuesSubset(Object v, RAbstractContainer value, int recLevel, int position, RList vector) { + protected RList updateTooManyValuesSubset(Object v, RAbstractContainer value, int recLevel, int position, RList vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(value, getResultVector(vector, position, false), position); } @Specialization(guards = {"isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero", "!isPositionNegative"}) - RList update(Object v, RAbstractContainer value, int recLevel, int position, RList vector) { + protected RList update(Object v, RAbstractContainer value, int recLevel, int position, RList vector) { return updateSingleDim(value, getResultVector(vector, position, false), position); } @Specialization(guards = {"!isSubset", "!isPosNA", "!isPosZero", "!isPositionNegative"}) - RList updateTooManyValuesSubscript(Object v, RAbstractContainer value, int recLevel, int position, RList vector) { + protected RList updateTooManyValuesSubscript(Object v, RAbstractContainer value, int recLevel, int position, RList vector) { RList resultVector = getResultVector(vector, position, false); resultVector.updateDataAt(position - 1, adjustRhsStateOnAssignment(value), null); return resultVector; } @Specialization(guards = "isPosNA") - RList updateListNullValue(Object v, RNull value, int recLevel, int position, RList vector) { + protected RList updateListNullValue(Object v, RNull value, int recLevel, int position, RList vector) { return vector; } @Specialization(guards = {"!isPosZero", "emptyList", "!isPosNA", "!isPositionNegative"}) - RList updateEmptyList(Object v, RNull value, int recLevel, int position, RList vector) { + protected RList updateEmptyList(Object v, RNull value, int recLevel, int position, RList vector) { return vector; } @@ -810,19 +810,19 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!isPosZero", "!emptyList", "!isPosNA", "!isPositionNegative"}) - RList update(Object v, RNull value, int recLevel, int position, RList vector) { + protected RList update(Object v, RNull value, int recLevel, int position, RList vector) { return removeElement(vector, position, false, isSubset); } private static final Object DELETE_MARKER = new Object(); @Specialization(guards = {"isSubset", "noPosition"}) - RList updateEmptyPos(Object v, RNull value, int recLevel, RIntVector positions, RList vector) { + protected RList updateEmptyPos(Object v, RNull value, int recLevel, RIntVector positions, RList vector) { return vector; } @Specialization(guards = {"isSubset", "!noPosition"}) - RList update(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RList vector) { + protected RList update(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RList vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } @@ -912,53 +912,53 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!isSubset", "multiPos"}) - Object access(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector p, RList vector) { + protected Object access(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector p, RList vector) { return updateListRecursive(frame, v, value, vector, recLevel, p); } @Specialization(guards = {"!isSubset", "multiPos"}) - Object access(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector p, RList vector) { + protected Object access(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector p, RList vector) { return updateListRecursive(frame, v, value, vector, recLevel, p); } @Specialization(guards = {"!isSubset", "inRecursion", "multiPos"}) - Object accessRecFailed(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector p, RAbstractVector vector) { + protected Object accessRecFailed(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector p, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.RECURSIVE_INDEXING_FAILED, recLevel + 1); } @Specialization(guards = {"!isSubset", "!multiPos"}) - Object accessSubscriptListValue(VirtualFrame frame, Object v, RList value, int recLevel, RIntVector p, RList vector) { + protected Object accessSubscriptListValue(VirtualFrame frame, Object v, RList value, int recLevel, RIntVector p, RList vector) { int position = getPositionInRecursion(frame, vector, p.getDataAt(0), recLevel, true); return updateSingleDimRec(frame, value, getResultVector(vector, position, false), p, recLevel); } @Specialization(guards = {"!isSubset", "inRecursion", "!multiPos"}) - Object accessSubscriptNullValueInRecursion(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector p, RList vector) { + protected Object accessSubscriptNullValueInRecursion(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector p, RList vector) { int position = getPositionInRecursion(frame, vector, p.getDataAt(0), recLevel, true); return removeElement(vector, position, true, false); } @Specialization(guards = {"!isSubset", "!inRecursion", "!multiPos"}) - Object accessSubscriptNullValue(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector p, RList vector) { + protected Object accessSubscriptNullValue(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector p, RList vector) { int position = getPositionInRecursion(frame, vector, p.getDataAt(0), recLevel, true); return removeElement(vector, position, false, false); } @Specialization(guards = {"!isSubset", "!multiPos"}) - Object accessSubscript(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector p, RList vector) { + protected Object accessSubscript(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, RIntVector p, RList vector) { int position = getPositionInRecursion(frame, vector, p.getDataAt(0), recLevel, true); return updateSingleDimRec(frame, value, getResultVector(vector, position, false), p, recLevel); } @Specialization(guards = {"!isValueLengthOne", "!emptyValue", "!isSubset", "!isPosNA", "!isPosZero"}) - RAbstractVector updateTooManyValues(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updateTooManyValues(VirtualFrame frame, Object v, RAbstractContainer value, int recLevel, int position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } // null value (with vectors) @Specialization(guards = {"isPosZero", "!isVectorList"}) - RAbstractVector updatePosZero(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector updatePosZero(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } @@ -966,7 +966,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!isPosZero", "!isPosNA", "!isVectorList"}) - RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RAbstractVector vector) { + protected RAbstractVector update(VirtualFrame frame, Object v, RNull value, int recLevel, int position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -975,37 +975,37 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"isSubset", "!isVectorList", "noPosition"}) - RAbstractVector updateNullSubsetNoPos(Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RAbstractVector updateNullSubsetNoPos(Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { return vector; } @Specialization(guards = {"isSubset", "!isVectorList", "!noPosition"}) - RAbstractVector updateNullSubset(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RAbstractVector updateNullSubset(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } @Specialization(guards = {"!isSubset", "!isVectorList", "noPosition"}) - RAbstractVector updateNullNoPos(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RAbstractVector updateNullNoPos(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } @Specialization(guards = {"!isSubset", "!isVectorList", "onePosition"}) - RAbstractVector updateNullOnePos(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RAbstractVector updateNullOnePos(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } @Specialization(guards = {"!isSubset", "!isVectorList", "twoPositions", "firstPosZero"}) - RAbstractVector updateNullTwoElemsZero(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RAbstractVector updateNullTwoElemsZero(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @Specialization(guards = {"!isSubset", "!isVectorList", "twoPositions", "!firstPosZero"}) - RAbstractVector updateNullTwoElems(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RAbstractVector updateNullTwoElems(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"!isSubset", "!isVectorList", "multiPos"}) - RAbstractVector updateNull(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RAbstractVector updateNull(VirtualFrame frame, Object v, RNull value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @@ -1124,89 +1124,89 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!isSubset", "!isVectorList", "!posNames", "!twoPositions"}) - Object update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected Object update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"!isSubset", "!isVectorList", "!posNames", "twoPositions", "firstPosZero"}) - RList updateTwoElemsZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RList updateTwoElemsZero(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } @Specialization(guards = {"!isSubset", "!isVectorList", "!posNames", "twoPositions", "!firstPosZero"}) - RList updateTwoElems(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RAbstractVector vector) { + protected RList updateTwoElems(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RIntVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, Object[] positions, RAbstractIntVector vector) { + protected RIntVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, Object[] positions, RAbstractIntVector vector) { return updateVector(frame, value, vector, positions); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RIntVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RAbstractIntVector vector) { + protected RIntVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RAbstractIntVector vector) { return updateVector(frame, (RIntVector) castInteger(frame, value), vector, positions); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractIntVector updateSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected RAbstractIntVector updateSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractIntVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected RAbstractIntVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractIntVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected RAbstractIntVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RIntVector updateTooManyValuesSubset(Object v, RAbstractIntVector value, int recLevel, int position, RAbstractIntVector vector) { + protected RIntVector updateTooManyValuesSubset(Object v, RAbstractIntVector value, int recLevel, int position, RAbstractIntVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RIntVector update(Object v, RAbstractIntVector value, int recLevel, int position, RAbstractIntVector vector) { + protected RIntVector update(Object v, RAbstractIntVector value, int recLevel, int position, RAbstractIntVector vector) { return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractIntVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected RAbstractIntVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateSingleDimVector(frame, (RIntVector) castInteger(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractIntVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected RAbstractIntVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateSingleDimVector(frame, (RIntVector) castInteger(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractIntVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { + protected RAbstractIntVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractIntVector vector) { return updateSingleDimVector(frame, (RIntVector) castInteger(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RIntVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractIntVector vector) { + protected RIntVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractIntVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim((RIntVector) castInteger(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RIntVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractIntVector vector) { + protected RIntVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractIntVector vector) { return updateSingleDim((RIntVector) castInteger(frame, value), getResultVector(vector, position), position); } @@ -1289,110 +1289,110 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RDoubleVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, Object[] positions, RAbstractDoubleVector vector) { + protected RDoubleVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, Object[] positions, RAbstractDoubleVector vector) { return updateVector(frame, (RDoubleVector) castDouble(frame, value), vector, positions); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RDoubleVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, Object[] positions, RAbstractDoubleVector vector) { + protected RDoubleVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, Object[] positions, RAbstractDoubleVector vector) { return updateVector(frame, value, vector, positions); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RDoubleVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RAbstractDoubleVector vector) { + protected RDoubleVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RAbstractDoubleVector vector) { return updateVector(frame, (RDoubleVector) castDouble(frame, value), vector, positions); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractDoubleVector updateSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector updateSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, (RDoubleVector) castDouble(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractDoubleVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, (RDoubleVector) castDouble(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractDoubleVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, (RDoubleVector) castDouble(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RDoubleVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RAbstractDoubleVector vector) { + protected RDoubleVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RAbstractDoubleVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim((RDoubleVector) castDouble(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RDoubleVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RAbstractDoubleVector vector) { + protected RDoubleVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RAbstractDoubleVector vector) { return updateSingleDim((RDoubleVector) castDouble(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractDoubleVector updateSubset(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector updateSubset(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractDoubleVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, (RDoubleVector) castDouble(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractDoubleVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RDoubleVector updateTooManyValuesSubset(Object v, RAbstractDoubleVector value, int recLevel, int position, RAbstractDoubleVector vector) { + protected RDoubleVector updateTooManyValuesSubset(Object v, RAbstractDoubleVector value, int recLevel, int position, RAbstractDoubleVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RDoubleVector update(Object v, RAbstractDoubleVector value, int recLevel, int position, RAbstractDoubleVector vector) { + protected RDoubleVector update(Object v, RAbstractDoubleVector value, int recLevel, int position, RAbstractDoubleVector vector) { return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractDoubleVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, (RDoubleVector) castDouble(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractDoubleVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, (RDoubleVector) castDouble(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractDoubleVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { + protected RAbstractDoubleVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RAbstractDoubleVector vector) { return updateSingleDimVector(frame, (RDoubleVector) castDouble(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RDoubleVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractDoubleVector vector) { + protected RDoubleVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractDoubleVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim((RDoubleVector) castDouble(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RDoubleVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractDoubleVector vector) { + protected RDoubleVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RAbstractDoubleVector vector) { return updateSingleDim((RDoubleVector) castDouble(frame, value), getResultVector(vector, position), position); } @@ -1472,38 +1472,38 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RLogicalVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RLogicalVector vector) { + protected RLogicalVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RLogicalVector vector) { return updateVector(frame, value, vector, positions); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractLogicalVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { + protected RAbstractLogicalVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractLogicalVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { + protected RAbstractLogicalVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractLogicalVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { + protected RAbstractLogicalVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RLogicalVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RLogicalVector updateTooManyValuesSubset(Object v, RAbstractLogicalVector value, int recLevel, int position, RLogicalVector vector) { + protected RLogicalVector updateTooManyValuesSubset(Object v, RAbstractLogicalVector value, int recLevel, int position, RLogicalVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RLogicalVector update(Object v, RAbstractLogicalVector value, int recLevel, int position, RLogicalVector vector) { + protected RLogicalVector update(Object v, RAbstractLogicalVector value, int recLevel, int position, RLogicalVector vector) { return updateSingleDim(value, getResultVector(vector, position), position); } @@ -1583,74 +1583,74 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RStringVector update(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, Object[] positions, RStringVector vector) { + protected RStringVector update(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, Object[] positions, RStringVector vector) { return updateVector(frame, value, vector, positions); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RStringVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, Object[] positions, RStringVector vector) { + protected RStringVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, Object[] positions, RStringVector vector) { return updateVector(frame, (RStringVector) castString(frame, value), vector, positions); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractStringVector updateSubset(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected RAbstractStringVector updateSubset(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractStringVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected RAbstractStringVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractStringVector update(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected RAbstractStringVector update(VirtualFrame frame, Object v, RAbstractStringVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RStringVector updateTooManyValuesSubset(Object v, RAbstractStringVector value, int recLevel, int position, RStringVector vector) { + protected RStringVector updateTooManyValuesSubset(Object v, RAbstractStringVector value, int recLevel, int position, RStringVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RStringVector update(Object v, RAbstractStringVector value, int recLevel, int position, RStringVector vector) { + protected RStringVector update(Object v, RAbstractStringVector value, int recLevel, int position, RStringVector vector) { return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractStringVector updateSubset(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected RAbstractStringVector updateSubset(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateSingleDimVector(frame, (RStringVector) castString(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractStringVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected RAbstractStringVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateSingleDimVector(frame, (RStringVector) castString(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractStringVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { + protected RAbstractStringVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RIntVector positions, RStringVector vector) { return updateSingleDimVector(frame, (RStringVector) castString(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RStringVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RStringVector vector) { + protected RStringVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RStringVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim((RStringVector) castString(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RStringVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RStringVector vector) { + protected RStringVector update(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, int position, RStringVector vector) { return updateSingleDim((RStringVector) castString(frame, value), getResultVector(vector, position), position); } @@ -1730,146 +1730,146 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, Object[] positions, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, Object[] positions, RComplexVector vector) { return updateVector(frame, (RComplexVector) castComplex(frame, value), vector, positions); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, Object[] positions, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, Object[] positions, RComplexVector vector) { return updateVector(frame, (RComplexVector) castComplex(frame, value), vector, positions); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, Object[] positions, RComplexVector vector) { return updateVector(frame, (RComplexVector) castComplex(frame, value), vector, positions); } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, Object[] positions, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, Object[] positions, RComplexVector vector) { return updateVector(frame, value, vector, positions); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RComplexVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(frame, (RComplexVector) castComplex(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractIntVector value, int recLevel, int position, RComplexVector vector) { return updateSingleDim(frame, (RComplexVector) castComplex(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, int position, RComplexVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(frame, (RComplexVector) castComplex(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractDoubleVector value, int recLevel, int position, RComplexVector vector) { return updateSingleDim(frame, (RComplexVector) castComplex(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, (RComplexVector) castComplex(frame, value), vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RComplexVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(frame, (RComplexVector) castComplex(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractLogicalVector value, int recLevel, int position, RComplexVector vector) { return updateSingleDim(frame, (RComplexVector) castComplex(frame, value), getResultVector(vector, position), position); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubset(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { + protected RAbstractComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, RIntVector positions, RComplexVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector updateTooManyValuesSubset(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, int position, RComplexVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(frame, value, getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, int position, RComplexVector vector) { + protected RComplexVector update(VirtualFrame frame, Object v, RAbstractComplexVector value, int recLevel, int position, RComplexVector vector) { return updateSingleDim(frame, value, getResultVector(vector, position), position); } @@ -1947,43 +1947,43 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiDim", "!wrongDimensionsMatrix", "!wrongDimensions"}) - RRawVector update(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, Object[] positions, RRawVector vector) { + protected RRawVector update(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, Object[] positions, RRawVector vector) { return updateVector(frame, value, vector, positions); } @Specialization(guards = {"isSubset", "!posNames", "multiPos"}) - RAbstractRawVector updateSubset(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { + protected RAbstractRawVector updateSubset(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"isSubset", "!posNames", "onePosition"}) - Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { + protected Object updateSubsetOne(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { return updateRecursive(frame, v, value, vector, positions.getDataAt(0), recLevel); } @Specialization(guards = {"isSubset", "posNames"}) - RAbstractRawVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { + protected RAbstractRawVector updateSubsetNames(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isSubset", "posNames"}) - RAbstractRawVector update(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { + protected RAbstractRawVector update(VirtualFrame frame, Object v, RAbstractRawVector value, int recLevel, RIntVector positions, RRawVector vector) { return updateSingleDimVector(frame, value, vector.getLength(), getResultVector(vector, getHighestPos(positions)), positions); } @Specialization(guards = {"!isValueLengthOne", "isSubset", "!isPosNA", "!isPosZero"}) - RRawVector updateTooManyValuesSubset(Object v, RAbstractRawVector value, int recLevel, int position, RRawVector vector) { + protected RRawVector updateTooManyValuesSubset(Object v, RAbstractRawVector value, int recLevel, int position, RRawVector vector) { RError.warning(RError.Message.NOT_MULTIPLE_REPLACEMENT); return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"isValueLengthOne", "!isPosNA", "!isPosZero"}) - RRawVector update(Object v, RAbstractRawVector value, int recLevel, int position, RRawVector vector) { + protected RRawVector update(Object v, RAbstractRawVector value, int recLevel, int position, RRawVector vector) { return updateSingleDim(value, getResultVector(vector, position), position); } @Specialization(guards = {"noPosition", "emptyValue"}) - Object accessListEmptyPosEmptyValueList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { + protected Object accessListEmptyPosEmptyValueList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -1992,7 +1992,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "emptyValue", "!isVectorList"}) - Object accessListEmptyPosEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListEmptyPosEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -2001,7 +2001,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "valueLengthOne"}) - Object accessListEmptyPosValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListEmptyPosValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -2010,7 +2010,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "valueLongerThanOne"}) - Object accessListEmptyPosValueLongerThanOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListEmptyPosValueLongerThanOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2019,7 +2019,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "noPosition") - Object accessListEmptyPosValueNullList(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RList vector) { + protected Object accessListEmptyPosValueNullList(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RList vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -2028,7 +2028,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "!isVectorList"}) - Object accessListEmptyPosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListEmptyPosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2037,12 +2037,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "emptyValue"}) - Object accessListOnePosEmptyValueList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { + protected Object accessListOnePosEmptyValueList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = {"onePosition", "emptyValue", "!isVectorList"}) - Object accessListOnePosEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListOnePosEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -2051,12 +2051,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLengthOne"}) - Object accessListOnePosValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListOnePosValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = {"onePosition", "valueLongerThanOne"}) - Object accessListOnePosValueLongerThanTwo(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListOnePosValueLongerThanTwo(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2065,12 +2065,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "onePosition") - Object accessListOnePosValueNullList(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RList vector) { + protected Object accessListOnePosValueNullList(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = {"onePosition", "!isVectorList"}) - Object accessListOnePosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListOnePosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2079,22 +2079,22 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "twoPositions") - Object accessListTwoPos(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListTwoPos(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = "twoPositions") - Object accessListTwoPosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListTwoPosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = {"moreThanTwoPos", "emptyValue"}) - Object accessListMultiPosEmptyValueList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { + protected Object accessListMultiPosEmptyValueList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = {"moreThanTwoPos", "emptyValue", "!isVectorList"}) - Object accessListMultiPosEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListMultiPosEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else { @@ -2103,12 +2103,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"moreThanTwoPos", "valueLengthOne"}) - Object accessListMultiPosValueLengthOneList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { + protected Object accessListMultiPosValueLengthOneList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = {"moreThanTwoPos", "valueLengthOne", "!isVectorList"}) - Object accessListMultiPosValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListMultiPosValueLengthOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else { @@ -2117,7 +2117,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"moreThanTwoPos", "valueLongerThanOne"}) - Object accessListMultiPos(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListMultiPos(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else { @@ -2126,12 +2126,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "moreThanTwoPos") - Object accessListMultiPosValueNullList(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RList vector) { + protected Object accessListMultiPosValueNullList(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } @Specialization(guards = {"moreThanTwoPos", "!isVectorList"}) - Object accessListMultiPosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { + protected Object accessListMultiPosValueNull(VirtualFrame frame, Object v, RNull value, int recLevel, RList positions, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else { @@ -2140,7 +2140,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"emptyValue", "!isVectorList"}) - Object accessComplexEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RAbstractVector vector) { + protected Object accessComplexEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -2149,7 +2149,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"valueLongerThanOne", "!isVectorList"}) - Object accessComplexValueLongerThanOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RAbstractVector vector) { + protected Object accessComplexValueLongerThanOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2158,17 +2158,17 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!valueLongerThanOne", "!emptyValue", "!isVectorList"}) - Object accessComplex(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RAbstractVector vector) { + protected Object accessComplex(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization - Object accessComplexList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RList vector) { + protected Object accessComplexList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RComplex position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization(guards = "!isVectorList") - Object accessComplex(VirtualFrame frame, Object v, RNull value, int recLevel, RComplex position, RAbstractVector vector) { + protected Object accessComplex(VirtualFrame frame, Object v, RNull value, int recLevel, RComplex position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2177,12 +2177,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - Object accessComplexList(VirtualFrame frame, Object v, RNull value, int recLevel, RComplex position, RList vector) { + protected Object accessComplexList(VirtualFrame frame, Object v, RNull value, int recLevel, RComplex position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization(guards = {"emptyValue", "!isVectorList"}) - Object accessRawEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RAbstractVector vector) { + protected Object accessRawEmptyValue(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -2191,7 +2191,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"valueLongerThanOne", "!isVectorList"}) - Object accessRawValueLongerThanOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RAbstractVector vector) { + protected Object accessRawValueLongerThanOne(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2200,17 +2200,17 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!valueLongerThanOne", "!emptyValue", "!isVectorList"}) - Object accessRaw(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RAbstractVector vector) { + protected Object accessRaw(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RAbstractVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @Specialization - Object accessRawList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RList vector) { + protected Object accessRawList(VirtualFrame frame, Object v, RAbstractVector value, int recLevel, RRaw position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @Specialization(guards = "!isVectorList") - Object accessRaw(VirtualFrame frame, Object v, RNull value, int recLevel, RRaw position, RAbstractVector vector) { + protected Object accessRaw(VirtualFrame frame, Object v, RNull value, int recLevel, RRaw position, RAbstractVector vector) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2219,7 +2219,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - Object accessRawList(VirtualFrame frame, Object v, RNull value, int recLevel, RRaw position, RList vector) { + protected Object accessRawList(VirtualFrame frame, Object v, RNull value, int recLevel, RRaw position, RList vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @@ -2475,7 +2475,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RList setData(VirtualFrame frame, RAbstractVector value, RList vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { + protected RList setData(VirtualFrame frame, RAbstractVector value, RList vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; int srcDimSize = srcDimensions[currentDimLevel - 1]; @@ -2507,7 +2507,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RIntVector setData(VirtualFrame frame, RAbstractIntVector value, RIntVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RIntVector setData(VirtualFrame frame, RAbstractIntVector value, RIntVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; @@ -2540,7 +2540,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RDoubleVector setData(VirtualFrame frame, RAbstractDoubleVector value, RDoubleVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RDoubleVector setData(VirtualFrame frame, RAbstractDoubleVector value, RDoubleVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; @@ -2573,7 +2573,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RLogicalVector setData(VirtualFrame frame, RAbstractLogicalVector value, RLogicalVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, + protected RLogicalVector setData(VirtualFrame frame, RAbstractLogicalVector value, RLogicalVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; @@ -2606,7 +2606,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RStringVector setData(VirtualFrame frame, RAbstractStringVector value, RStringVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RStringVector setData(VirtualFrame frame, RAbstractStringVector value, RStringVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; @@ -2639,7 +2639,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RComplexVector setData(VirtualFrame frame, RAbstractComplexVector value, RComplexVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, + protected RComplexVector setData(VirtualFrame frame, RAbstractComplexVector value, RComplexVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; @@ -2672,7 +2672,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RRawVector setData(VirtualFrame frame, RAbstractRawVector value, RRawVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, + protected RRawVector setData(VirtualFrame frame, RAbstractRawVector value, RRawVector vector, Object[] positions, int currentDimLevel, int srcArrayBase, int dstArrayBase, int accSrcDimensions, int accDstDimensions) { int[] srcDimensions = vector.getDimensions(); RIntVector p = (RIntVector) positions[currentDimLevel - 1]; @@ -2740,17 +2740,17 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!singlePosNegative", "!multiPos"}) - public RAbstractIntVector doIntVector(RNull vector, RNull value, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVector(RNull vector, RNull value, RAbstractIntVector positions) { return positions; } @Specialization(guards = {"!isPosVectorInt", "!multiPos"}) - public RAbstractVector doIntVector(RNull vector, RNull value, RAbstractVector positions) { + protected RAbstractVector doIntVector(RNull vector, RNull value, RAbstractVector positions) { return positions; } @Specialization(guards = {"!singlePosNegative", "multiPos"}) - public RAbstractIntVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RNull value, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RNull value, RAbstractIntVector positions) { if (isSubset) { return positions; } else { @@ -2759,7 +2759,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!isPosVectorInt", "multiPos"}) - public RAbstractVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RNull value, RAbstractVector positions) { + protected RAbstractVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RNull value, RAbstractVector positions) { if (isSubset) { return positions; } else { @@ -2768,17 +2768,17 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "!singlePosNegative", "!multiPos"}) - public RAbstractIntVector doIntVector(RNull vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVector(RNull vector, RAbstractVector value, RAbstractIntVector positions) { return positions; } @Specialization(guards = {"!emptyValue", "!isPosVectorInt", "!multiPos"}) - public RAbstractVector doIntVector(RNull vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector doIntVector(RNull vector, RAbstractVector value, RAbstractVector positions) { return positions; } @Specialization(guards = {"!emptyValue", "!singlePosNegative", "multiPos"}) - public RAbstractIntVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractIntVector positions) { if (isSubset) { return positions; } else { @@ -2787,7 +2787,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "!isPosVectorInt", "multiPos"}) - public RAbstractVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector doIntVectorMultiPos(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractVector positions) { if (isSubset) { return positions; } else { @@ -2796,12 +2796,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!emptyValue", "singlePosNegative"}) - public RAbstractIntVector doIntVectorNegative(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractIntVector doIntVectorNegative(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractIntVector positions) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } @Specialization(guards = "emptyValue") - public RAbstractVector doIntVectorEmptyValue(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector doIntVectorEmptyValue(VirtualFrame frame, RNull vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -2810,7 +2810,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"emptyValue", "!isVectorList"}) - Object accessComplexEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RComplex position) { + protected Object accessComplexEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RComplex position) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -2819,7 +2819,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"valueLongerThanOne", "!isVectorList"}) - Object accessComplexValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RComplex position) { + protected Object accessComplexValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RComplex position) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2828,22 +2828,22 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!valueLongerThanOne", "!emptyValue", "!isVectorList"}) - Object accessComplex(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RComplex position) { + protected Object accessComplex(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RComplex position) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization - Object accessComplexList(VirtualFrame frame, RList vector, RAbstractVector value, RComplex position) { + protected Object accessComplexList(VirtualFrame frame, RList vector, RAbstractVector value, RComplex position) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization - Object accessComplexList(VirtualFrame frame, RList vector, RNull value, RComplex position) { + protected Object accessComplexList(VirtualFrame frame, RList vector, RNull value, RComplex position) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "complex"); } @Specialization(guards = "!isVectorList") - Object accessComplex(VirtualFrame frame, RAbstractVector vector, RNull value, RComplex position) { + protected Object accessComplex(VirtualFrame frame, RAbstractVector vector, RNull value, RComplex position) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2852,7 +2852,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"emptyValue", "!isVectorList"}) - Object accessRawEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RRaw position) { + protected Object accessRawEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RRaw position) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -2861,7 +2861,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"valueLongerThanOne", "!isVectorList"}) - Object accessRawValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RRaw position) { + protected Object accessRawValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RRaw position) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2870,22 +2870,22 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"!valueLongerThanOne", "!emptyValue", "!isVectorList"}) - Object accessRaw(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RRaw position) { + protected Object accessRaw(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RRaw position) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @Specialization - Object accessRawList(VirtualFrame frame, RList vector, RAbstractVector value, RRaw position) { + protected Object accessRawList(VirtualFrame frame, RList vector, RAbstractVector value, RRaw position) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @Specialization - Object accessRawList(VirtualFrame frame, RList vector, RNull value, RRaw position) { + protected Object accessRawList(VirtualFrame frame, RList vector, RNull value, RRaw position) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "raw"); } @Specialization(guards = "!isVectorList") - Object accessRaw(VirtualFrame frame, RAbstractVector vector, RNull value, RRaw position) { + protected Object accessRaw(VirtualFrame frame, RAbstractVector vector, RNull value, RRaw position) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -2894,7 +2894,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "emptyValue"}) - RAbstractVector accessListEmptyPosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListEmptyPosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else if (positions.getElementClass() == Object.class) { @@ -2905,7 +2905,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "emptyValue", "!isVectorList"}) - RAbstractVector accessListEmptyPosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListEmptyPosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else if (positions.getElementClass() == Object.class) { @@ -2916,7 +2916,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "valueLengthOne"}) - RAbstractVector accessListEmptyPosValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListEmptyPosValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else if (positions.getElementClass() == Object.class) { @@ -2927,7 +2927,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "valueLongerThanOne"}) - RAbstractVector accessListEmptyPosValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListEmptyPosValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else if (positions.getElementClass() == Object.class) { @@ -2938,7 +2938,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "valueLongerThanOne", "!isVectorList"}) - RAbstractVector accessListEmptyPosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListEmptyPosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else if (positions.getElementClass() == Object.class) { @@ -2949,7 +2949,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "noPosition") - RAbstractVector accessListEmptyPosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractVector positions) { + protected RAbstractVector accessListEmptyPosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else if (positions.getElementClass() == Object.class) { @@ -2960,7 +2960,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"noPosition", "!isVectorList"}) - RAbstractVector accessListEmptyPosEmptyValue(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractVector positions) { + protected RAbstractVector accessListEmptyPosEmptyValue(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else if (positions.getElementClass() == Object.class) { @@ -2971,7 +2971,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "emptyValue", "!isPosVectorInt"}) - RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { if (positions.getElementClass() == Object.class) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } else { @@ -2980,7 +2980,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "emptyValue", "!firstPosZero"}) - RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { if (positions.getElementClass() == Object.class) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } else { @@ -2989,7 +2989,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "emptyValue", "firstPosZero"}) - RAbstractVector accessListOnePosZeroEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosZeroEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -2998,7 +2998,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "emptyValue", "!isVectorList", "!isPosVectorInt"}) - RAbstractVector accessListOnePosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListOnePosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else if (positions.getElementClass() == Object.class) { @@ -3009,7 +3009,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "emptyValue", "!isVectorList", "!firstPosZero"}) - RAbstractVector accessListOnePosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -3018,7 +3018,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "emptyValue", "!isVectorList", "firstPosZero"}) - RAbstractVector accessListOnePosZeroEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosZeroEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else { @@ -3027,7 +3027,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLengthOne", "!isPosVectorInt"}) - RAbstractVector accessListOnePosValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListOnePosValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (positions.getElementClass() == Object.class) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } else { @@ -3036,12 +3036,12 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLengthOne", "!firstPosZero"}) - RAbstractVector accessListOnePosValueLengthOne(RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosValueLengthOne(RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { return positions; } @Specialization(guards = {"onePosition", "valueLengthOne", "firstPosZero"}) - RAbstractVector accessListOnePosZeroValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosZeroValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -3050,7 +3050,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLongerThanOne", "!isPosVectorInt"}) - RAbstractVector accessListOnePosValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListOnePosValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { if (positions.getElementClass() == Object.class) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } else { @@ -3059,7 +3059,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLongerThanOne", "!firstPosZero"}) - RAbstractVector accessListOnePosValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { if (positions.getElementClass() == Object.class) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } else { @@ -3068,7 +3068,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLongerThanOne", "firstPosZero"}) - RAbstractVector accessListOnePosZeroValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosZeroValueLongerThanOneList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -3077,7 +3077,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLongerThanOne", "!isVectorList", "!isPosVectorInt"}) - RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else if (positions.getElementClass() == Object.class) { @@ -3088,7 +3088,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLongerThanOne", "!isVectorList", "!firstPosZero"}) - RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -3097,7 +3097,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "valueLongerThanOne", "!isVectorList", "firstPosZero"}) - RAbstractVector accessListOnePosZeroValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosZeroValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -3106,7 +3106,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "!isPosVectorInt"}) - RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractVector positions) { + protected RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractVector positions) { if (positions.getElementClass() == Object.class) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } else { @@ -3115,7 +3115,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "!firstPosZero"}) - RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractIntVector positions) { if (positions.getElementClass() == Object.class) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_SUBSCRIPT_TYPE, "list"); } else { @@ -3124,7 +3124,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "firstPosZero"}) - RAbstractVector accessListOnePosZeroEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosZeroEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_LESS_1); } else { @@ -3133,7 +3133,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "!isVectorList", "!isPosVectorInt"}) - RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractVector positions) { + protected RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else if (positions.getElementClass() == Object.class) { @@ -3144,7 +3144,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "!isVectorList", "!firstPosZero"}) - RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -3153,7 +3153,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"onePosition", "!isVectorList", "firstPosZero"}) - RAbstractVector accessListOnePosZeroValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractIntVector positions) { + protected RAbstractVector accessListOnePosZeroValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractIntVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else { @@ -3162,7 +3162,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "multiPos") - RAbstractVector accessListTwoPosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListTwoPosEmptyValueList(VirtualFrame frame, RList vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else if (positions.getElementClass() == Object.class) { @@ -3173,7 +3173,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiPos", "emptyValue", "!isVectorList"}) - RAbstractVector accessListTwoPosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListTwoPosEmptyValue(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.REPLACEMENT_0); } else if (positions.getElementClass() == Object.class) { @@ -3184,7 +3184,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiPos", "valueLengthOne", "!isVectorList"}) - RAbstractVector accessListTwoPosValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListTwoPosValueLengthOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else if (positions.getElementClass() == Object.class) { @@ -3195,7 +3195,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiPos", "valueLongerThanOne", "!isVectorList"}) - RAbstractVector accessListTwoPosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { + protected RAbstractVector accessListTwoPosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RAbstractVector value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else if (positions.getElementClass() == Object.class) { @@ -3206,7 +3206,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = "multiPos") - RAbstractVector accessListTwoPosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractVector positions) { + protected RAbstractVector accessListTwoPosEmptyValueList(VirtualFrame frame, RList vector, RNull value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SELECT_MORE_1); } else if (positions.getElementClass() == Object.class) { @@ -3217,7 +3217,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization(guards = {"multiPos", "!isVectorList"}) - RAbstractVector accessListTwoPosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractVector positions) { + protected RAbstractVector accessListTwoPosValueLongerThanOne(VirtualFrame frame, RAbstractVector vector, RNull value, RAbstractVector positions) { if (!isSubset) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.MORE_SUPPLIED_REPLACE); } else if (positions.getElementClass() == Object.class) { @@ -3391,257 +3391,257 @@ public abstract class UpdateArrayHelperNode extends RNode { } @Specialization - RFunction coerce(VirtualFrame frame, Object value, RFunction vector, Object operand) { + protected RFunction coerce(VirtualFrame frame, Object value, RFunction vector, Object operand) { return vector; } // int vector value @Specialization - RAbstractIntVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractIntVector vector, Object operand) { + protected RAbstractIntVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractIntVector vector, Object operand) { return vector; } @Specialization - RAbstractDoubleVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractDoubleVector vector, Object operand) { + protected RAbstractDoubleVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractDoubleVector vector, Object operand) { return vector; } @Specialization - RAbstractIntVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractLogicalVector vector, Object operand) { + protected RAbstractIntVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractLogicalVector vector, Object operand) { return (RIntVector) castInteger(frame, vector); } @Specialization - RAbstractStringVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractStringVector vector, Object operand) { + protected RAbstractStringVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractStringVector vector, Object operand) { return vector; } @Specialization - RAbstractComplexVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractComplexVector vector, Object operand) { + protected RAbstractComplexVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractComplexVector vector, Object operand) { return vector; } @Specialization - RIntVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractRawVector vector, Object operand) { + protected RIntVector coerce(VirtualFrame frame, RAbstractIntVector value, RAbstractRawVector vector, Object operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBASSIGN_TYPE_FIX, "integer", "raw"); } @Specialization - RList coerce(VirtualFrame frame, RAbstractIntVector value, RList vector, Object operand) { + protected RList coerce(VirtualFrame frame, RAbstractIntVector value, RList vector, Object operand) { return vector; } // double vector value @Specialization - RDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractIntVector vector, Object operand) { + protected RDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractIntVector vector, Object operand) { return (RDoubleVector) castDouble(frame, vector); } @Specialization - RAbstractDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractDoubleVector vector, Object operand) { + protected RAbstractDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractDoubleVector vector, Object operand) { return vector; } @Specialization - RDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractLogicalVector vector, Object operand) { + protected RDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractLogicalVector vector, Object operand) { return (RDoubleVector) castDouble(frame, vector); } @Specialization - RAbstractStringVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractStringVector vector, Object operand) { + protected RAbstractStringVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractStringVector vector, Object operand) { return vector; } @Specialization - RAbstractComplexVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractComplexVector vector, Object operand) { + protected RAbstractComplexVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractComplexVector vector, Object operand) { return vector; } @Specialization - RDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractRawVector vector, Object operand) { + protected RDoubleVector coerce(VirtualFrame frame, RAbstractDoubleVector value, RAbstractRawVector vector, Object operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBASSIGN_TYPE_FIX, "double", "raw"); } @Specialization - RList coerce(VirtualFrame frame, RAbstractDoubleVector value, RList vector, Object operand) { + protected RList coerce(VirtualFrame frame, RAbstractDoubleVector value, RList vector, Object operand) { return vector; } // logical vector value @Specialization - RAbstractIntVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractIntVector vector, Object operand) { + protected RAbstractIntVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractIntVector vector, Object operand) { return vector; } @Specialization - RAbstractDoubleVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractDoubleVector vector, Object operand) { + protected RAbstractDoubleVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractDoubleVector vector, Object operand) { return vector; } @Specialization - RAbstractLogicalVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractLogicalVector vector, Object operand) { + protected RAbstractLogicalVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractLogicalVector vector, Object operand) { return vector; } @Specialization - RAbstractStringVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractStringVector vector, Object operand) { + protected RAbstractStringVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractStringVector vector, Object operand) { return vector; } @Specialization - RAbstractComplexVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractComplexVector vector, Object operand) { + protected RAbstractComplexVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractComplexVector vector, Object operand) { return vector; } @Specialization - RLogicalVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractRawVector vector, Object operand) { + protected RLogicalVector coerce(VirtualFrame frame, RAbstractLogicalVector value, RAbstractRawVector vector, Object operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBASSIGN_TYPE_FIX, "logical", "raw"); } @Specialization - RList coerce(VirtualFrame frame, RAbstractLogicalVector value, RList vector, Object operand) { + protected RList coerce(VirtualFrame frame, RAbstractLogicalVector value, RList vector, Object operand) { return vector; } // string vector value @Specialization - RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractIntVector vector, Object operand) { + protected RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractIntVector vector, Object operand) { return (RStringVector) castString(frame, vector); } @Specialization - RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractDoubleVector vector, Object operand) { + protected RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractDoubleVector vector, Object operand) { return (RStringVector) castString(frame, vector); } @Specialization - RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractLogicalVector vector, Object operand) { + protected RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractLogicalVector vector, Object operand) { return (RStringVector) castString(frame, vector); } @Specialization - RAbstractStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractStringVector vector, Object operand) { + protected RAbstractStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractStringVector vector, Object operand) { return vector; } @Specialization - RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractComplexVector vector, Object operand) { + protected RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractComplexVector vector, Object operand) { return (RStringVector) castString(frame, vector); } @Specialization - RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractRawVector vector, Object operand) { + protected RStringVector coerce(VirtualFrame frame, RAbstractStringVector value, RAbstractRawVector vector, Object operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBASSIGN_TYPE_FIX, "character", "raw"); } @Specialization - RList coerce(VirtualFrame frame, RAbstractStringVector value, RList vector, Object operand) { + protected RList coerce(VirtualFrame frame, RAbstractStringVector value, RList vector, Object operand) { return vector; } // complex vector value @Specialization - RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractIntVector vector, Object operand) { + protected RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractIntVector vector, Object operand) { return (RComplexVector) castComplex(frame, vector); } @Specialization - RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractDoubleVector vector, Object operand) { + protected RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractDoubleVector vector, Object operand) { return (RComplexVector) castComplex(frame, vector); } @Specialization - RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractLogicalVector vector, Object operand) { + protected RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractLogicalVector vector, Object operand) { return (RComplexVector) castComplex(frame, vector); } @Specialization - RAbstractStringVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractStringVector vector, Object operand) { + protected RAbstractStringVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractStringVector vector, Object operand) { return vector; } @Specialization - RAbstractComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractComplexVector vector, Object operand) { + protected RAbstractComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractComplexVector vector, Object operand) { return vector; } @Specialization - RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractRawVector vector, Object operand) { + protected RComplexVector coerce(VirtualFrame frame, RAbstractComplexVector value, RAbstractRawVector vector, Object operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBASSIGN_TYPE_FIX, "complex", "raw"); } @Specialization - RList coerce(VirtualFrame frame, RAbstractComplexVector value, RList vector, Object operand) { + protected RList coerce(VirtualFrame frame, RAbstractComplexVector value, RList vector, Object operand) { return vector; } // raw vector value @Specialization - RAbstractRawVector coerce(VirtualFrame frame, RAbstractRawVector value, RAbstractRawVector vector, Object operand) { + protected RAbstractRawVector coerce(VirtualFrame frame, RAbstractRawVector value, RAbstractRawVector vector, Object operand) { return vector; } @Specialization(guards = "!isVectorList") - RRawVector coerce(VirtualFrame frame, RAbstractRawVector value, RAbstractVector vector, Object operand) { + protected RRawVector coerce(VirtualFrame frame, RAbstractRawVector value, RAbstractVector vector, Object operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBASSIGN_TYPE_FIX, "raw", RRuntime.classToString(vector.getElementClass(), false)); } @Specialization - RList coerce(VirtualFrame frame, RAbstractRawVector value, RList vector, Object operand) { + protected RList coerce(VirtualFrame frame, RAbstractRawVector value, RList vector, Object operand) { return vector; } // list vector value @Specialization - RList coerce(VirtualFrame frame, RList value, RList vector, Object operand) { + protected RList coerce(VirtualFrame frame, RList value, RList vector, Object operand) { return vector; } @Specialization(guards = "!isVectorList") - RList coerce(VirtualFrame frame, RList value, RAbstractVector vector, Object operand) { + protected RList coerce(VirtualFrame frame, RList value, RAbstractVector vector, Object operand) { return (RList) castList(frame, vector); } // data frame value @Specialization - RList coerce(VirtualFrame frame, RDataFrame value, RAbstractVector vector, Object operand) { + protected RList coerce(VirtualFrame frame, RDataFrame value, RAbstractVector vector, Object operand) { return (RList) castList(frame, vector); } // function vector value @Specialization - RFunction coerce(VirtualFrame frame, RFunction value, RAbstractVector vector, Object operand) { + protected RFunction coerce(VirtualFrame frame, RFunction value, RAbstractVector vector, Object operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.SUBASSIGN_TYPE_FIX, "closure", RRuntime.classToString(vector.getElementClass(), false)); } // in all other cases, simply return the vector (no coercion) @Specialization - RNull coerce(RNull value, RNull vector, Object operand) { + protected RNull coerce(RNull value, RNull vector, Object operand) { return vector; } @Specialization - RNull coerce(RAbstractVector value, RNull vector, Object operand) { + protected RNull coerce(RAbstractVector value, RNull vector, Object operand) { return vector; } @Specialization - RAbstractVector coerce(RNull value, RAbstractVector vector, Object operand) { + protected RAbstractVector coerce(RNull value, RAbstractVector vector, Object operand) { return vector; } @Specialization - RAbstractVector coerce(RList value, RAbstractVector vector, Object operand) { + protected RAbstractVector coerce(RList value, RAbstractVector vector, Object operand) { return vector; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateFieldNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateFieldNode.java index 8cb69e43d3f88d29c2efd1704872c4f35ac25adf..be86764e929aea20fe744751a6884115182ae477 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateFieldNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateFieldNode.java @@ -41,12 +41,12 @@ public abstract class UpdateFieldNode extends RNode { public abstract String getField(); - BranchProfile inexactMatch = new BranchProfile(); + private final BranchProfile inexactMatch = new BranchProfile(); @Child private CastListNode castList; @Specialization - public Object updateField(RList object, Object value) { + protected Object updateField(RList object, Object value) { int index = object.getElementIndexByName(getField()); if (index == -1) { inexactMatch.enter(); @@ -82,7 +82,7 @@ public abstract class UpdateFieldNode extends RNode { } @Specialization - public Object updateField(VirtualFrame frame, REnvironment env, Object value) { + protected Object updateField(VirtualFrame frame, REnvironment env, Object value) { // reference semantics for environments try { env.put(getField(), value); @@ -93,7 +93,7 @@ public abstract class UpdateFieldNode extends RNode { } @Specialization - public Object updateField(VirtualFrame frame, RAbstractVector object, Object value) { + protected Object updateField(VirtualFrame frame, RAbstractVector object, Object value) { if (castList == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); castList = insert(CastListNodeFactory.create(null, true, true, false)); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/VectorPositionCast.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/VectorPositionCast.java index f83bf9d618f30639a6c6a401a6ff60f75281aa4a..899f4559329d615a26600f838dc7b933388dd682 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/VectorPositionCast.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/VectorPositionCast.java @@ -43,7 +43,7 @@ public abstract class VectorPositionCast extends RNode { private final NACheck positionNACheck; @Specialization - public int doDoublePosition(double operand) { + protected int doDoublePosition(double operand) { positionNACheck.enable(operand); if (positionNACheck.check(operand)) { return RRuntime.INT_NA; @@ -52,19 +52,19 @@ public abstract class VectorPositionCast extends RNode { } @Specialization - public int doInt(int operand) { + protected int doInt(int operand) { positionNACheck.enable(operand); return operand; } @Specialization - public byte doBoolean(byte operand) { + protected byte doBoolean(byte operand) { positionNACheck.enable(operand); return operand; } @Specialization - public String doString(String operand) { + protected String doString(String operand) { positionNACheck.enable(operand); return operand; } @@ -79,59 +79,59 @@ public abstract class VectorPositionCast extends RNode { return ((int) stride == stride) && start >= 1.0; } - public static boolean greaterEqualOneSequence(RIntSequence operand) { + protected static boolean greaterEqualOneSequence(RIntSequence operand) { return operand.getStart() >= 1 && (operand.getStride() > 0 || operand.getEnd() > 0); } - public static boolean startingZeroSequence(RIntSequence operand) { + protected static boolean startingZeroSequence(RIntSequence operand) { return operand.getStart() == 0 && operand.getStride() > 0; } @Specialization(guards = "greaterEqualOneSequence") - public RIntSequence doIntVectorPositiveSequence(RIntSequence operand) { + protected RIntSequence doIntVectorPositiveSequence(RIntSequence operand) { return operand; } @Specialization(guards = "startingZeroSequence") - public RIntSequence doIntVectorPositiveIncludingZeroSequence(RIntSequence operand) { + protected RIntSequence doIntVectorPositiveIncludingZeroSequence(RIntSequence operand) { return operand.removeFirst(); } @Specialization(guards = {"!greaterEqualOneSequence", "!startingZeroSequence"}) - public RIntVector doIntVector(RIntSequence operand) { + protected RIntVector doIntVector(RIntSequence operand) { return (RIntVector) operand.createVector(); } @Specialization(guards = "canConvertIntSequence") - public RIntSequence doDoubleSequenceToIntConverstion(RDoubleSequence operand) { + protected RIntSequence doDoubleSequenceToIntConverstion(RDoubleSequence operand) { return RDataFactory.createIntSequence((int) operand.getStart(), (int) operand.getStride(), operand.getLength()); } @Specialization(guards = "!canConvertIntSequence") - public RIntVector doDoubleSequence(@SuppressWarnings("unused") RDoubleSequence operand) { + protected RIntVector doDoubleSequence(@SuppressWarnings("unused") RDoubleSequence operand) { throw Utils.nyi(); } @Specialization(guards = "sizeOneVector") - public int doIntVectorSizeOne(RIntVector operand) { + protected int doIntVectorSizeOne(RIntVector operand) { positionNACheck.enable(operand); return operand.getDataAt(0); } @Specialization(guards = "!sizeOneVector") - public RIntVector doIntVector(RIntVector operand) { + protected RIntVector doIntVector(RIntVector operand) { positionNACheck.enable(operand); return operand; } @Specialization - public RStringVector doIntVector(RStringVector operand) { + protected RStringVector doIntVector(RStringVector operand) { positionNACheck.enable(operand); return operand; } @Specialization - public RIntVector doDoubleVector(RDoubleVector operand) { + protected RIntVector doDoubleVector(RDoubleVector operand) { int dataLength = operand.getLength(); positionNACheck.enable(operand); int[] intData = new int[dataLength]; @@ -142,17 +142,17 @@ public abstract class VectorPositionCast extends RNode { } @Specialization - public RLogicalVector doLogicalVector(RLogicalVector operand) { + protected RLogicalVector doLogicalVector(RLogicalVector operand) { return operand; } @Specialization - public RMissing doMissing(RMissing missing) { + protected RMissing doMissing(RMissing missing) { return missing; } @Specialization - public int doNull(@SuppressWarnings("unused") RNull nul) { + protected int doNull(@SuppressWarnings("unused") RNull nul) { return 0; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableNode.java index e3a4feaf3b8346248de66e2929717e4794cf26c7..0cef42dacd6a92aff2d7f6e7d2fbc53d874deb8b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableNode.java @@ -49,11 +49,11 @@ public abstract class WriteVariableNode extends RNode implements VisibilityContr public abstract RNode getRhs(); - private BranchProfile everSeenNonEqual = new BranchProfile(); - private BranchProfile everSeenVector = new BranchProfile(); - private BranchProfile everSeenNonShared = new BranchProfile(); - private BranchProfile everSeenShared = new BranchProfile(); - private BranchProfile everSeenTemporary = new BranchProfile(); + private final BranchProfile everSeenNonEqual = new BranchProfile(); + private final BranchProfile everSeenVector = new BranchProfile(); + private final BranchProfile everSeenNonShared = new BranchProfile(); + private final BranchProfile everSeenShared = new BranchProfile(); + private final BranchProfile everSeenTemporary = new BranchProfile(); @Override public final boolean getVisibility() { @@ -158,25 +158,25 @@ public abstract class WriteVariableNode extends RNode implements VisibilityContr public abstract Mode getMode(); @Specialization - public byte doLogical(VirtualFrame frame, byte value) { + protected byte doLogical(VirtualFrame frame, byte value) { resolveAndSet(frame, value, FrameSlotKind.Byte); return value; } @Specialization - public int doInteger(VirtualFrame frame, int value) { + protected int doInteger(VirtualFrame frame, int value) { resolveAndSet(frame, value, FrameSlotKind.Int); return value; } @Specialization - public double doDouble(VirtualFrame frame, double value) { + protected double doDouble(VirtualFrame frame, double value) { resolveAndSet(frame, value, FrameSlotKind.Double); return value; } @Specialization - public Object doObject(VirtualFrame frame, Object value) { + protected Object doObject(VirtualFrame frame, Object value) { resolveAndSet(frame, value, FrameSlotKind.Object); return value; } @@ -198,28 +198,28 @@ public abstract class WriteVariableNode extends RNode implements VisibilityContr } @Specialization(guards = "isFrameBooleanKind") - public byte doLogical(VirtualFrame frame, FrameSlot frameSlot, byte value) { + protected byte doLogical(VirtualFrame frame, FrameSlot frameSlot, byte value) { controlVisibility(); frame.setByte(frameSlot, value); return value; } @Specialization(guards = "isFrameIntegerKind") - public int doInteger(VirtualFrame frame, FrameSlot frameSlot, int value) { + protected int doInteger(VirtualFrame frame, FrameSlot frameSlot, int value) { controlVisibility(); frame.setInt(frameSlot, value); return value; } @Specialization(guards = "isFrameDoubleKind") - public double doDouble(VirtualFrame frame, FrameSlot frameSlot, double value) { + protected double doDouble(VirtualFrame frame, FrameSlot frameSlot, double value) { controlVisibility(); frame.setDouble(frameSlot, value); return value; } @Specialization(guards = "isFrameObjectKind") - public Object doObject(VirtualFrame frame, FrameSlot frameSlot, Object value) { + protected Object doObject(VirtualFrame frame, FrameSlot frameSlot, Object value) { controlVisibility(); super.writeObjectValue(frame, frame, frameSlot, value, getMode(), false); return value; @@ -357,28 +357,28 @@ public abstract class WriteVariableNode extends RNode implements VisibilityContr public abstract Mode getMode(); @Specialization(guards = "isFrameBooleanKind") - public byte doBoolean(VirtualFrame frame, byte value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + protected byte doBoolean(VirtualFrame frame, byte value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { controlVisibility(); enclosingFrame.setByte(frameSlot, value); return value; } @Specialization(guards = "isFrameIntegerKind") - public int doInteger(VirtualFrame frame, int value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + protected int doInteger(VirtualFrame frame, int value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { controlVisibility(); enclosingFrame.setInt(frameSlot, value); return value; } @Specialization(guards = "isFrameDoubleKind") - public double doDouble(VirtualFrame frame, double value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + protected double doDouble(VirtualFrame frame, double value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { controlVisibility(); enclosingFrame.setDouble(frameSlot, value); return value; } @Specialization(guards = "isFrameObjectKind") - public Object doObject(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + protected Object doObject(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { controlVisibility(); super.writeObjectValue(frame, enclosingFrame, frameSlot, value, getMode(), true); return value; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryArithmeticNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryArithmeticNode.java index 94ee8776457e660a6876e167851e95a24584e130..3f2c20c73ab3bcacd48a1eac8b3250f05cdf62c0 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryArithmeticNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryArithmeticNode.java @@ -81,83 +81,83 @@ public abstract class BinaryArithmeticNode extends BinaryNode { } @Specialization - public Object doUnary(VirtualFrame frame, Object left, @SuppressWarnings("unused") RMissing right) { + protected Object doUnary(VirtualFrame frame, Object left, @SuppressWarnings("unused") RMissing right) { return doUnaryOp(frame, left); } @Specialization - public RDoubleVector doLeftNull(RNull left, RAbstractIntVector right) { + protected RDoubleVector doLeftNull(RNull left, RAbstractIntVector right) { return doRightNull(right, left); } @Specialization - public RDoubleVector doLeftNull(RNull left, RAbstractDoubleVector right) { + protected RDoubleVector doLeftNull(RNull left, RAbstractDoubleVector right) { return doRightNull(right, left); } @Specialization - public RDoubleVector doLeftNull(RNull left, RAbstractLogicalVector right) { + protected RDoubleVector doLeftNull(RNull left, RAbstractLogicalVector right) { return doRightNull(right, left); } @Specialization - public RComplexVector doLeftNull(RNull left, RAbstractComplexVector right) { + protected RComplexVector doLeftNull(RNull left, RAbstractComplexVector right) { return doRightNull(right, left); } @SuppressWarnings("unused") @Specialization - public RDoubleVector doRightNull(RAbstractIntVector left, RNull right) { + protected RDoubleVector doRightNull(RAbstractIntVector left, RNull right) { return RDataFactory.createEmptyDoubleVector(); } @SuppressWarnings("unused") @Specialization - public RDoubleVector doRightNull(RAbstractDoubleVector left, RNull right) { + protected RDoubleVector doRightNull(RAbstractDoubleVector left, RNull right) { return RDataFactory.createEmptyDoubleVector(); } @SuppressWarnings("unused") @Specialization - public RDoubleVector doRightNull(RAbstractLogicalVector left, RNull right) { + protected RDoubleVector doRightNull(RAbstractLogicalVector left, RNull right) { return RDataFactory.createEmptyDoubleVector(); } @SuppressWarnings("unused") @Specialization - public RComplexVector doRightNull(RAbstractComplexVector left, RNull right) { + protected RComplexVector doRightNull(RAbstractComplexVector left, RNull right) { return RDataFactory.createEmptyComplexVector(); } @SuppressWarnings("unused") @Specialization - public RDoubleVector doRightNull(RNull left, RNull right) { + protected RDoubleVector doRightNull(RNull left, RNull right) { return RDataFactory.createEmptyDoubleVector(); } @Specialization - public Object doLeftString(VirtualFrame frame, RAbstractStringVector left, Object right) { + protected Object doLeftString(VirtualFrame frame, RAbstractStringVector left, Object right) { return doRightString(frame, right, left); } @SuppressWarnings("unused") @Specialization - public Object doRightString(VirtualFrame frame, Object left, RAbstractStringVector right) { + protected Object doRightString(VirtualFrame frame, Object left, RAbstractStringVector right) { throw RError.error(frame, this.getSourceSection(), RError.Message.NON_NUMERIC_BINARY); } @Specialization - public Object doLeftRaw(VirtualFrame frame, RAbstractRawVector left, Object right) { + protected Object doLeftRaw(VirtualFrame frame, RAbstractRawVector left, Object right) { return doRightRaw(frame, right, left); } @SuppressWarnings("unused") @Specialization - public Object doRightRaw(VirtualFrame frame, Object left, RAbstractRawVector right) { + protected Object doRightRaw(VirtualFrame frame, Object left, RAbstractRawVector right) { throw RError.error(frame, this.getSourceSection(), RError.Message.NON_NUMERIC_BINARY); } - public boolean supportsIntResult() { + protected boolean supportsIntResult() { return arithmetic.isSupportsIntResult(); } @@ -169,7 +169,7 @@ public abstract class BinaryArithmeticNode extends BinaryNode { } @Specialization - public double doInt(int left, double right) { + protected double doInt(int left, double right) { return performArithmeticDoubleEnableNACheck(RRuntime.int2double(left), right); } @@ -179,37 +179,37 @@ public abstract class BinaryArithmeticNode extends BinaryNode { } @Specialization(guards = {"supportsIntResult"}) - public int doInt(int left, byte right) { + protected int doInt(int left, byte right) { return performArithmeticEnableNACheck(left, RRuntime.logical2int(right)); } @Specialization(guards = {"supportsIntResult"}) - public int doInt(byte left, int right) { + protected int doInt(byte left, int right) { return performArithmeticEnableNACheck(RRuntime.logical2int(left), right); } @Specialization - public RComplex doInt(VirtualFrame frame, int left, RComplex right) { + protected RComplex doInt(VirtualFrame frame, int left, RComplex right) { return performArithmeticComplexEnableNACheck(frame, RRuntime.int2complex(left), right); } @Specialization - public RComplex doInt(VirtualFrame frame, RComplex left, int right) { + protected RComplex doInt(VirtualFrame frame, RComplex left, int right) { return performArithmeticComplexEnableNACheck(frame, left, RRuntime.int2complex(right)); } @Specialization(guards = {"!supportsIntResult"}) - public double doIntDouble(int left, int right) { + protected double doIntDouble(int left, int right) { return performArithmeticIntIntDoubleEnableNACheck(left, right); } @Specialization(guards = {"!supportsIntResult"}) - public double doIntDouble(int left, byte right) { + protected double doIntDouble(int left, byte right) { return performArithmeticIntIntDoubleEnableNACheck(left, RRuntime.logical2int(right)); } @Specialization(guards = {"!supportsIntResult"}) - public double doIntDouble(byte left, int right) { + protected double doIntDouble(byte left, int right) { return performArithmeticIntIntDoubleEnableNACheck(RRuntime.logical2int(left), right); } @@ -221,44 +221,44 @@ public abstract class BinaryArithmeticNode extends BinaryNode { } @Specialization - public double doDouble(double left, byte right) { + protected double doDouble(double left, byte right) { return performArithmeticDoubleEnableNACheck(left, RRuntime.logical2double(right)); } @Specialization - public double doDouble(byte left, double right) { + protected double doDouble(byte left, double right) { return performArithmeticDoubleEnableNACheck(RRuntime.logical2double(left), right); } @Specialization - public RComplex doDouble(VirtualFrame frame, double left, RComplex right) { + protected RComplex doDouble(VirtualFrame frame, double left, RComplex right) { return performArithmeticComplexEnableNACheck(frame, RRuntime.double2complex(left), right); } @Specialization - public RComplex doDouble(VirtualFrame frame, RComplex left, double right) { + protected RComplex doDouble(VirtualFrame frame, RComplex left, double right) { return performArithmeticComplexEnableNACheck(frame, left, RRuntime.double2complex(right)); } // logical @Specialization(guards = {"supportsIntResult"}) - public int doLogical(byte left, byte right) { + protected int doLogical(byte left, byte right) { return performArithmeticEnableNACheck(RRuntime.logical2int(left), RRuntime.logical2int(right)); } @Specialization - public RComplex doLogical(VirtualFrame frame, byte left, RComplex right) { + protected RComplex doLogical(VirtualFrame frame, byte left, RComplex right) { return performArithmeticComplexEnableNACheck(frame, RRuntime.logical2complex(left), right); } @Specialization - public RComplex doLogical(VirtualFrame frame, RComplex left, byte right) { + protected RComplex doLogical(VirtualFrame frame, RComplex left, byte right) { return performArithmeticComplexEnableNACheck(frame, left, RRuntime.logical2complex(right)); } @Specialization(guards = {"!supportsIntResult"}) - public double doLogicalDouble(byte left, byte right) { + protected double doLogicalDouble(byte left, byte right) { return performArithmeticIntIntDoubleEnableNACheck(RRuntime.logical2int(left), RRuntime.logical2int(right)); } @@ -275,215 +275,215 @@ public abstract class BinaryArithmeticNode extends BinaryNode { @SuppressWarnings("unused") @Specialization(guards = "differentDimensions") - public RLogicalVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractVector left, RAbstractVector right) { + protected RLogicalVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractVector left, RAbstractVector right) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NON_CONFORMABLE_ARRAYS); } // int vector and vectors @Specialization(guards = {"!areSameLength", "supportsIntResult"}) - public RIntVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractIntVector right) { + protected RIntVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractIntVector right) { return performIntVectorOpDifferentLength(left, right); } @Specialization(guards = {"areSameLength", "supportsIntResult"}) - public RIntVector doIntVectorSameLength(RAbstractIntVector left, RAbstractIntVector right) { + protected RIntVector doIntVectorSameLength(RAbstractIntVector left, RAbstractIntVector right) { return performIntVectorOpSameLength(left, right); } @Specialization(guards = "!areSameLength") - public RDoubleVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractDoubleVector right) { + protected RDoubleVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractDoubleVector right) { return performDoubleVectorOpDifferentLength(RClosures.createIntToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RDoubleVector doIntVectorSameLength(RAbstractIntVector left, RAbstractDoubleVector right) { + protected RDoubleVector doIntVectorSameLength(RAbstractIntVector left, RAbstractDoubleVector right) { return performDoubleVectorOpSameLength(RClosures.createIntToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RDoubleVector doIntVectorDifferentLength(RAbstractDoubleVector left, RAbstractIntVector right) { + protected RDoubleVector doIntVectorDifferentLength(RAbstractDoubleVector left, RAbstractIntVector right) { return performDoubleVectorOpDifferentLength(left, RClosures.createIntToDoubleVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RDoubleVector doIntVectorIntVectorSameLength(RAbstractDoubleVector left, RAbstractIntVector right) { + protected RDoubleVector doIntVectorIntVectorSameLength(RAbstractDoubleVector left, RAbstractIntVector right) { return performDoubleVectorOpSameLength(left, RClosures.createIntToDoubleVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "supportsIntResult"}) - public RIntVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractLogicalVector right) { + protected RIntVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractLogicalVector right) { return performIntVectorOpDifferentLength(left, RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "supportsIntResult"}) - public RIntVector doIntVectorSameLength(RAbstractIntVector left, RAbstractLogicalVector right) { + protected RIntVector doIntVectorSameLength(RAbstractIntVector left, RAbstractLogicalVector right) { return performIntVectorOpSameLength(left, RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "supportsIntResult"}) - public RIntVector doIntVectorDifferentLength(RAbstractLogicalVector left, RAbstractIntVector right) { + protected RIntVector doIntVectorDifferentLength(RAbstractLogicalVector left, RAbstractIntVector right) { return performIntVectorOpDifferentLength(RClosures.createLogicalToIntVector(left, leftNACheck), right); } @Specialization(guards = {"areSameLength", "supportsIntResult"}) - public RIntVector doIntVectorSameLength(RAbstractLogicalVector left, RAbstractIntVector right) { + protected RIntVector doIntVectorSameLength(RAbstractLogicalVector left, RAbstractIntVector right) { return performIntVectorOpSameLength(RClosures.createLogicalToIntVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RComplexVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractIntVector left, RAbstractComplexVector right) { + protected RComplexVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractIntVector left, RAbstractComplexVector right) { return performComplexVectorOpDifferentLength(frame, RClosures.createIntToComplexVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RComplexVector doIntVectorSameLength(VirtualFrame frame, RAbstractIntVector left, RAbstractComplexVector right) { + protected RComplexVector doIntVectorSameLength(VirtualFrame frame, RAbstractIntVector left, RAbstractComplexVector right) { return performComplexVectorOpSameLength(frame, RClosures.createIntToComplexVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RComplexVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractIntVector right) { + protected RComplexVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractIntVector right) { return performComplexVectorOpDifferentLength(frame, left, RClosures.createIntToComplexVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RComplexVector doIntVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractIntVector right) { + protected RComplexVector doIntVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractIntVector right) { return performComplexVectorOpSameLength(frame, left, RClosures.createIntToComplexVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "!supportsIntResult"}) - public RDoubleVector doIntVectorDoubleDifferentLength(RAbstractIntVector left, RAbstractIntVector right) { + protected RDoubleVector doIntVectorDoubleDifferentLength(RAbstractIntVector left, RAbstractIntVector right) { return performIntVectorOpDoubleDifferentLength(left, right); } @Specialization(guards = {"areSameLength", "!supportsIntResult"}) - public RDoubleVector doIntVectorDoubleSameLength(RAbstractIntVector left, RAbstractIntVector right) { + protected RDoubleVector doIntVectorDoubleSameLength(RAbstractIntVector left, RAbstractIntVector right) { return performIntVectorOpDoubleSameLength(left, right); } @Specialization(guards = {"!areSameLength", "!supportsIntResult"}) - public RDoubleVector doIntVectorDoubleDifferentLength(RAbstractIntVector left, RAbstractLogicalVector right) { + protected RDoubleVector doIntVectorDoubleDifferentLength(RAbstractIntVector left, RAbstractLogicalVector right) { return performIntVectorOpDoubleDifferentLength(left, RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "!supportsIntResult"}) - public RDoubleVector doIntVectorDoubleSameLength(RAbstractIntVector left, RAbstractLogicalVector right) { + protected RDoubleVector doIntVectorDoubleSameLength(RAbstractIntVector left, RAbstractLogicalVector right) { return performIntVectorOpDoubleSameLength(left, RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "!supportsIntResult"}) - public RDoubleVector doIntVectorDoubleDifferentLength(RAbstractLogicalVector left, RAbstractIntVector right) { + protected RDoubleVector doIntVectorDoubleDifferentLength(RAbstractLogicalVector left, RAbstractIntVector right) { return performIntVectorOpDoubleDifferentLength(RClosures.createLogicalToIntVector(left, leftNACheck), right); } @Specialization(guards = {"areSameLength", "!supportsIntResult"}) - public RDoubleVector doIntVectorDoubleSameLength(RAbstractLogicalVector left, RAbstractIntVector right) { + protected RDoubleVector doIntVectorDoubleSameLength(RAbstractLogicalVector left, RAbstractIntVector right) { return performIntVectorOpDoubleSameLength(RClosures.createLogicalToIntVector(left, leftNACheck), right); } // double vector and vectors @Specialization(guards = "!areSameLength") - public RDoubleVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { + protected RDoubleVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { return performDoubleVectorOpDifferentLength(left, right); } @Specialization(guards = "areSameLength") - public RDoubleVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { + protected RDoubleVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { return performDoubleVectorOpSameLength(left, right); } @Specialization(guards = "!areSameLength") - public RDoubleVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { + protected RDoubleVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { return performDoubleVectorOpDifferentLength(left, RClosures.createLogicalToDoubleVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RDoubleVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { + protected RDoubleVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { return performDoubleVectorOpSameLength(left, RClosures.createLogicalToDoubleVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RDoubleVector doDoubleVectorDifferentLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { + protected RDoubleVector doDoubleVectorDifferentLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { return performDoubleVectorOpDifferentLength(RClosures.createLogicalToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RDoubleVector doDoubleVectorSameLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { + protected RDoubleVector doDoubleVectorSameLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { return performDoubleVectorOpSameLength(RClosures.createLogicalToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RComplexVector doDoubleVectorDifferentLength(VirtualFrame frame, RAbstractDoubleVector left, RAbstractComplexVector right) { + protected RComplexVector doDoubleVectorDifferentLength(VirtualFrame frame, RAbstractDoubleVector left, RAbstractComplexVector right) { return performComplexVectorOpDifferentLength(frame, RClosures.createDoubleToComplexVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RComplexVector doDoubleVectorSameLength(VirtualFrame frame, RAbstractDoubleVector left, RAbstractComplexVector right) { + protected RComplexVector doDoubleVectorSameLength(VirtualFrame frame, RAbstractDoubleVector left, RAbstractComplexVector right) { return performComplexVectorOpSameLength(frame, RClosures.createDoubleToComplexVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RComplexVector doDoubleVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractDoubleVector right) { + protected RComplexVector doDoubleVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractDoubleVector right) { return performComplexVectorOpDifferentLength(frame, left, RClosures.createDoubleToComplexVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RComplexVector doDoubleVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractDoubleVector right) { + protected RComplexVector doDoubleVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractDoubleVector right) { return performComplexVectorOpSameLength(frame, left, RClosures.createDoubleToComplexVector(right, rightNACheck)); } // logical vector and vectors @Specialization(guards = {"!areSameLength", "supportsIntResult"}) - public RIntVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { + protected RIntVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { return performIntVectorOpDifferentLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "supportsIntResult"}) - public RIntVector doLogicalVectorSameLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { + protected RIntVector doLogicalVectorSameLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { return performIntVectorOpSameLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RComplexVector doLogicalVectorDifferentLength(VirtualFrame frame, RAbstractLogicalVector left, RAbstractComplexVector right) { + protected RComplexVector doLogicalVectorDifferentLength(VirtualFrame frame, RAbstractLogicalVector left, RAbstractComplexVector right) { return performComplexVectorOpDifferentLength(frame, RClosures.createLogicalToComplexVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RComplexVector doLogicalVectorSameLength(VirtualFrame frame, RAbstractLogicalVector left, RAbstractComplexVector right) { + protected RComplexVector doLogicalVectorSameLength(VirtualFrame frame, RAbstractLogicalVector left, RAbstractComplexVector right) { return performComplexVectorOpSameLength(frame, RClosures.createLogicalToComplexVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RComplexVector doLogicalVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractLogicalVector right) { + protected RComplexVector doLogicalVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractLogicalVector right) { return performComplexVectorOpDifferentLength(frame, left, RClosures.createLogicalToComplexVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RComplexVector doLogicalVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractLogicalVector right) { + protected RComplexVector doLogicalVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractLogicalVector right) { return performComplexVectorOpSameLength(frame, left, RClosures.createLogicalToComplexVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "!supportsIntResult"}) - public RDoubleVector doLogicalVectorDoubleDifferentLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { + protected RDoubleVector doLogicalVectorDoubleDifferentLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { return performIntVectorOpDoubleDifferentLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "!supportsIntResult"}) - public RDoubleVector doLogicalVectorDoubleSameLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { + protected RDoubleVector doLogicalVectorDoubleSameLength(RAbstractLogicalVector left, RAbstractLogicalVector right) { return performIntVectorOpDoubleSameLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } // complex vector and vectors @Specialization(guards = "!areSameLength") - public RComplexVector doComplexVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractComplexVector right) { + protected RComplexVector doComplexVectorDifferentLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractComplexVector right) { return performComplexVectorOpDifferentLength(frame, left, right); } @Specialization(guards = "areSameLength") - public RComplexVector doComplexVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractComplexVector right) { + protected RComplexVector doComplexVectorSameLength(VirtualFrame frame, RAbstractComplexVector left, RAbstractComplexVector right) { return performComplexVectorOpSameLength(frame, left, right); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java index ec8dcb36f6eeea0312083d5c5a1ada4664f6636e..fceb1f7ef747c5b984b967c39585e78216ef4891 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java @@ -61,79 +61,79 @@ public abstract class BinaryBooleanNode extends BinaryNode { // empty raw vectors @Specialization(guards = {"isEmpty", "expectLogical"}) - public RLogicalVector doEmptyLogical(RRawVector left, RRaw right) { + protected RLogicalVector doEmptyLogical(RRawVector left, RRaw right) { return RDataFactory.createLogicalVector(0); } @Specialization(guards = {"isEmpty", "expectLogical"}) - public RLogicalVector doEmptyLogical(RRaw left, RRawVector right) { + protected RLogicalVector doEmptyLogical(RRaw left, RRawVector right) { return RDataFactory.createLogicalVector(0); } @Specialization(guards = {"isEmpty", "!expectLogical"}) - public RRawVector doEmptyRaw(RRawVector left, RRaw right) { + protected RRawVector doEmptyRaw(RRawVector left, RRaw right) { return RDataFactory.createRawVector(0); } @Specialization(guards = {"isEmpty", "!expectLogical"}) - public RRawVector doEmptyRaw(RRaw left, RRawVector right) { + protected RRawVector doEmptyRaw(RRaw left, RRawVector right) { return RDataFactory.createRawVector(0); } @Specialization(guards = {"isEmpty", "expectLogical"}) - public RLogicalVector doEmptyLogical(RRawVector left, RRawVector right) { + protected RLogicalVector doEmptyLogical(RRawVector left, RRawVector right) { return RDataFactory.createLogicalVector(0); } @Specialization(guards = {"isEmpty", "!expectLogical"}) - public RRawVector doEmptyRaw(RRawVector left, RRawVector right) { + protected RRawVector doEmptyRaw(RRawVector left, RRawVector right) { return RDataFactory.createRawVector(0); } // int @Specialization - public byte doInt(int left, int right) { + protected byte doInt(int left, int right) { return logic.op(left, right); } @Specialization - public byte doInt(int left, double right) { + protected byte doInt(int left, double right) { return logic.op(RRuntime.int2double(left), right); } @Specialization - public byte doInt(double left, int right) { + protected byte doInt(double left, int right) { return logic.op(left, RRuntime.int2double(right)); } @Specialization - public byte doInt(int left, byte right) { + protected byte doInt(int left, byte right) { return logic.op(left, RRuntime.logical2int(right)); } @Specialization - public byte doInt(byte left, int right) { + protected byte doInt(byte left, int right) { return logic.op(RRuntime.logical2int(left), right); } @Specialization - public byte doInt(int left, String right) { + protected byte doInt(int left, String right) { return logic.op(RRuntime.intToString(left, false), right); } @Specialization - public byte doInt(String left, int right) { + protected byte doInt(String left, int right) { return logic.op(left, RRuntime.intToString(right, false)); } @Specialization - public byte doInt(int left, RComplex right) { + protected byte doInt(int left, RComplex right) { return logic.op(RRuntime.int2complex(left), right); } @Specialization - public byte doInt(RComplex left, int right) { + protected byte doInt(RComplex left, int right) { return logic.op(left, RRuntime.int2complex(right)); } @@ -145,546 +145,546 @@ public abstract class BinaryBooleanNode extends BinaryNode { } @Specialization - public byte doDouble(double left, byte right) { + protected byte doDouble(double left, byte right) { return logic.op(left, RRuntime.logical2double(right)); } @Specialization - public byte doDouble(byte left, double right) { + protected byte doDouble(byte left, double right) { return logic.op(RRuntime.logical2double(left), right); } @Specialization - public byte doDouble(double left, String right) { + protected byte doDouble(double left, String right) { return logic.op(RRuntime.doubleToString(left), right); } @Specialization - public byte doDouble(String left, double right) { + protected byte doDouble(String left, double right) { return logic.op(left, RRuntime.doubleToString(right)); } @Specialization - public byte doDouble(double left, RComplex right) { + protected byte doDouble(double left, RComplex right) { return logic.op(RRuntime.double2complex(left), right); } @Specialization - public byte doDouble(RComplex left, double right) { + protected byte doDouble(RComplex left, double right) { return logic.op(left, RRuntime.double2complex(right)); } @Specialization(guards = "convertRawToNumericObject") - public byte doDouble(double left, RRaw right) { + protected byte doDouble(double left, RRaw right) { return logic.op(left, RRuntime.raw2double(right)); } @Specialization(guards = "convertRawToNumericObject") - public byte doDouble(RRaw left, double right) { + protected byte doDouble(RRaw left, double right) { return logic.op(RRuntime.raw2double(left), right); } // logical @Specialization - public byte doLogical(byte left, byte right) { + protected byte doLogical(byte left, byte right) { return logic.op(RRuntime.logical2int(left), RRuntime.logical2int(right)); } @Specialization - public byte doBoolean(byte left, String right) { + protected byte doBoolean(byte left, String right) { return logic.op(RRuntime.logicalToString(left), right); } @Specialization - public byte doBoolean(String left, byte right) { + protected byte doBoolean(String left, byte right) { return logic.op(left, RRuntime.logicalToString(right)); } @Specialization - public byte doLogical(byte left, RComplex right) { + protected byte doLogical(byte left, RComplex right) { return logic.op(RRuntime.logical2complex(left), right); } @Specialization - public byte doLogical(RComplex left, byte right) { + protected byte doLogical(RComplex left, byte right) { return logic.op(left, RRuntime.logical2complex(right)); } @Specialization(guards = "convertRawToNumericObject") - public byte doLogical(byte left, RRaw right) { + protected byte doLogical(byte left, RRaw right) { return logic.op(left, RRuntime.raw2int(right)); } @Specialization(guards = "convertRawToNumericObject") - public byte doLogical(RRaw left, byte right) { + protected byte doLogical(RRaw left, byte right) { return logic.op(RRuntime.raw2int(left), right); } // string @Specialization - public byte doString(String left, String right) { + protected byte doString(String left, String right) { return logic.op(left, right); } @Specialization - public byte doString(String left, RComplex right) { + protected byte doString(String left, RComplex right) { return logic.op(left, RRuntime.complexToString(right)); } @Specialization - public byte doString(RComplex left, String right) { + protected byte doString(RComplex left, String right) { return logic.op(RRuntime.complexToString(left), right); } @Specialization(guards = "convertRawToNumericObject") - public byte doString(String left, RRaw right) { + protected byte doString(String left, RRaw right) { return logic.op(left, RRuntime.rawToString(right)); } @Specialization(guards = "convertRawToNumericObject") - public byte doString(RRaw left, String right) { + protected byte doString(RRaw left, String right) { return logic.op(RRuntime.rawToString(left), right); } // complex @Specialization - public byte doComplex(RComplex left, RComplex right) { + protected byte doComplex(RComplex left, RComplex right) { return logic.op(left, right); } @Specialization(guards = "convertRawToNumericObject") - public byte doComplex(RComplex left, RRaw right) { + protected byte doComplex(RComplex left, RRaw right) { return logic.op(left, RRuntime.raw2complex(right)); } @Specialization(guards = "convertRawToNumericObject") - public byte doComplex(RRaw left, RComplex right) { + protected byte doComplex(RRaw left, RComplex right) { return logic.op(RRuntime.raw2complex(left), right); } // raw @Specialization(guards = "!convertRawToNumeric") - public RRaw doRawRaw(RRaw left, RRaw right) { + protected RRaw doRawRaw(RRaw left, RRaw right) { return logic.op(left, right); } @Specialization(guards = "convertRawToNumeric") - public byte doRawLogical(RRaw left, RRaw right) { + protected byte doRawLogical(RRaw left, RRaw right) { return logic.op(RRuntime.raw2int(left), RRuntime.raw2int(right)); } // null @Specialization - public RLogicalVector doNull(RNull left, Object right) { + protected RLogicalVector doNull(RNull left, Object right) { return RDataFactory.createLogicalVector(0); } @Specialization - public RLogicalVector doNull(Object left, RNull right) { + protected RLogicalVector doNull(Object left, RNull right) { return RDataFactory.createLogicalVector(0); } // empty vectors @Specialization(guards = "isEmpty") - public RLogicalVector doEmpty(RAbstractVector left, Object right) { + protected RLogicalVector doEmpty(RAbstractVector left, Object right) { return RDataFactory.createLogicalVector(0); } @Specialization(guards = "isEmpty") - public RLogicalVector doEmpty(Object left, RAbstractVector right) { + protected RLogicalVector doEmpty(Object left, RAbstractVector right) { return RDataFactory.createLogicalVector(0); } // int vector and scalar @Specialization - public RLogicalVector doIntVectorOp(RAbstractIntVector left, int right) { + protected RLogicalVector doIntVectorOp(RAbstractIntVector left, int right) { return performIntVectorOp(left, RRuntime.int2double(right), false); } @Specialization - public RLogicalVector doIntVectorOp(int left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorOp(int left, RAbstractIntVector right) { return performIntVectorOp(right, RRuntime.int2double(left), true); } @Specialization - public RLogicalVector doIntVectorOp(RAbstractIntVector left, double right) { + protected RLogicalVector doIntVectorOp(RAbstractIntVector left, double right) { return performIntVectorOp(left, right, false); } @Specialization - public RLogicalVector doIntVectorOp(double left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorOp(double left, RAbstractIntVector right) { return performIntVectorOp(right, left, true); } @Specialization - public RLogicalVector doIntVectorOp(RAbstractIntVector left, byte right) { + protected RLogicalVector doIntVectorOp(RAbstractIntVector left, byte right) { return performIntVectorOp(left, RRuntime.logical2double(right), false); } @Specialization - public RLogicalVector doIntVectorOp(byte left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorOp(byte left, RAbstractIntVector right) { return performIntVectorOp(right, RRuntime.logical2double(left), true); } @Specialization - public RLogicalVector doIntVectorOp(RAbstractIntVector left, String right) { + protected RLogicalVector doIntVectorOp(RAbstractIntVector left, String right) { return performIntVectorOp(left, right, false); } @Specialization - public RLogicalVector doIntVectorOp(String left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorOp(String left, RAbstractIntVector right) { return performIntVectorOp(right, left, true); } @Specialization - public RLogicalVector doIntVectorOp(RAbstractIntVector left, RComplex right) { + protected RLogicalVector doIntVectorOp(RAbstractIntVector left, RComplex right) { return performIntVectorOp(left, right, false); } @Specialization - public RLogicalVector doIntVectorOp(RComplex left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorOp(RComplex left, RAbstractIntVector right) { return performIntVectorOp(right, left, true); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doIntVectorOp(RAbstractIntVector left, RRaw right) { + protected RLogicalVector doIntVectorOp(RAbstractIntVector left, RRaw right) { return performIntVectorOp(left, RRuntime.raw2double(right), false); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doIntVectorOp(RRaw left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorOp(RRaw left, RAbstractIntVector right) { return performIntVectorOp(right, RRuntime.raw2double(left), true); } // double vector and scalar @Specialization - public RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, int right) { + protected RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, int right) { return performDoubleVectorOp(left, RRuntime.int2double(right), false); } @Specialization - public RLogicalVector doDoubleVectorOp(int left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorOp(int left, RAbstractDoubleVector right) { return performDoubleVectorOp(right, RRuntime.int2double(left), true); } @Specialization - public RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, double right) { + protected RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, double right) { return performDoubleVectorOp(left, right, false); } @Specialization - public RLogicalVector doDoubleVectorOp(double left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorOp(double left, RAbstractDoubleVector right) { return performDoubleVectorOp(right, left, true); } @Specialization - public RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, byte right) { + protected RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, byte right) { return performDoubleVectorOp(left, RRuntime.logical2double(right), false); } @Specialization - public RLogicalVector doDoubleVectorOp(byte left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorOp(byte left, RAbstractDoubleVector right) { return performDoubleVectorOp(right, RRuntime.logical2double(left), true); } @Specialization - public RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, String right) { + protected RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, String right) { return performDoubleVectorOp(left, right, false); } @Specialization - public RLogicalVector doDoubleVectorOp(String left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorOp(String left, RAbstractDoubleVector right) { return performDoubleVectorOp(right, left, true); } @Specialization - public RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, RComplex right) { + protected RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, RComplex right) { return performDoubleVectorOp(left, right, false); } @Specialization - public RLogicalVector doDoubleVectorOp(RComplex left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorOp(RComplex left, RAbstractDoubleVector right) { return performDoubleVectorOp(right, left, true); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, RRaw right) { + protected RLogicalVector doDoubleVectorOp(RAbstractDoubleVector left, RRaw right) { return performDoubleVectorOp(left, RRuntime.raw2double(right), false); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doDoubleVectorOp(RRaw left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorOp(RRaw left, RAbstractDoubleVector right) { return performDoubleVectorOp(right, RRuntime.raw2double(left), true); } // logical vector and scalar @Specialization - public RLogicalVector doLogicalVectorOp(RLogicalVector left, int right) { + protected RLogicalVector doLogicalVectorOp(RLogicalVector left, int right) { return performLogicalVectorOp(left, RRuntime.int2double(right), false); } @Specialization - public RLogicalVector doLogicalVectorOp(int left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorOp(int left, RLogicalVector right) { return performLogicalVectorOp(right, RRuntime.int2double(left), true); } @Specialization - public RLogicalVector doLogicalVectorOp(RLogicalVector left, double right) { + protected RLogicalVector doLogicalVectorOp(RLogicalVector left, double right) { return performLogicalVectorOp(left, right, false); } @Specialization - public RLogicalVector doLogicalVectorOp(double left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorOp(double left, RLogicalVector right) { return performLogicalVectorOp(right, left, true); } @Specialization - public RLogicalVector doLogicalVectorOp(RLogicalVector left, byte right) { + protected RLogicalVector doLogicalVectorOp(RLogicalVector left, byte right) { return performLogicalVectorOp(left, RRuntime.logical2int(right), false); } @Specialization - public RLogicalVector doLogicalVectorOp(byte left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorOp(byte left, RLogicalVector right) { return performLogicalVectorOp(right, RRuntime.logical2double(left), true); } @Specialization - public RLogicalVector doLogicalVectorOp(RLogicalVector left, String right) { + protected RLogicalVector doLogicalVectorOp(RLogicalVector left, String right) { return performLogicalVectorOp(left, right, false); } @Specialization - public RLogicalVector doLogicalVectorOp(String left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorOp(String left, RLogicalVector right) { return performLogicalVectorOp(right, left, true); } @Specialization - public RLogicalVector doLogicalVectorOp(RLogicalVector left, RComplex right) { + protected RLogicalVector doLogicalVectorOp(RLogicalVector left, RComplex right) { return performLogicalVectorOp(left, right, false); } @Specialization - public RLogicalVector doLogicalVectorOp(RComplex left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorOp(RComplex left, RLogicalVector right) { return performLogicalVectorOp(right, left, true); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doLogicalVectorOp(RLogicalVector left, RRaw right) { + protected RLogicalVector doLogicalVectorOp(RLogicalVector left, RRaw right) { return performLogicalVectorOp(left, RRuntime.raw2double(right), false); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doLogicalVectorOp(RRaw left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorOp(RRaw left, RLogicalVector right) { return performLogicalVectorOp(right, RRuntime.raw2double(left), true); } // string vector and scalar @Specialization - public RLogicalVector doStringVectorOp(RStringVector left, int right) { + protected RLogicalVector doStringVectorOp(RStringVector left, int right) { return performStringVectorOp(left, RRuntime.intToString(right, false), false); } @Specialization - public RLogicalVector doStringVectorOp(int left, RStringVector right) { + protected RLogicalVector doStringVectorOp(int left, RStringVector right) { return performStringVectorOp(right, RRuntime.intToString(left, false), true); } @Specialization - public RLogicalVector doStringVectorOp(RStringVector left, double right) { + protected RLogicalVector doStringVectorOp(RStringVector left, double right) { return performStringVectorOp(left, RRuntime.doubleToString(right), false); } @Specialization - public RLogicalVector doStringVectorOp(double left, RStringVector right) { + protected RLogicalVector doStringVectorOp(double left, RStringVector right) { return performStringVectorOp(right, RRuntime.doubleToString(left), true); } @Specialization - public RLogicalVector doStringVectorOp(RStringVector left, byte right) { + protected RLogicalVector doStringVectorOp(RStringVector left, byte right) { return performStringVectorOp(left, RRuntime.logicalToString(right), false); } @Specialization - public RLogicalVector doStringVectorOp(byte left, RStringVector right) { + protected RLogicalVector doStringVectorOp(byte left, RStringVector right) { return performStringVectorOp(right, RRuntime.logicalToString(left), false); } @Specialization - public RLogicalVector doStringVectorOp(RStringVector left, String right) { + protected RLogicalVector doStringVectorOp(RStringVector left, String right) { return performStringVectorOp(left, right, false); } @Specialization - public RLogicalVector doStringVectorOp(String left, RStringVector right) { + protected RLogicalVector doStringVectorOp(String left, RStringVector right) { return performStringVectorOp(right, left, true); } @Specialization - public RLogicalVector doStringVectorOp(RStringVector left, RComplex right) { + protected RLogicalVector doStringVectorOp(RStringVector left, RComplex right) { return performStringVectorOp(left, RRuntime.complexToString(right), false); } @Specialization - public RLogicalVector doStringVectorOp(RComplex left, RStringVector right) { + protected RLogicalVector doStringVectorOp(RComplex left, RStringVector right) { return performStringVectorOp(right, RRuntime.complexToString(left), true); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doStringVectorOp(RStringVector left, RRaw right) { + protected RLogicalVector doStringVectorOp(RStringVector left, RRaw right) { return performStringVectorOp(left, RRuntime.rawToString(right), false); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doStringVectorOp(RRaw left, RStringVector right) { + protected RLogicalVector doStringVectorOp(RRaw left, RStringVector right) { return performStringVectorOp(right, RRuntime.rawToString(left), true); } // complex vector and scalar @Specialization - public RLogicalVector doComplexVectorOp(RComplexVector left, int right) { + protected RLogicalVector doComplexVectorOp(RComplexVector left, int right) { return performComplexVectorOp(left, RRuntime.int2complex(right), false); } @Specialization - public RLogicalVector doComplexVectorOp(int left, RComplexVector right) { + protected RLogicalVector doComplexVectorOp(int left, RComplexVector right) { return performComplexVectorOp(right, RRuntime.int2complex(left), true); } @Specialization - public RLogicalVector doComplexVectorOp(RComplexVector left, double right) { + protected RLogicalVector doComplexVectorOp(RComplexVector left, double right) { return performComplexVectorOp(left, RRuntime.double2complex(right), false); } @Specialization - public RLogicalVector doComplexVectorOp(double left, RComplexVector right) { + protected RLogicalVector doComplexVectorOp(double left, RComplexVector right) { return performComplexVectorOp(right, RRuntime.double2complex(left), true); } @Specialization - public RLogicalVector doComplexVectorOp(RComplexVector left, byte right) { + protected RLogicalVector doComplexVectorOp(RComplexVector left, byte right) { return performComplexVectorOp(left, RRuntime.logical2complex(right), false); } @Specialization - public RLogicalVector doComplexVectorOp(byte left, RComplexVector right) { + protected RLogicalVector doComplexVectorOp(byte left, RComplexVector right) { return performComplexVectorOp(right, RRuntime.logical2complex(left), true); } @Specialization - public RLogicalVector doComplexVectorOp(RComplexVector left, String right) { + protected RLogicalVector doComplexVectorOp(RComplexVector left, String right) { return performComplexVectorOp(left, right, false); } @Specialization - public RLogicalVector doComplexVectorOp(String left, RComplexVector right) { + protected RLogicalVector doComplexVectorOp(String left, RComplexVector right) { return performComplexVectorOp(right, left, true); } @Specialization - public RLogicalVector doComplexVectorOp(RComplexVector left, RComplex right) { + protected RLogicalVector doComplexVectorOp(RComplexVector left, RComplex right) { return performComplexVectorOp(left, right, false); } @Specialization - public RLogicalVector doComplexVectorOp(RComplex left, RComplexVector right) { + protected RLogicalVector doComplexVectorOp(RComplex left, RComplexVector right) { return performComplexVectorOp(right, left, true); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doComplexVectorOp(RComplexVector left, RRaw right) { + protected RLogicalVector doComplexVectorOp(RComplexVector left, RRaw right) { return performComplexVectorOp(left, RRuntime.raw2complex(right), false); } @Specialization(guards = "convertRawToNumericVector") - public RLogicalVector doComplexVectorOp(RRaw left, RComplexVector right) { + protected RLogicalVector doComplexVectorOp(RRaw left, RComplexVector right) { return performComplexVectorOp(right, RRuntime.raw2complex(left), true); } // raw vector and scalar @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(RRawVector left, int right) { + protected RLogicalVector doRawVectorOp(RRawVector left, int right) { return performRawVectorOp(left, RRuntime.int2double(right), false); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(int left, RRawVector right) { + protected RLogicalVector doRawVectorOp(int left, RRawVector right) { return performRawVectorOp(right, RRuntime.int2double(left), true); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(RRawVector left, double right) { + protected RLogicalVector doRawVectorOp(RRawVector left, double right) { return performRawVectorOp(left, right, false); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(double left, RRawVector right) { + protected RLogicalVector doRawVectorOp(double left, RRawVector right) { return performRawVectorOp(right, left, true); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(RRawVector left, byte right) { + protected RLogicalVector doRawVectorOp(RRawVector left, byte right) { return performRawVectorOp(left, RRuntime.logical2int(right), false); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(byte left, RRawVector right) { + protected RLogicalVector doRawVectorOp(byte left, RRawVector right) { return performRawVectorOp(right, RRuntime.logical2int(left), true); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(RRawVector left, String right) { + protected RLogicalVector doRawVectorOp(RRawVector left, String right) { return performRawVectorOp(left, right, false); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(String left, RRawVector right) { + protected RLogicalVector doRawVectorOp(String left, RRawVector right) { return performRawVectorOp(right, left, true); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(RRawVector left, RComplex right) { + protected RLogicalVector doRawVectorOp(RRawVector left, RComplex right) { return performRawVectorOp(left, right, false); } @Specialization(guards = "convertRawToNumericObject") - public RLogicalVector doRawVectorOp(RComplex left, RRawVector right) { + protected RLogicalVector doRawVectorOp(RComplex left, RRawVector right) { return performRawVectorOp(right, left, true); } @Specialization(guards = "convertRawToNumeric") - public RLogicalVector doRawVectorOpLogical(RRawVector left, RRaw right) { + protected RLogicalVector doRawVectorOpLogical(RRawVector left, RRaw right) { return performRawVectorOp(left, RRuntime.raw2int(right), false); } @Specialization(guards = "convertRawToNumeric") - public RLogicalVector doRawVectorOpLogical(RRaw left, RRawVector right) { + protected RLogicalVector doRawVectorOpLogical(RRaw left, RRawVector right) { return performRawVectorOp(right, RRuntime.raw2int(left), true); } @Specialization(guards = "!convertRawToNumeric") - public RRawVector doRawVectorOpRaw(RRawVector left, RRaw right) { + protected RRawVector doRawVectorOpRaw(RRawVector left, RRaw right) { return performRawVectorOp(left, right, false); } @Specialization(guards = "!convertRawToNumeric") - public RRawVector doRawVectorOpRaw(RRaw left, RRawVector right) { + protected RRawVector doRawVectorOpRaw(RRaw left, RRawVector right) { return performRawVectorOp(right, left, true); } @Specialization(guards = "differentDimensions") - public RLogicalVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractVector left, RAbstractVector right) { + protected RLogicalVector doIntVectorDifferentLength(VirtualFrame frame, RAbstractVector left, RAbstractVector right) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NON_CONFORMABLE_ARRAYS); } @@ -709,382 +709,382 @@ public abstract class BinaryBooleanNode extends BinaryNode { // int vector and vectors @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractIntVector right) { return performIntVectorOpDifferentLength(left, right); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RAbstractIntVector right) { return performIntVectorOpSameLength(left, right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractDoubleVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractDoubleVector right) { return performDoubleVectorOpDifferentLength(RClosures.createIntToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RAbstractDoubleVector right) { + protected RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RAbstractDoubleVector right) { return performDoubleVectorOpSameLength(RClosures.createIntToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RAbstractDoubleVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractDoubleVector left, RAbstractIntVector right) { return performDoubleVectorOpDifferentLength(left, RClosures.createIntToDoubleVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorIntVectorSameLength(RAbstractDoubleVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorIntVectorSameLength(RAbstractDoubleVector left, RAbstractIntVector right) { return performDoubleVectorOpSameLength(left, RClosures.createIntToDoubleVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractLogicalVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RAbstractLogicalVector right) { return performIntVectorOpDifferentLength(left, RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RAbstractLogicalVector right) { + protected RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RAbstractLogicalVector right) { return performIntVectorOpSameLength(left, RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RAbstractLogicalVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractLogicalVector left, RAbstractIntVector right) { return performIntVectorOpDifferentLength(RClosures.createLogicalToIntVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RAbstractLogicalVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorSameLength(RAbstractLogicalVector left, RAbstractIntVector right) { return performIntVectorOpSameLength(RClosures.createLogicalToIntVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RStringVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RStringVector right) { return performStringVectorOpDifferentLength(RClosures.createIntToStringVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RStringVector right) { + protected RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RStringVector right) { return performStringVectorOpSameLength(RClosures.createIntToStringVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RStringVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorDifferentLength(RStringVector left, RAbstractIntVector right) { return performStringVectorOpDifferentLength(left, RClosures.createIntToStringVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RStringVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorSameLength(RStringVector left, RAbstractIntVector right) { return performStringVectorOpSameLength(left, RClosures.createIntToStringVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RComplexVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RComplexVector right) { return performComplexVectorOpDifferentLength(RClosures.createIntToComplexVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RComplexVector right) { + protected RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RComplexVector right) { return performComplexVectorOpSameLength(RClosures.createIntToComplexVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doIntVectorDifferentLength(RComplexVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorDifferentLength(RComplexVector left, RAbstractIntVector right) { return performComplexVectorOpDifferentLength(left, RClosures.createIntToComplexVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doIntVectorSameLength(RComplexVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorSameLength(RComplexVector left, RAbstractIntVector right) { return performComplexVectorOpSameLength(left, RClosures.createIntToComplexVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RRawVector right) { + protected RLogicalVector doIntVectorDifferentLength(RAbstractIntVector left, RRawVector right) { return performIntVectorOpDifferentLength(left, RClosures.createRawToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RRawVector right) { + protected RLogicalVector doIntVectorSameLength(RAbstractIntVector left, RRawVector right) { return performIntVectorOpSameLength(left, RClosures.createRawToIntVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doIntVectorDifferentLength(RRawVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorDifferentLength(RRawVector left, RAbstractIntVector right) { return performIntVectorOpDifferentLength(RClosures.createRawToIntVector(left, leftNACheck), right); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doIntVectorSameLength(RRawVector left, RAbstractIntVector right) { + protected RLogicalVector doIntVectorSameLength(RRawVector left, RAbstractIntVector right) { return performIntVectorOpSameLength(RClosures.createRawToIntVector(left, leftNACheck), right); } // double vector and vectors @Specialization(guards = "!areSameLength") - public RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { return performDoubleVectorOpDifferentLength(left, right); } @Specialization(guards = "areSameLength") - public RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractDoubleVector right) { return performDoubleVectorOpSameLength(left, right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { return performDoubleVectorOpDifferentLength(left, RClosures.createLogicalToDoubleVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { + protected RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RAbstractLogicalVector right) { return performDoubleVectorOpSameLength(left, RClosures.createLogicalToDoubleVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doDoubleVectorDifferentLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { return performDoubleVectorOpDifferentLength(RClosures.createLogicalToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doDoubleVectorSameLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorSameLength(RAbstractLogicalVector left, RAbstractDoubleVector right) { return performDoubleVectorOpSameLength(RClosures.createLogicalToDoubleVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RStringVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RStringVector right) { return performStringVectorOpDifferentLength(RClosures.createDoubleToStringVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RStringVector right) { + protected RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RStringVector right) { return performStringVectorOpSameLength(RClosures.createDoubleToStringVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doDoubleVectorDifferentLength(RStringVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RStringVector left, RAbstractDoubleVector right) { return performStringVectorOpDifferentLength(left, RClosures.createDoubleToStringVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doDoubleVectorSameLength(RStringVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorSameLength(RStringVector left, RAbstractDoubleVector right) { return performStringVectorOpSameLength(left, RClosures.createDoubleToStringVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RComplexVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RComplexVector right) { return performComplexVectorOpDifferentLength(RClosures.createDoubleToComplexVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RComplexVector right) { + protected RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RComplexVector right) { return performComplexVectorOpSameLength(RClosures.createDoubleToComplexVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doDoubleVectorDifferentLength(RComplexVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RComplexVector left, RAbstractDoubleVector right) { return performComplexVectorOpDifferentLength(left, RClosures.createDoubleToComplexVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doDoubleVectorSameLength(RComplexVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorSameLength(RComplexVector left, RAbstractDoubleVector right) { return performComplexVectorOpSameLength(left, RClosures.createDoubleToComplexVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RRawVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RAbstractDoubleVector left, RRawVector right) { return performDoubleVectorOpDifferentLength(left, RClosures.createRawToDoubleVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RRawVector right) { + protected RLogicalVector doDoubleVectorSameLength(RAbstractDoubleVector left, RRawVector right) { return performDoubleVectorOpSameLength(left, RClosures.createRawToDoubleVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doDoubleVectorDifferentLength(RRawVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorDifferentLength(RRawVector left, RAbstractDoubleVector right) { return performDoubleVectorOpDifferentLength(RClosures.createRawToDoubleVector(left, leftNACheck), right); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doDoubleVectorSameLength(RRawVector left, RAbstractDoubleVector right) { + protected RLogicalVector doDoubleVectorSameLength(RRawVector left, RAbstractDoubleVector right) { return performDoubleVectorOpSameLength(RClosures.createRawToDoubleVector(left, leftNACheck), right); } // logical vector and vectors @Specialization(guards = "!areSameLength") - public RLogicalVector doLogicalVectorDifferentLength(RLogicalVector left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorDifferentLength(RLogicalVector left, RLogicalVector right) { return performIntVectorOpDifferentLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doLogicalVectorSameLength(RLogicalVector left, RLogicalVector right) { + protected RLogicalVector doLogicalVectorSameLength(RLogicalVector left, RLogicalVector right) { return performIntVectorOpSameLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RStringVector right) { + protected RLogicalVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RStringVector right) { return performStringVectorOpDifferentLength(RClosures.createLogicalToStringVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doLogicalVectorSameLength(RAbstractLogicalVector left, RStringVector right) { + protected RLogicalVector doLogicalVectorSameLength(RAbstractLogicalVector left, RStringVector right) { return performStringVectorOpSameLength(RClosures.createLogicalToStringVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doLogicalVectorDifferentLength(RStringVector left, RAbstractLogicalVector right) { + protected RLogicalVector doLogicalVectorDifferentLength(RStringVector left, RAbstractLogicalVector right) { return performStringVectorOpDifferentLength(left, RClosures.createLogicalToStringVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doLogicalVectorSameLength(RStringVector left, RAbstractLogicalVector right) { + protected RLogicalVector doLogicalVectorSameLength(RStringVector left, RAbstractLogicalVector right) { return performStringVectorOpSameLength(left, RClosures.createLogicalToStringVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RComplexVector right) { + protected RLogicalVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RComplexVector right) { return performComplexVectorOpDifferentLength(RClosures.createLogicalToComplexVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doLogicalVectorSameLength(RAbstractLogicalVector left, RComplexVector right) { + protected RLogicalVector doLogicalVectorSameLength(RAbstractLogicalVector left, RComplexVector right) { return performComplexVectorOpSameLength(RClosures.createLogicalToComplexVector(left, leftNACheck), right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doLogicalVectorDifferentLength(RComplexVector left, RAbstractLogicalVector right) { + protected RLogicalVector doLogicalVectorDifferentLength(RComplexVector left, RAbstractLogicalVector right) { return performComplexVectorOpDifferentLength(left, RClosures.createLogicalToComplexVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doLogicalVectorSameLength(RComplexVector left, RAbstractLogicalVector right) { + protected RLogicalVector doLogicalVectorSameLength(RComplexVector left, RAbstractLogicalVector right) { return performComplexVectorOpSameLength(left, RClosures.createLogicalToComplexVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RRawVector right) { + protected RLogicalVector doLogicalVectorDifferentLength(RAbstractLogicalVector left, RRawVector right) { return performIntVectorOpDifferentLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createRawToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doLogicalVectorSameLength(RAbstractLogicalVector left, RRawVector right) { + protected RLogicalVector doLogicalVectorSameLength(RAbstractLogicalVector left, RRawVector right) { return performIntVectorOpSameLength(RClosures.createLogicalToIntVector(left, leftNACheck), RClosures.createRawToIntVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doLogicalVectorDifferentLength(RRawVector left, RAbstractLogicalVector right) { + protected RLogicalVector doLogicalVectorDifferentLength(RRawVector left, RAbstractLogicalVector right) { return performIntVectorOpDifferentLength(RClosures.createRawToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doLogicalVectorSameLength(RRawVector left, RAbstractLogicalVector right) { + protected RLogicalVector doLogicalVectorSameLength(RRawVector left, RAbstractLogicalVector right) { return performIntVectorOpSameLength(RClosures.createRawToIntVector(left, leftNACheck), RClosures.createLogicalToIntVector(right, rightNACheck)); } // string vector and vectors @Specialization(guards = "!areSameLength") - public RLogicalVector doStringVectorDifferentLength(RStringVector left, RStringVector right) { + protected RLogicalVector doStringVectorDifferentLength(RStringVector left, RStringVector right) { return performStringVectorOpDifferentLength(left, right); } @Specialization(guards = "areSameLength") - public RLogicalVector doStringVectorSameLength(RStringVector left, RStringVector right) { + protected RLogicalVector doStringVectorSameLength(RStringVector left, RStringVector right) { return performStringVectorOpSameLength(left, right); } @Specialization(guards = "!areSameLength") - public RLogicalVector doStringVectorDifferentLength(RStringVector left, RAbstractComplexVector right) { + protected RLogicalVector doStringVectorDifferentLength(RStringVector left, RAbstractComplexVector right) { return performStringVectorOpDifferentLength(left, RClosures.createComplexToStringVector(right, rightNACheck)); } @Specialization(guards = "areSameLength") - public RLogicalVector doStringVectorSameLength(RStringVector left, RAbstractComplexVector right) { + protected RLogicalVector doStringVectorSameLength(RStringVector left, RAbstractComplexVector right) { return performStringVectorOpSameLength(left, RClosures.createComplexToStringVector(right, rightNACheck)); } @Specialization(guards = "!areSameLength") - public RLogicalVector doStringVectorDifferentLength(RAbstractComplexVector left, RStringVector right) { + protected RLogicalVector doStringVectorDifferentLength(RAbstractComplexVector left, RStringVector right) { return performStringVectorOpDifferentLength(RClosures.createComplexToStringVector(left, leftNACheck), right); } @Specialization(guards = "areSameLength") - public RLogicalVector doStringVectorSameLength(RAbstractComplexVector left, RStringVector right) { + protected RLogicalVector doStringVectorSameLength(RAbstractComplexVector left, RStringVector right) { return performStringVectorOpSameLength(RClosures.createComplexToStringVector(left, leftNACheck), right); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doStringVectorDifferentLength(RStringVector left, RRawVector right) { + protected RLogicalVector doStringVectorDifferentLength(RStringVector left, RRawVector right) { return performStringVectorOpDifferentLength(left, RClosures.createRawToStringVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doStringVectorSameLength(RStringVector left, RRawVector right) { + protected RLogicalVector doStringVectorSameLength(RStringVector left, RRawVector right) { return performStringVectorOpSameLength(left, RClosures.createRawToStringVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doStringVectorDifferentLengthRRawVector(RRawVector left, RStringVector right) { + protected RLogicalVector doStringVectorDifferentLengthRRawVector(RRawVector left, RStringVector right) { return performStringVectorOpDifferentLength(RClosures.createRawToStringVector(left, leftNACheck), right); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doStringVectorSameLengthRRawVector(RRawVector left, RStringVector right) { + protected RLogicalVector doStringVectorSameLengthRRawVector(RRawVector left, RStringVector right) { return performStringVectorOpSameLength(RClosures.createRawToStringVector(left, leftNACheck), right); } // complex vector and vectors @Specialization(guards = "!areSameLength") - public RLogicalVector doComplexVectorDifferentLength(RComplexVector left, RComplexVector right) { + protected RLogicalVector doComplexVectorDifferentLength(RComplexVector left, RComplexVector right) { return performComplexVectorOpDifferentLength(left, right); } @Specialization(guards = "areSameLength") - public RLogicalVector doComplexVectorSameLength(RComplexVector left, RComplexVector right) { + protected RLogicalVector doComplexVectorSameLength(RComplexVector left, RComplexVector right) { return performComplexVectorOpSameLength(left, right); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doComplexVectorDifferentLength(RComplexVector left, RRawVector right) { + protected RLogicalVector doComplexVectorDifferentLength(RComplexVector left, RRawVector right) { return performComplexVectorOpDifferentLength(left, RClosures.createRawToComplexVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doComplexVectorSameLength(RComplexVector left, RRawVector right) { + protected RLogicalVector doComplexVectorSameLength(RComplexVector left, RRawVector right) { return performComplexVectorOpSameLength(left, RClosures.createRawToComplexVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doComplexVectorDifferentLength(RRawVector left, RComplexVector right) { + protected RLogicalVector doComplexVectorDifferentLength(RRawVector left, RComplexVector right) { return performComplexVectorOpDifferentLength(RClosures.createRawToComplexVector(left, leftNACheck), right); } @Specialization(guards = {"areSameLength", "convertRawToNumericVector"}) - public RLogicalVector doComplexVectorSameLength(RRawVector left, RComplexVector right) { + protected RLogicalVector doComplexVectorSameLength(RRawVector left, RComplexVector right) { return performComplexVectorOpSameLength(RClosures.createRawToComplexVector(left, leftNACheck), right); } // raw vector and vectors @Specialization(guards = {"!areSameLength", "convertRawToNumeric"}) - public RLogicalVector doRawVectorDifferentLengthLogical(RRawVector left, RRawVector right) { + protected RLogicalVector doRawVectorDifferentLengthLogical(RRawVector left, RRawVector right) { return performIntVectorOpDifferentLength(RClosures.createRawToIntVector(left, leftNACheck), RClosures.createRawToIntVector(right, rightNACheck)); } @Specialization(guards = {"areSameLength", "convertRawToNumeric"}) - public RLogicalVector doRawVectorSameLengthLogical(RRawVector left, RRawVector right) { + protected RLogicalVector doRawVectorSameLengthLogical(RRawVector left, RRawVector right) { return performIntVectorOpSameLength(RClosures.createRawToIntVector(left, leftNACheck), RClosures.createRawToIntVector(right, rightNACheck)); } @Specialization(guards = {"!areSameLength", "!convertRawToNumeric"}) - public RRawVector doRawVectorDifferentLengthRaw(RRawVector left, RRawVector right) { + protected RRawVector doRawVectorDifferentLengthRaw(RRawVector left, RRawVector right) { return performRawVectorOpDifferentLength(left, right); } @Specialization(guards = {"areSameLength", "!convertRawToNumeric"}) - public RRawVector doRawVectorSameLengthRaw(RRawVector left, RRawVector right) { + protected RRawVector doRawVectorSameLengthRaw(RRawVector left, RRawVector right) { return performRawVectorOpSameLength(left, right); } @@ -1092,17 +1092,17 @@ public abstract class BinaryBooleanNode extends BinaryNode { // convertRawToNumericVector @Specialization - public byte doRaw(RRaw left, Object right) { + protected byte doRaw(RRaw left, Object right) { return logic.op(left, right); } @Specialization - public byte doRaw(Object left, RRaw right) { + protected byte doRaw(Object left, RRaw right) { return logic.op(left, right); } @Specialization - public byte doRaw(RRawVector left, Object right) { + protected byte doRaw(RRawVector left, Object right) { // perhaps not the cleanest solution but others would be (unnecessarily) more verbose (e.g. // introduce another abstract method to BooleanOperation just to signal an error in one // case) @@ -1111,7 +1111,7 @@ public abstract class BinaryBooleanNode extends BinaryNode { } @Specialization - public byte doRaw(Object left, RRawVector right) { + protected byte doRaw(Object left, RRawVector right) { // perhaps not the cleanest solution but others would be (unnecessarily) more verbose (e.g. // introduce another abstract method to BooleanOperation just to signal an error in one // case) @@ -1141,51 +1141,51 @@ public abstract class BinaryBooleanNode extends BinaryNode { return isVectorizedLogicalOp(); } - public boolean convertRawToNumericVector(RRaw left, RAbstractVector right) { + protected boolean convertRawToNumericVector(RRaw left, RAbstractVector right) { return isVectorizedLogicalOp(); } - public boolean convertRawToNumericVector(RAbstractVector left, RRaw right) { + protected boolean convertRawToNumericVector(RAbstractVector left, RRaw right) { return isVectorizedLogicalOp(); } - public boolean convertRawToNumericVector(RRawVector left, RAbstractVector right) { + protected boolean convertRawToNumericVector(RRawVector left, RAbstractVector right) { return isVectorizedLogicalOp(); } - public boolean convertRawToNumericVector(RAbstractVector left, RRawVector right) { + protected boolean convertRawToNumericVector(RAbstractVector left, RRawVector right) { return isVectorizedLogicalOp(); } - public boolean convertRawToNumeric(RRaw left, RRaw right) { + protected boolean convertRawToNumeric(RRaw left, RRaw right) { return isVectorizedLogicalOp(); } - public boolean convertRawToNumeric(RRawVector left, RRawVector right) { + protected boolean convertRawToNumeric(RRawVector left, RRawVector right) { return isVectorizedLogicalOp(); } - public boolean convertRawToNumeric(RRaw left, RRawVector right) { + protected boolean convertRawToNumeric(RRaw left, RRawVector right) { return isVectorizedLogicalOp(); } - public boolean convertRawToNumeric(RRawVector left, RRaw right) { + protected boolean convertRawToNumeric(RRawVector left, RRaw right) { return isVectorizedLogicalOp(); } - public boolean expectLogical(RRaw left, RRaw right) { + protected boolean expectLogical(RRaw left, RRaw right) { return isVectorizedLogicalOp(); } - public boolean expectLogical(RRawVector left, RRawVector right) { + protected boolean expectLogical(RRawVector left, RRawVector right) { return isVectorizedLogicalOp(); } - public boolean expectLogical(RRawVector left, RRaw right) { + protected boolean expectLogical(RRawVector left, RRaw right) { return isVectorizedLogicalOp(); } - public boolean expectLogical(RRaw left, RRawVector right) { + protected boolean expectLogical(RRaw left, RRawVector right) { return isVectorizedLogicalOp(); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNonVectorizedNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNonVectorizedNode.java index 43df8604f8b22621d3be722cf8e90ace41d05916..928d14b60b41e0433e5b6ebd9a23470b572f24ed 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNonVectorizedNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNonVectorizedNode.java @@ -66,175 +66,175 @@ public abstract class BinaryBooleanNonVectorizedNode extends BinaryNode { } @ShortCircuit("arguments[1]") - public boolean needsRightOperand(Object leftValue) { + protected boolean needsRightOperand(Object leftValue) { return logic.requiresRightOperand(RTypesGen.RTYPES.asByte(leftValue)); } @Specialization(guards = "needsRightOperand") - public byte doLogical(byte left, boolean needsRightOperand, int right) { + protected byte doLogical(byte left, boolean needsRightOperand, int right) { return logic.op(RRuntime.logical2int(left), right); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, int right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, int right) { return left; } @Specialization(guards = "needsRightOperand") - public byte doLogical(byte left, boolean needsRightOperand, double right) { + protected byte doLogical(byte left, boolean needsRightOperand, double right) { return logic.op(RRuntime.logical2double(left), right); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, double right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, double right) { return left; } @Specialization(guards = "needsRightOperand") - public byte doLogical(byte left, boolean needsRightOperand, byte right) { + protected byte doLogical(byte left, boolean needsRightOperand, byte right) { return logic.op(RRuntime.logical2int(left), RRuntime.logical2int(right)); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, byte right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, byte right) { return left; } @Specialization(guards = "needsRightOperand") - public byte doLogical(byte left, boolean needsRightOperand, String right) { + protected byte doLogical(byte left, boolean needsRightOperand, String right) { return logic.op(RRuntime.logical2int(left), right); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, String right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, String right) { return left; } @Specialization(guards = "needsRightOperand") - public byte doLogical(byte left, boolean needsRightOperand, RComplex right) { + protected byte doLogical(byte left, boolean needsRightOperand, RComplex right) { return logic.op(RRuntime.logical2complex(left), right); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RComplex right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RComplex right) { return left; } @Specialization(guards = "needsRightOperand") - public byte doLogical(Object left, boolean needsRightOperand, RRaw right) { + protected byte doLogical(Object left, boolean needsRightOperand, RRaw right) { return logic.op(left, right); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RRaw right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RRaw right) { return left; } @Specialization(guards = "needsRightOperand") - public byte doLogical(Object left, boolean needsRightOperand, RNull right) { + protected byte doLogical(Object left, boolean needsRightOperand, RNull right) { return logic.op(left, right); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RNull right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RNull right) { return left; } @Specialization(guards = {"needsRightOperand", "!isZeroLength"}) - public byte doLogical(byte left, boolean needsRightOperand, RAbstractIntVector right) { + protected byte doLogical(byte left, boolean needsRightOperand, RAbstractIntVector right) { return logic.op(RRuntime.logical2int(left), right.getDataAt(0)); } @Specialization(guards = {"needsRightOperand", "isZeroLength"}) - public byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractIntVector right) { + protected byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractIntVector right) { return logic.op(RRuntime.logical2int(left), RRuntime.INT_NA); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractIntVector right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractIntVector right) { return left; } @Specialization(guards = {"needsRightOperand", "!isZeroLength"}) - public byte doLogical(byte left, boolean needsRightOperand, RAbstractDoubleVector right) { + protected byte doLogical(byte left, boolean needsRightOperand, RAbstractDoubleVector right) { return logic.op(RRuntime.logical2double(left), right.getDataAt(0)); } @Specialization(guards = {"needsRightOperand", "isZeroLength"}) - public byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractDoubleVector right) { + protected byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractDoubleVector right) { return logic.op(RRuntime.logical2double(left), RRuntime.DOUBLE_NA); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractDoubleVector right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractDoubleVector right) { return left; } @Specialization(guards = {"needsRightOperand", "!isZeroLength"}) - public byte doLogical(byte left, boolean needsRightOperand, RAbstractLogicalVector right) { + protected byte doLogical(byte left, boolean needsRightOperand, RAbstractLogicalVector right) { return logic.op(RRuntime.logical2int(left), RRuntime.logical2int(right.getDataAt(0))); } @Specialization(guards = {"needsRightOperand", "isZeroLength"}) - public byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractLogicalVector right) { + protected byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractLogicalVector right) { return logic.op(RRuntime.logical2int(left), RRuntime.INT_NA); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractLogicalVector right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractLogicalVector right) { return left; } @Specialization(guards = {"needsRightOperand", "!isZeroLength"}) - public byte doLogical(byte left, boolean needsRightOperand, RAbstractStringVector right) { + protected byte doLogical(byte left, boolean needsRightOperand, RAbstractStringVector right) { return logic.op(RRuntime.logical2int(left), right.getDataAt(0)); } @Specialization(guards = {"needsRightOperand", "isZeroLength"}) - public byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractStringVector right) { + protected byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractStringVector right) { return logic.op(RRuntime.logical2int(left), RRuntime.STRING_NA); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractStringVector right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractStringVector right) { return left; } @Specialization(guards = {"needsRightOperand", "!isZeroLength"}) - public byte doLogical(byte left, boolean needsRightOperand, RAbstractComplexVector right) { + protected byte doLogical(byte left, boolean needsRightOperand, RAbstractComplexVector right) { return logic.op(RRuntime.logical2complex(left), right.getDataAt(0)); } @Specialization(guards = {"needsRightOperand", "isZeroLength"}) - public byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractComplexVector right) { + protected byte doLogicalEmpty(byte left, boolean needsRightOperand, RAbstractComplexVector right) { return logic.op(RRuntime.logical2complex(left), RRuntime.createComplexNA()); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractComplexVector right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractComplexVector right) { return left; } @Specialization(guards = {"needsRightOperand", "!isZeroLength"}) - public byte doLogical(Object left, boolean needsRightOperand, RAbstractRawVector right) { + protected byte doLogical(Object left, boolean needsRightOperand, RAbstractRawVector right) { return logic.op(left, right.getDataAt(0)); } @Specialization(guards = {"needsRightOperand", "isZeroLength"}) - public byte doLogicalEmpty(VirtualFrame frame, Object left, boolean needsRightOperand, RAbstractRawVector right) { + protected byte doLogicalEmpty(VirtualFrame frame, Object left, boolean needsRightOperand, RAbstractRawVector right) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_IN, "y", logic.opName()); } @Specialization(guards = "!needsRightOperand") - public byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractRawVector right) { + protected byte doLogicalOnlyLeft(byte left, boolean needsRightOperand, RAbstractRawVector right) { return left; } - boolean isZeroLength(byte left, boolean needsRightOperand, RAbstractVector operand) { + protected boolean isZeroLength(byte left, boolean needsRightOperand, RAbstractVector operand) { return operand.getLength() == 0; } - boolean isZeroLength(Object left, boolean needsRightOperand, RAbstractVector operand) { + protected boolean isZeroLength(Object left, boolean needsRightOperand, RAbstractVector operand) { return operand.getLength() == 0; } @@ -251,84 +251,84 @@ public abstract class BinaryBooleanNonVectorizedNode extends BinaryNode { public abstract String getOpName(); @Specialization - public byte doLogical(int operand) { + protected byte doLogical(int operand) { return RRuntime.int2logical(operand); } @Specialization - public byte doLogical(double operand) { + protected byte doLogical(double operand) { return RRuntime.double2logical(operand); } @Specialization - public byte doLogical(RComplex operand) { + protected byte doLogical(RComplex operand) { return RRuntime.complex2logical(operand); } @Specialization - public byte doLogical(byte operand) { + protected byte doLogical(byte operand) { return operand; } @Specialization - public byte doLogical(VirtualFrame frame, String operand) { + protected byte doLogical(VirtualFrame frame, String operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_IN, "x", getOpName()); } @Specialization - public byte doLogical(VirtualFrame frame, RRaw operand) { + protected byte doLogical(VirtualFrame frame, RRaw operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_IN, "x", getOpName()); } @Specialization - public byte doLogical(VirtualFrame frame, RNull operand) { + protected byte doLogical(VirtualFrame frame, RNull operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_IN, "x", getOpName()); } @Specialization(guards = {"isZeroLength", "!isStringVector", "!isRawVector"}) - public byte doLogical(RAbstractVector operand) { + protected byte doLogical(RAbstractVector operand) { return RRuntime.LOGICAL_NA; } @Specialization(guards = "!isZeroLength") - public byte doLogical(RAbstractDoubleVector operand) { + protected byte doLogical(RAbstractDoubleVector operand) { return RRuntime.double2logical(operand.getDataAt(0)); } @Specialization(guards = "!isZeroLength") - public byte doLogical(RAbstractComplexVector operand) { + protected byte doLogical(RAbstractComplexVector operand) { return RRuntime.complex2logical(operand.getDataAt(0)); } @Specialization(guards = "!isZeroLength") - public byte doLogical(RAbstractLogicalVector operand) { + protected byte doLogical(RAbstractLogicalVector operand) { return operand.getDataAt(0); } @Specialization - public byte doLogical(VirtualFrame frame, RAbstractStringVector operand) { + protected byte doLogical(VirtualFrame frame, RAbstractStringVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_IN, "x", getOpName()); } @Specialization - public byte doLogical(VirtualFrame frame, RAbstractRawVector operand) { + protected byte doLogical(VirtualFrame frame, RAbstractRawVector operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_IN, "x", getOpName()); } @Specialization(guards = "!isZeroLength") - public byte doLogical(RAbstractIntVector operand) { + protected byte doLogical(RAbstractIntVector operand) { return RRuntime.int2logical(operand.getDataAt(0)); } - boolean isZeroLength(RAbstractVector operand) { + protected boolean isZeroLength(RAbstractVector operand) { return operand.getLength() == 0; } - boolean isStringVector(RAbstractVector vector) { + protected boolean isStringVector(RAbstractVector vector) { return vector.getElementClass() == RString.class; } - boolean isRawVector(RAbstractVector vector) { + protected boolean isRawVector(RAbstractVector vector) { return vector.getElementClass() == RRaw.class; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CastTypeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CastTypeNode.java index 44deb7ee8c5c993178ad2c4aa7ef2d1c2f62401e..ffeacff88ce1b1aed7cbbac63c6de23b99eaae62 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CastTypeNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CastTypeNode.java @@ -35,62 +35,62 @@ public abstract class CastTypeNode extends RInvisibleBuiltinNode { @SuppressWarnings("unused") @Specialization(guards = "isSameType") - public RAbstractVector doCast(VirtualFrame frame, final RAbstractVector value, final String type) { + protected RAbstractVector doCast(VirtualFrame frame, final RAbstractVector value, final String type) { return value; } @SuppressWarnings("unused") @Specialization(guards = {"!isSameType", "isString"}) - public Object doCastString(VirtualFrame frame, final RAbstractVector value, final String type) { + protected Object doCastString(VirtualFrame frame, final RAbstractVector value, final String type) { initCastString(); return castStringNode.executeString(frame, value); } @SuppressWarnings("unused") @Specialization(guards = {"!isSameType", "isComplex"}) - public Object doCastComplex(VirtualFrame frame, final RAbstractVector value, final String type) { + protected Object doCastComplex(VirtualFrame frame, final RAbstractVector value, final String type) { initCastComplex(); return castComplexNode.executeComplex(frame, value); } @SuppressWarnings("unused") @Specialization(guards = {"!isSameType", "isDouble"}) - public Object doCastDouble(VirtualFrame frame, final RAbstractVector value, final String type) { + protected Object doCastDouble(VirtualFrame frame, final RAbstractVector value, final String type) { initCastDouble(); return castDoubleNode.executeDouble(frame, value); } @SuppressWarnings("unused") @Specialization(guards = {"!isSameType", "isInteger"}) - public Object doCastInteger(VirtualFrame frame, final RAbstractVector value, final String type) { + protected Object doCastInteger(VirtualFrame frame, final RAbstractVector value, final String type) { initCastInteger(); return castIntegerNode.executeInt(frame, value); } @SuppressWarnings("unused") @Specialization(guards = {"!isSameType", "isLogical"}) - public Object doCastLogical(VirtualFrame frame, final RAbstractVector value, final String type) { + protected Object doCastLogical(VirtualFrame frame, final RAbstractVector value, final String type) { initCastLogical(); return castLogicalNode.executeLogical(frame, value); } @SuppressWarnings("unused") @Specialization(guards = {"!isSameType", "isRaw"}) - public Object doCastRaw(VirtualFrame frame, final RAbstractVector value, final String type) { + protected Object doCastRaw(VirtualFrame frame, final RAbstractVector value, final String type) { initCastRaw(); return castRawNode.executeRaw(frame, value); } @SuppressWarnings("unused") @Specialization(guards = {"!isSameType", "isList"}) - public RList doCastList(VirtualFrame frame, final RAbstractVector value, final String type) { + protected RList doCastList(VirtualFrame frame, final RAbstractVector value, final String type) { initCastList(); return castListNode.executeList(frame, value); } @SuppressWarnings("unused") @Specialization - public Object doCastUnknown(VirtualFrame frame, final RAbstractVector value, final String type) { + protected Object doCastUnknown(VirtualFrame frame, final RAbstractVector value, final String type) { return null; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CbindBinaryNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CbindBinaryNode.java index 24eee9e0cad8941bea149e861484fb59f399deda..a50b54c661ff6ec6c85f73de01cb4e89e2d3c7bc 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CbindBinaryNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CbindBinaryNode.java @@ -30,28 +30,28 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class CbindBinaryNode extends CombineBinaryNode { - private BranchProfile everSeenNotEqualRows = new BranchProfile(); + private final BranchProfile everSeenNotEqualRows = new BranchProfile(); @SuppressWarnings("unused") @Specialization - public RNull cbind(RNull left, RNull right) { + protected RNull cbind(RNull left, RNull right) { return RNull.instance; } @SuppressWarnings("unused") @Specialization - public RAbstractVector cbind(RAbstractVector left, RNull right) { + protected RAbstractVector cbind(RAbstractVector left, RNull right) { return left.copyWithNewDimensions(getDimensions(left)); } @SuppressWarnings("unused") @Specialization - public RAbstractVector cbind(RNull left, RAbstractVector right) { + protected RAbstractVector cbind(RNull left, RAbstractVector right) { return right.copyWithNewDimensions(getDimensions(right)); } @Specialization - public RAbstractVector cbind(RAbstractVector left, RAbstractVector right) { + protected RAbstractVector cbind(RAbstractVector left, RAbstractVector right) { return genericCbind(left.materialize(), right.materialize()); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/ColonNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/ColonNode.java index 4a6ba722bc2b291f554a41c344c32f8dca9aba2e..b27f7130dfa31a25e16c4299d4949d42b2e6404c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/ColonNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/ColonNode.java @@ -38,49 +38,49 @@ public abstract class ColonNode extends RNode implements VisibilityController { } @Specialization(guards = "isSmaller") - public RIntSequence colonAscending(int left, int right) { + protected RIntSequence colonAscending(int left, int right) { controlVisibility(); return RDataFactory.createAscendingRange(left, right); } @Specialization(guards = "!isSmaller") - public RIntSequence colonDescending(int left, int right) { + protected RIntSequence colonDescending(int left, int right) { controlVisibility(); return RDataFactory.createDescendingRange(left, right); } @Specialization(guards = "isSmaller") - public RIntSequence colonAscending(int left, double right) { + protected RIntSequence colonAscending(int left, double right) { controlVisibility(); return RDataFactory.createAscendingRange(left, (int) right); } @Specialization(guards = "!isSmaller") - public RIntSequence colonDescending(int left, double right) { + protected RIntSequence colonDescending(int left, double right) { controlVisibility(); return RDataFactory.createDescendingRange(left, (int) right); } @Specialization(guards = "isSmaller") - public RDoubleSequence colonAscending(double left, int right) { + protected RDoubleSequence colonAscending(double left, int right) { controlVisibility(); return RDataFactory.createAscendingRange(left, right); } @Specialization(guards = "!isSmaller") - public RDoubleSequence colonDescending(double left, int right) { + protected RDoubleSequence colonDescending(double left, int right) { controlVisibility(); return RDataFactory.createDescendingRange(left, right); } @Specialization(guards = "isSmaller") - public RDoubleSequence colonAscending(double left, double right) { + protected RDoubleSequence colonAscending(double left, double right) { controlVisibility(); return RDataFactory.createAscendingRange(left, right); } @Specialization(guards = "!isSmaller") - public RDoubleSequence colonDescending(double left, double right) { + protected RDoubleSequence colonDescending(double left, double right) { controlVisibility(); return RDataFactory.createDescendingRange(left, right); } @@ -115,44 +115,44 @@ public abstract class ColonNode extends RNode implements VisibilityController { public abstract static class ColonCastNode extends RNode { @Specialization(guards = "isIntValue") - public int doDoubleToInt(double operand) { + protected int doDoubleToInt(double operand) { return (int) operand; } @Specialization(guards = "!isIntValue") - public double doDouble(double operand) { + protected double doDouble(double operand) { return operand; } @Specialization - public int doSequence(RIntSequence sequence) { + protected int doSequence(RIntSequence sequence) { // TODO: Produce warning return sequence.getStart(); } @Specialization - public int doSequence(RIntVector vector) { + protected int doSequence(RIntVector vector) { // TODO: Produce warning return vector.getDataAt(0); } @Specialization(guards = "isFirstIntValue") - public int doDoubleVectorFirstIntValue(RDoubleVector vector) { + protected int doDoubleVectorFirstIntValue(RDoubleVector vector) { return (int) vector.getDataAt(0); } @Specialization(guards = "!isFirstIntValue") - public double doDoubleVector(RDoubleVector vector) { + protected double doDoubleVector(RDoubleVector vector) { return vector.getDataAt(0); } @Specialization - public int doInt(int operand) { + protected int doInt(int operand) { return operand; } @Specialization - public byte doBoolean(byte operand) { + protected byte doBoolean(byte operand) { return operand; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryComplexNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryComplexNode.java index 728a327203fc9c2f2924cabdec499f200b1f58a2..ad26906640cefca031372ab2d886417588c4beb8 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryComplexNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryComplexNode.java @@ -34,37 +34,37 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class CombineBinaryComplexNode extends CombineBinaryNode { @Specialization - public RNull combine(RNull left, RNull right) { + protected RNull combine(RNull left, RNull right) { return RNull.instance; } @Specialization - public RComplex combine(RNull left, RComplex right) { + protected RComplex combine(RNull left, RComplex right) { return right; } @Specialization - public RComplex combine(RComplex left, RNull right) { + protected RComplex combine(RComplex left, RNull right) { return left; } @Specialization - public RComplexVector combine(RComplexVector left, RNull right) { + protected RComplexVector combine(RComplexVector left, RNull right) { return left; } @Specialization - public RComplexVector combine(RNull left, RComplexVector right) { + protected RComplexVector combine(RNull left, RComplexVector right) { return right; } @Specialization - public RComplexVector combine(RComplex left, RComplex right) { + protected RComplexVector combine(RComplex left, RComplex right) { return RDataFactory.createComplexVector(new double[]{left.getRealPart(), left.getImaginaryPart(), right.getRealPart(), right.getImaginaryPart()}, !left.isNA() && !right.isNA()); } @Specialization - public RComplexVector combine(RComplexVector left, RComplex right) { + protected RComplexVector combine(RComplexVector left, RComplex right) { int dataLength = left.getLength(); double[] result = new double[(dataLength + 1) << 1]; for (int i = 0; i < dataLength; ++i) { @@ -79,7 +79,7 @@ public abstract class CombineBinaryComplexNode extends CombineBinaryNode { } @Specialization - public RComplexVector combine(RComplex left, RComplexVector right) { + protected RComplexVector combine(RComplex left, RComplexVector right) { int dataLength = right.getLength(); double[] result = new double[(1 + dataLength) << 1]; result[0] = left.getRealPart(); @@ -94,7 +94,7 @@ public abstract class CombineBinaryComplexNode extends CombineBinaryNode { } @Specialization - public RComplexVector combine(RComplexVector left, RComplexVector right) { + protected RComplexVector combine(RComplexVector left, RComplexVector right) { return (RComplexVector) genericCombine(left, right); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryDoubleNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryDoubleNode.java index 67c903f348ec88ec9c46d4092759f1625ece834c..3c8dc45bda114c359ba04fc8edf437a4353b131e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryDoubleNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryDoubleNode.java @@ -35,27 +35,27 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class CombineBinaryDoubleNode extends CombineBinaryNode { @Specialization - public RNull combine(RNull left, RNull right) { + protected RNull combine(RNull left, RNull right) { return RNull.instance; } @Specialization - public RAbstractDoubleVector combine(RNull left, RAbstractDoubleVector right) { + protected RAbstractDoubleVector combine(RNull left, RAbstractDoubleVector right) { return right; } @Specialization - public RAbstractDoubleVector combine(RAbstractDoubleVector left, RNull right) { + protected RAbstractDoubleVector combine(RAbstractDoubleVector left, RNull right) { return left; } @Specialization - public RDoubleVector combine(double left, double right) { + protected RDoubleVector combine(double left, double right) { return RDataFactory.createDoubleVector(new double[]{left, right}, RRuntime.isComplete(left) && RRuntime.isComplete(right)); } @Specialization - public RDoubleVector combine(RAbstractDoubleVector left, double right) { + protected RDoubleVector combine(RAbstractDoubleVector left, double right) { int dataLength = left.getLength(); double[] result = new double[dataLength + 1]; for (int i = 0; i < dataLength; ++i) { @@ -66,7 +66,7 @@ public abstract class CombineBinaryDoubleNode extends CombineBinaryNode { } @Specialization - public RDoubleVector combine(double left, RAbstractDoubleVector right) { + protected RDoubleVector combine(double left, RAbstractDoubleVector right) { int dataLength = right.getLength(); double[] result = new double[dataLength + 1]; result[0] = left; @@ -77,7 +77,7 @@ public abstract class CombineBinaryDoubleNode extends CombineBinaryNode { } @Specialization - public RDoubleVector combine(RAbstractDoubleVector left, RAbstractDoubleVector right) { + protected RDoubleVector combine(RAbstractDoubleVector left, RAbstractDoubleVector right) { int leftLength = left.getLength(); int rightLength = right.getLength(); double[] result = new double[leftLength + rightLength]; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryIntegerNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryIntegerNode.java index 6270c5bd8031bf8d2e102129fbd1b7fc0a27102b..0f6ea07efac2c585f30ac377ffb374e876b9db5e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryIntegerNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryIntegerNode.java @@ -32,27 +32,27 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class CombineBinaryIntegerNode extends CombineBinaryNode { @Specialization - public RNull combine(RNull left, RNull right) { + protected RNull combine(RNull left, RNull right) { return RNull.instance; } @Specialization - public RAbstractIntVector combine(RNull left, RAbstractIntVector right) { + protected RAbstractIntVector combine(RNull left, RAbstractIntVector right) { return right; } @Specialization - public RAbstractIntVector combine(RAbstractIntVector left, RNull right) { + protected RAbstractIntVector combine(RAbstractIntVector left, RNull right) { return left; } @Specialization - public RIntVector combine(int left, int right) { + protected RIntVector combine(int left, int right) { return RDataFactory.createIntVector(new int[]{left, right}, RRuntime.isComplete(left) && RRuntime.isComplete(right)); } @Specialization - public RIntVector combine(RAbstractIntVector left, RAbstractIntVector right) { + protected RIntVector combine(RAbstractIntVector left, RAbstractIntVector right) { int leftLength = left.getLength(); int rightLength = right.getLength(); int[] result = new int[leftLength + rightLength]; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryListNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryListNode.java index 34ec91aa4f73a43ed297ebae6c27d6406bb34019..dd9103fbf70822b361c0b0a653cf01664da3f2a2 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryListNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryListNode.java @@ -29,12 +29,12 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class CombineBinaryListNode extends CombineBinaryNode { @Specialization - public RList combine(RList left, double right) { + protected RList combine(RList left, double right) { return extend(left, right); } @Specialization - public RList combine(RList left, RAbstractVector right) { + protected RList combine(RList left, RAbstractVector right) { Object[] data = left.getDataWithoutCopying(); Object[] result = new Object[data.length + right.getLength()]; System.arraycopy(data, 0, result, 0, data.length); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryLogicalNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryLogicalNode.java index d92f9ead16140b048ce1d45e7fca688450fa8ea1..66340d44fac6c622e1f869998c078f81695ead70 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryLogicalNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryLogicalNode.java @@ -32,32 +32,32 @@ public abstract class CombineBinaryLogicalNode extends CombineBinaryNode { private final NACheck check = NACheck.create(); @Specialization - public RNull combine(RNull left, RNull right) { + protected RNull combine(RNull left, RNull right) { return RNull.instance; } @Specialization - public byte combine(RNull left, byte right) { + protected byte combine(RNull left, byte right) { return right; } @Specialization - public byte combine(byte left, RNull right) { + protected byte combine(byte left, RNull right) { return left; } @Specialization - public RLogicalVector combine(RLogicalVector left, RNull right) { + protected RLogicalVector combine(RLogicalVector left, RNull right) { return left; } @Specialization - public RLogicalVector combine(RNull left, RLogicalVector right) { + protected RLogicalVector combine(RNull left, RLogicalVector right) { return right; } @Specialization - public RLogicalVector combine(byte left, byte right) { + protected RLogicalVector combine(byte left, byte right) { check.enable(true); check.check(left); check.check(right); @@ -65,7 +65,7 @@ public abstract class CombineBinaryLogicalNode extends CombineBinaryNode { } @Specialization - public RLogicalVector combine(RLogicalVector left, byte right) { + protected RLogicalVector combine(RLogicalVector left, byte right) { check.enable(left); check.enable(right); int dataLength = left.getLength(); @@ -81,7 +81,7 @@ public abstract class CombineBinaryLogicalNode extends CombineBinaryNode { } @Specialization - public RLogicalVector combine(byte left, RLogicalVector right) { + protected RLogicalVector combine(byte left, RLogicalVector right) { check.enable(right); check.enable(left); int dataLength = right.getLength(); @@ -97,7 +97,7 @@ public abstract class CombineBinaryLogicalNode extends CombineBinaryNode { } @Specialization - public RLogicalVector combine(RLogicalVector left, RLogicalVector right) { + protected RLogicalVector combine(RLogicalVector left, RLogicalVector right) { return (RLogicalVector) genericCombine(left, right); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryRawNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryRawNode.java index 0ae9eb168199600bc0888e76b736dc4284412753..1f973982f984e60a983e8283ec8aa5a920b03252 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryRawNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryRawNode.java @@ -33,37 +33,37 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class CombineBinaryRawNode extends CombineBinaryNode { @Specialization - public RNull combine(RNull left, RNull right) { + protected RNull combine(RNull left, RNull right) { return RNull.instance; } @Specialization - public RRaw combine(RNull left, RRaw right) { + protected RRaw combine(RNull left, RRaw right) { return right; } @Specialization - public RRaw combine(RRaw left, RNull right) { + protected RRaw combine(RRaw left, RNull right) { return left; } @Specialization - public RRawVector combine(RRawVector left, RNull right) { + protected RRawVector combine(RRawVector left, RNull right) { return left; } @Specialization - public RRawVector combine(RNull left, RRawVector right) { + protected RRawVector combine(RNull left, RRawVector right) { return right; } @Specialization - public RRawVector combine(RRaw left, RRaw right) { + protected RRawVector combine(RRaw left, RRaw right) { return RDataFactory.createRawVector(new byte[]{left.getValue(), right.getValue()}); } @Specialization - public RRawVector combine(RRawVector left, RRaw right) { + protected RRawVector combine(RRawVector left, RRaw right) { int dataLength = left.getLength(); byte[] result = new byte[dataLength + 1]; for (int i = 0; i < dataLength; ++i) { @@ -74,7 +74,7 @@ public abstract class CombineBinaryRawNode extends CombineBinaryNode { } @Specialization - public RRawVector combine(RRaw left, RRawVector right) { + protected RRawVector combine(RRaw left, RRawVector right) { int dataLength = right.getLength(); byte[] result = new byte[dataLength + 1]; for (int i = 0; i < dataLength; ++i) { @@ -85,7 +85,7 @@ public abstract class CombineBinaryRawNode extends CombineBinaryNode { } @Specialization - public RRawVector combine(RRawVector left, RRawVector right) { + protected RRawVector combine(RRawVector left, RRawVector right) { return (RRawVector) genericCombine(left, right); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryStringNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryStringNode.java index 12743d0ba306fc7bb5ec86af1c5753e4ed7154c2..84f1fbbb2a6e1b78cd95c0e46a6087ea88da1737 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryStringNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/CombineBinaryStringNode.java @@ -31,37 +31,37 @@ import com.oracle.truffle.r.runtime.data.*; public abstract class CombineBinaryStringNode extends CombineBinaryNode { @Specialization - public RNull combine(RNull left, RNull right) { + protected RNull combine(RNull left, RNull right) { return RNull.instance; } @Specialization - public String combine(RNull left, String right) { + protected String combine(RNull left, String right) { return right; } @Specialization - public String combine(String left, RNull right) { + protected String combine(String left, RNull right) { return left; } @Specialization - public RStringVector combine(RStringVector left, RNull right) { + protected RStringVector combine(RStringVector left, RNull right) { return left; } @Specialization - public RStringVector combine(RNull left, RStringVector right) { + protected RStringVector combine(RNull left, RStringVector right) { return right; } @Specialization - public RStringVector combine(String left, String right) { + protected RStringVector combine(String left, String right) { return RDataFactory.createStringVector(new String[]{left, right}, RDataFactory.INCOMPLETE_VECTOR); } @Specialization - public RStringVector combine(RStringVector left, String right) { + protected RStringVector combine(RStringVector left, String right) { int dataLength = left.getLength(); String[] result = new String[dataLength + 1]; for (int i = 0; i < dataLength; ++i) { @@ -72,7 +72,7 @@ public abstract class CombineBinaryStringNode extends CombineBinaryNode { } @Specialization - public RStringVector combine(String left, RStringVector right) { + protected RStringVector combine(String left, RStringVector right) { int dataLength = right.getLength(); String[] result = new String[dataLength + 1]; for (int i = 0; i < dataLength; ++i) { @@ -83,7 +83,7 @@ public abstract class CombineBinaryStringNode extends CombineBinaryNode { } @Specialization - public RStringVector combine(RStringVector left, RStringVector right) { + protected RStringVector combine(RStringVector left, RStringVector right) { return (RStringVector) genericCombine(left, right); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/RbindBinaryNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/RbindBinaryNode.java index 80d411dbe31453234b28f2899fd95366086c2dd5..93202e09be8aae1e51b1c06ed612fa7a7fb00b91 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/RbindBinaryNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/RbindBinaryNode.java @@ -30,28 +30,28 @@ import com.oracle.truffle.r.runtime.data.model.*; public abstract class RbindBinaryNode extends CombineBinaryNode { - private BranchProfile everSeenNotEqualCols = new BranchProfile(); + private final BranchProfile everSeenNotEqualCols = new BranchProfile(); @SuppressWarnings("unused") @Specialization - public RNull rbind(RNull left, RNull right) { + protected RNull rbind(RNull left, RNull right) { return RNull.instance; } @SuppressWarnings("unused") @Specialization - public RAbstractVector rbind(RAbstractVector left, RNull right) { + protected RAbstractVector rbind(RAbstractVector left, RNull right) { return left.copyWithNewDimensions(getDimensions(left)); } @SuppressWarnings("unused") @Specialization - public RAbstractVector rbind(RNull left, RAbstractVector right) { + protected RAbstractVector rbind(RNull left, RAbstractVector right) { return right.copyWithNewDimensions(getDimensions(right)); } @Specialization - public RAbstractVector rbind(RAbstractVector left, RAbstractVector right) { + protected RAbstractVector rbind(RAbstractVector left, RAbstractVector right) { return genericRbind(left.materialize(), right.materialize()); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinFactory.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinFactory.java index a35543ac2858c5eac6997807af1f4f292135f31a..a904ad2579d15bda76590c8c9aa2a35fefce3f3d 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinFactory.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinFactory.java @@ -82,5 +82,4 @@ public class RBuiltinFactory { public NodeFactory<RBuiltinNode> getFactory() { return factory; } - } 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 fe09eae89b2bb72ebc2991f7ee017de3944c8972..5c56757e45158728178690f27eb160bcb3f87ba0 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 @@ -57,7 +57,7 @@ public abstract class ForNode extends LoopNode { } @Specialization - public Object doSequence(VirtualFrame frame, int x) { + protected Object doSequence(VirtualFrame frame, int x) { int count = 0; try { cvar.execute(frame, x); @@ -78,7 +78,7 @@ public abstract class ForNode extends LoopNode { } @Specialization - public Object doSequence(VirtualFrame frame, double x) { + protected Object doSequence(VirtualFrame frame, double x) { int count = 0; try { cvar.execute(frame, x); @@ -99,7 +99,7 @@ public abstract class ForNode extends LoopNode { } @Specialization - public Object doSequence(VirtualFrame frame, String x) { + protected Object doSequence(VirtualFrame frame, String x) { int count = 0; try { cvar.execute(frame, x); @@ -120,7 +120,7 @@ public abstract class ForNode extends LoopNode { } @Specialization - public Object doSequence(VirtualFrame frame, RIntSequence range) { + protected Object doSequence(VirtualFrame frame, RIntSequence range) { int count = 0; try { for (int i = 0, pos = range.getStart(); i < range.getLength(); i++, pos += range.getStride()) { @@ -143,7 +143,7 @@ public abstract class ForNode extends LoopNode { } @Specialization - public Object doSequence(VirtualFrame frame, RAbstractVector vector) { + protected Object doSequence(VirtualFrame frame, RAbstractVector vector) { int count = 0; try { for (int i = 0; i < vector.getLength(); ++i) { @@ -166,7 +166,7 @@ public abstract class ForNode extends LoopNode { } @Specialization - public Object doSequence(VirtualFrame frame, RExpression expr) { + protected Object doSequence(VirtualFrame frame, RExpression expr) { return doSequence(frame, expr.getList()); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java index 439881480f21a6b133dcd0ad19bb27477a04e555..7a6a7a4490dc3b498ab56d895305c3d92202079b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentsNode.java @@ -50,7 +50,6 @@ public abstract class ArgumentsNode extends RNode implements ArgumentsTrait { private final int nameCount; protected ArgumentsNode(RNode[] arguments, String[] names) { - super(); this.arguments = arguments; this.names = names; this.nameCount = ArgumentsTrait.countNonNull(names); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/DispatchedCallNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/DispatchedCallNode.java index b25c2d628ec40dc80732a15f0c62ddf06d321829..0166ec7cf6b3b4bc943e5b6bc78ee333f4bd76dc 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/DispatchedCallNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/DispatchedCallNode.java @@ -22,11 +22,9 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; public abstract class DispatchedCallNode extends RNode { private static final int INLINE_CACHE_SIZE = 4; - protected Object[] args; - protected RNode[] argNodes; public static DispatchedCallNode create(final String genericName, final String dispatchType, String[] suppliedArgsNames) { - return new UninitializedDispatchedCallNode(genericName, dispatchType, suppliedArgsNames); + return new UninitializedDispatchedCallNode(genericName, dispatchType, null, suppliedArgsNames); } public static DispatchedCallNode create(final String genericName, final String dispatchType, final Object[] args, String[] suppliedArgsNames) { @@ -48,30 +46,28 @@ public abstract class DispatchedCallNode extends RNode { public abstract Object execute(VirtualFrame frame, RStringVector type); - public abstract Object executeInternal(VirtualFrame frame, RStringVector type, @SuppressWarnings("hiding") Object[] args); + public abstract Object executeInternal(VirtualFrame frame, RStringVector type, Object[] args); private static final class UninitializedDispatchedCallNode extends DispatchedCallNode { protected final int depth; protected final String genericName; protected final String dispatchType; protected final String[] suppliedArgsNames; + protected final Object[] args; - public UninitializedDispatchedCallNode(final String genericName, final String dispatchType, String[] suppliedArgsNames) { - this.genericName = genericName; - this.depth = 0; - this.dispatchType = dispatchType; - this.suppliedArgsNames = suppliedArgsNames; - } - - private UninitializedDispatchedCallNode(final UninitializedDispatchedCallNode copy, final int depth) { + private UninitializedDispatchedCallNode(UninitializedDispatchedCallNode copy, int depth) { this.genericName = copy.genericName; this.dispatchType = copy.dispatchType; this.depth = depth; this.suppliedArgsNames = copy.suppliedArgsNames; + this.args = null; } - public UninitializedDispatchedCallNode(final String genericName, final String dispatchType, final Object[] args, String[] suppliedArgsNames) { - this(genericName, dispatchType, suppliedArgsNames); + public UninitializedDispatchedCallNode(String genericName, String dispatchType, Object[] args, String[] suppliedArgsNames) { + this.depth = 0; + this.genericName = genericName; + this.dispatchType = dispatchType; + this.suppliedArgsNames = suppliedArgsNames; this.args = args; } @@ -123,7 +119,7 @@ public abstract class DispatchedCallNode extends RNode { } @Override - public Object executeInternal(VirtualFrame frame, RStringVector type, @SuppressWarnings("hiding") Object[] args) { + public Object executeInternal(VirtualFrame frame, RStringVector type, Object[] args) { return dcn.executeInternal(frame, type, args); } } @@ -168,7 +164,7 @@ public abstract class DispatchedCallNode extends RNode { } @Override - public Object executeInternal(VirtualFrame frame, RStringVector aType, @SuppressWarnings("hiding") Object[] args) { + public Object executeInternal(VirtualFrame frame, RStringVector aType, Object[] args) { if (isEqualType(this.type, aType)) { return currentNode.executeInternal(frame, args); } @@ -197,7 +193,7 @@ public abstract class DispatchedCallNode extends RNode { } @Override - public Object executeInternal(VirtualFrame frame, RStringVector type, @SuppressWarnings("hiding") Object[] args) { + public Object executeInternal(VirtualFrame frame, RStringVector type, Object[] args) { return Utils.nyi(); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3DispatchNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3DispatchNode.java index 446c0cecec39e926946e2bcc30ca0f22803aee3c..5639d02d96e7963336847f1f93b05154444462b5 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3DispatchNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/S3DispatchNode.java @@ -59,7 +59,7 @@ public abstract class S3DispatchNode extends DispatchNode { } finally { RError.ignoreError(prevIgnoreError); } - if (func != null && func instanceof RFunction) { + if (func instanceof RFunction) { targetFunctionName = functionName; targetFunction = (RFunction) func; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java index 9fd2853dca8732c03a0d1b671b66e1d24aa53b90..94f8edc97b79ea4a1f1ed2883be8dcf24c82dd99 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/WrapArgumentNode.java @@ -30,9 +30,9 @@ import com.oracle.truffle.r.runtime.data.*; @NodeChild(value = "operand", type = RNode.class) public abstract class WrapArgumentNode extends RProxyNode { - private BranchProfile everSeenShared = new BranchProfile(); - private BranchProfile everSeenTemporary = new BranchProfile(); - private BranchProfile everSeenNonTemporary = new BranchProfile(); + private final BranchProfile everSeenShared = new BranchProfile(); + private final BranchProfile everSeenTemporary = new BranchProfile(); + private final BranchProfile everSeenNonTemporary = new BranchProfile(); private final boolean modeChange; 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 c38dc59cb3a94248dfb9fea8c0c271d3153bce76..a3134b0330a752d18aba44b94bf17c53b8c67b6d 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 @@ -44,40 +44,40 @@ public abstract class CastComplexNode extends CastNode { public abstract Object executeComplex(VirtualFrame frame, Object o); @Specialization - public RNull doNull(@SuppressWarnings("unused") RNull operand) { + protected RNull doNull(@SuppressWarnings("unused") RNull operand) { return RNull.instance; } @Specialization - public RComplex doInt(int operand) { + protected RComplex doInt(int operand) { naCheck.enable(operand); return naCheck.convertIntToComplex(operand); } @Specialization - public RComplex doDouble(double operand) { + protected RComplex doDouble(double operand) { naCheck.enable(operand); return naCheck.convertDoubleToComplex(operand); } @Specialization - public RComplex doLogical(byte operand) { + protected RComplex doLogical(byte operand) { naCheck.enable(operand); return naCheck.convertLogicalToComplex(operand); } @Specialization - public RComplex doComplex(RComplex operand) { + protected RComplex doComplex(RComplex operand) { return operand; } @Specialization - public RComplex doRaw(RRaw operand) { + protected RComplex doRaw(RRaw operand) { return RDataFactory.createComplex(operand.getValue(), 0); } @Specialization - public RComplex doCharacter(String operand) { + protected RComplex doCharacter(String operand) { naCheck.enable(operand); RComplex result = naCheck.convertStringToComplex(operand); if (RRuntime.isNA(result)) { @@ -127,17 +127,17 @@ public abstract class CastComplexNode extends CastNode { } @Specialization - public RComplexVector doIntVector(RIntVector operand) { + protected RComplexVector doIntVector(RIntVector operand) { return performAbstractIntVector(operand); } @Specialization - public RComplexVector doIntSequence(RIntSequence operand) { + protected RComplexVector doIntSequence(RIntSequence operand) { return performAbstractIntVector(operand); } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RComplexVector doLogicalVectorDims(RLogicalVector operand) { + protected RComplexVector doLogicalVectorDims(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA(), operand.getDimensions()); if (isAttrPreservation()) { @@ -147,7 +147,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RComplexVector doLogicalVectorNames(RLogicalVector operand) { + protected RComplexVector doLogicalVectorNames(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA(), operand.getNames()); if (isAttrPreservation()) { @@ -157,7 +157,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RComplexVector doLogicalVectorDimsNames(RLogicalVector operand) { + protected RComplexVector doLogicalVectorDimsNames(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA(), operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -167,7 +167,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RComplexVector doLogicalVector(RLogicalVector operand) { + protected RComplexVector doLogicalVector(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -177,7 +177,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RComplexVector doStringVectorDims(RStringVector operand) { + protected RComplexVector doStringVectorDims(RStringVector operand) { double[] ddata = dataFromString(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA(), operand.getDimensions()); if (isAttrPreservation()) { @@ -187,7 +187,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RComplexVector doStringVectorNames(RStringVector operand) { + protected RComplexVector doStringVectorNames(RStringVector operand) { double[] ddata = dataFromString(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA(), operand.getNames()); if (isAttrPreservation()) { @@ -197,7 +197,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RComplexVector doStringVectorDimsNames(RStringVector operand) { + protected RComplexVector doStringVectorDimsNames(RStringVector operand) { double[] ddata = dataFromString(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA(), operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -207,7 +207,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RComplexVector doStringVector(RStringVector operand) { + protected RComplexVector doStringVector(RStringVector operand) { double[] ddata = dataFromString(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -217,22 +217,22 @@ public abstract class CastComplexNode extends CastNode { } @Specialization - public RComplexVector doDoubleVector(RDoubleVector operand) { + protected RComplexVector doDoubleVector(RDoubleVector operand) { return performAbstractDoubleVector(operand); } @Specialization - public RComplexVector doDoubleSequence(RDoubleSequence operand) { + protected RComplexVector doDoubleSequence(RDoubleSequence operand) { return performAbstractDoubleVector(operand); } @Specialization - public RComplexVector doComplexVector(RComplexVector vector) { + protected RComplexVector doComplexVector(RComplexVector vector) { return vector; } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RComplexVector doRawVectorDims(RRawVector operand) { + protected RComplexVector doRawVectorDims(RRawVector operand) { double[] ddata = dataFromRaw(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, RDataFactory.COMPLETE_VECTOR, operand.getDimensions()); if (isAttrPreservation()) { @@ -242,7 +242,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RComplexVector doRawVectorNames(RRawVector operand) { + protected RComplexVector doRawVectorNames(RRawVector operand) { double[] ddata = dataFromRaw(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, RDataFactory.COMPLETE_VECTOR, operand.getNames()); if (isAttrPreservation()) { @@ -252,7 +252,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RComplexVector doRawVectorDimsNames(RRawVector operand) { + protected RComplexVector doRawVectorDimsNames(RRawVector operand) { double[] ddata = dataFromRaw(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, RDataFactory.COMPLETE_VECTOR, operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -262,7 +262,7 @@ public abstract class CastComplexNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RComplexVector doRawVector(RRawVector operand) { + protected RComplexVector doRawVector(RRawVector operand) { double[] ddata = dataFromRaw(operand); RComplexVector ret = RDataFactory.createComplexVector(ddata, RDataFactory.COMPLETE_VECTOR); if (isAttrPreservation()) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java index f44fadc2928f8535c0adef9c673cf32e623b79b9..09f4930e45de1ea51a2ab0a0b19aa2cf44bb4c7c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleNode.java @@ -54,23 +54,23 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization - public RNull doNull(@SuppressWarnings("unused") RNull operand) { + protected RNull doNull(@SuppressWarnings("unused") RNull operand) { return RNull.instance; } @Specialization - public double doInt(int operand) { + protected double doInt(int operand) { naCheck.enable(operand); return naCheck.convertIntToDouble(operand); } @Specialization - public double doDouble(double operand) { + protected double doDouble(double operand) { return operand; } @Specialization - public double doDouble(RComplex operand) { + protected double doDouble(RComplex operand) { naCheck.enable(operand); double result = naCheck.convertComplexToDouble(operand); if (operand.getImaginaryPart() != 0.0) { @@ -80,7 +80,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization - public double doLogical(byte operand) { + protected double doLogical(byte operand) { naCheck.enable(operand); return naCheck.convertLogicalToDouble(operand); } @@ -96,7 +96,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization - public double doRaw(RRaw operand) { + protected double doRaw(RRaw operand) { return RRuntime.raw2double(operand); } @@ -154,17 +154,17 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization - public RDoubleVector doIntVector(RIntVector operand) { + protected RDoubleVector doIntVector(RIntVector operand) { return performAbstractIntVector(operand); } @Specialization - public RDoubleVector doIntVector(RIntSequence operand) { + protected RDoubleVector doIntVector(RIntSequence operand) { return performAbstractIntVector(operand); } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RDoubleVector doLogicalVectorDims(RLogicalVector operand) { + protected RDoubleVector doLogicalVectorDims(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getDimensions()); if (isAttrPreservation()) { @@ -174,7 +174,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RDoubleVector doLogicalVectorNames(RLogicalVector operand) { + protected RDoubleVector doLogicalVectorNames(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getNames()); if (isAttrPreservation()) { @@ -184,7 +184,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RDoubleVector doLogicalVectorDimsNames(RLogicalVector operand) { + protected RDoubleVector doLogicalVectorDimsNames(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -194,7 +194,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RDoubleVector doLogicalVector(RLogicalVector operand) { + protected RDoubleVector doLogicalVector(RLogicalVector operand) { double[] ddata = dataFromLogical(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -204,7 +204,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RDoubleVector doStringVectorDims(RStringVector operand) { + protected RDoubleVector doStringVectorDims(RStringVector operand) { double[] ddata = dataFromString(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getDimensions()); if (isAttrPreservation()) { @@ -214,7 +214,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RDoubleVector doStringVectorNames(RStringVector operand) { + protected RDoubleVector doStringVectorNames(RStringVector operand) { double[] ddata = dataFromString(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getNames()); if (isAttrPreservation()) { @@ -224,7 +224,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RDoubleVector doStringVectorDimsNames(RStringVector operand) { + protected RDoubleVector doStringVectorDimsNames(RStringVector operand) { double[] ddata = dataFromString(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -234,7 +234,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RDoubleVector doStringVector(RStringVector operand) { + protected RDoubleVector doStringVector(RStringVector operand) { double[] ddata = dataFromString(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -244,7 +244,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RDoubleVector doComplexVectorDims(RComplexVector operand) { + protected RDoubleVector doComplexVectorDims(RComplexVector operand) { double[] ddata = dataFromComplex(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getDimensions()); if (isAttrPreservation()) { @@ -254,7 +254,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RDoubleVector doComplexVectorNames(RComplexVector operand) { + protected RDoubleVector doComplexVectorNames(RComplexVector operand) { double[] ddata = dataFromComplex(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getNames()); if (isAttrPreservation()) { @@ -264,7 +264,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RDoubleVector doComplexVectorDimsNames(RComplexVector operand) { + protected RDoubleVector doComplexVectorDimsNames(RComplexVector operand) { double[] ddata = dataFromComplex(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -274,7 +274,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RDoubleVector doComplexVector(RComplexVector operand) { + protected RDoubleVector doComplexVector(RComplexVector operand) { double[] ddata = dataFromComplex(operand); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -284,7 +284,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RDoubleVector doRawVectorDims(RRawVector vector) { + protected RDoubleVector doRawVectorDims(RRawVector vector) { double[] ddata = dataFromRaw(vector); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), vector.getDimensions()); if (isAttrPreservation()) { @@ -294,7 +294,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RDoubleVector doRawVectorNames(RRawVector vector) { + protected RDoubleVector doRawVectorNames(RRawVector vector) { double[] ddata = dataFromRaw(vector); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), vector.getNames()); if (isAttrPreservation()) { @@ -304,7 +304,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RDoubleVector doRawVectorDimsNames(RRawVector vector) { + protected RDoubleVector doRawVectorDimsNames(RRawVector vector) { double[] ddata = dataFromRaw(vector); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA(), vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -314,7 +314,7 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RDoubleVector doRawVector(RRawVector vector) { + protected RDoubleVector doRawVector(RRawVector vector) { double[] ddata = dataFromRaw(vector); RDoubleVector ret = RDataFactory.createDoubleVector(ddata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -324,17 +324,17 @@ public abstract class CastDoubleNode extends CastNode { } @Specialization - public RDoubleVector doDoubleVector(RDoubleVector operand) { + protected RDoubleVector doDoubleVector(RDoubleVector operand) { return operand; } @Specialization - public RDoubleSequence doDoubleSequence(RDoubleSequence operand) { + protected RDoubleSequence doDoubleSequence(RDoubleSequence operand) { return operand; } @Specialization - public RDoubleVector doList(VirtualFrame frame, RList list) { + protected RDoubleVector doList(VirtualFrame frame, RList list) { int length = list.getLength(); double[] result = new double[length]; for (int i = 0; i < length; i++) { 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 cd9ebd1d594e06ae450a17632532afde00037b0f..e8c305c66f3c3f4f7c5a7f55401b85b80d406c42 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 @@ -53,44 +53,44 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization - public RNull doNull(@SuppressWarnings("unused") RNull operand) { + protected RNull doNull(@SuppressWarnings("unused") RNull operand) { return RNull.instance; } @Specialization - public RMissing doMissing(RMissing operand) { + protected RMissing doMissing(RMissing operand) { return operand; } @Specialization - public int doInt(int operand) { + protected int doInt(int operand) { return operand; } @Specialization - public int doDouble(double operand) { + protected int doDouble(double operand) { check.enable(operand); return check.convertDoubleToInt(operand); } @Specialization - public RIntVector doIntVector(RIntVector operand) { + protected RIntVector doIntVector(RIntVector operand) { return operand; } @Specialization - public RIntSequence doIntSequence(RIntSequence operand) { + protected RIntSequence doIntSequence(RIntSequence operand) { return operand; } @Specialization - public RIntSequence doDoubleSequence(RDoubleSequence operand) { + protected RIntSequence doDoubleSequence(RDoubleSequence operand) { check.enable(operand); return RDataFactory.createIntSequence(check.convertDoubleToInt(operand.getStart()), check.convertDoubleToInt(operand.getStride()), operand.getLength()); } @Specialization - public int doComplex(RComplex operand) { + protected int doComplex(RComplex operand) { check.enable(operand); int result = check.convertComplexToInt(operand); if (operand.getImaginaryPart() != 0.0) { @@ -100,7 +100,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization - public int doCharacter(String operand) { + protected int doCharacter(String operand) { check.enable(operand); int result = check.convertStringToInt(operand); if (isNA(result)) { @@ -110,13 +110,13 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization - public int doBoolean(byte operand) { + protected int doBoolean(byte operand) { check.enable(operand); return check.convertLogicalToInt(operand); } @Specialization - public int doRaw(RRaw operand) { + protected int doRaw(RRaw operand) { return RRuntime.raw2int(operand); } @@ -175,7 +175,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RIntVector doComplexVectorDims(RComplexVector vector) { + protected RIntVector doComplexVectorDims(RComplexVector vector) { int[] result = dataFromComplex(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions()); if (isAttrPreservation()) { @@ -185,7 +185,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RIntVector doComplexVectorNames(RComplexVector vector) { + protected RIntVector doComplexVectorNames(RComplexVector vector) { int[] result = dataFromComplex(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getNames()); if (isAttrPreservation()) { @@ -195,7 +195,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RIntVector doComplexVectorDimsNames(RComplexVector vector) { + protected RIntVector doComplexVectorDimsNames(RComplexVector vector) { int[] result = dataFromComplex(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -205,7 +205,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RIntVector doComplexVector(RComplexVector vector) { + protected RIntVector doComplexVector(RComplexVector vector) { int[] result = dataFromComplex(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA()); if (isAttrPreservation()) { @@ -215,7 +215,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RIntVector doStringVectorDims(RStringVector vector) { + protected RIntVector doStringVectorDims(RStringVector vector) { int[] result = dataFromString(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions()); if (isAttrPreservation()) { @@ -225,7 +225,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RIntVector doStringVectorNames(RStringVector vector) { + protected RIntVector doStringVectorNames(RStringVector vector) { int[] result = dataFromString(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getNames()); if (isAttrPreservation()) { @@ -235,7 +235,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RIntVector doStringVectorDimsNames(RStringVector vector) { + protected RIntVector doStringVectorDimsNames(RStringVector vector) { int[] result = dataFromString(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -245,7 +245,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RIntVector doStringVector(RStringVector vector) { + protected RIntVector doStringVector(RStringVector vector) { int[] result = dataFromString(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA()); if (isAttrPreservation()) { @@ -255,7 +255,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RIntVector doLogicalVectorDims(RLogicalVector vector) { + protected RIntVector doLogicalVectorDims(RLogicalVector vector) { int[] result = dataFromLogical(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions()); if (isAttrPreservation()) { @@ -265,7 +265,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RIntVector doLogicalVectorNames(RLogicalVector vector) { + protected RIntVector doLogicalVectorNames(RLogicalVector vector) { int[] result = dataFromLogical(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getNames()); if (isAttrPreservation()) { @@ -275,7 +275,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RIntVector doLogicalVectorDimsNames(RLogicalVector vector) { + protected RIntVector doLogicalVectorDimsNames(RLogicalVector vector) { int[] result = dataFromLogical(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -295,7 +295,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RIntVector doDoubleVectorDims(RDoubleVector vector) { + protected RIntVector doDoubleVectorDims(RDoubleVector vector) { check.enable(vector); int[] result = check.convertDoubleVectorToIntData(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions()); @@ -306,7 +306,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RIntVector doDoubleVectorNames(RDoubleVector vector) { + protected RIntVector doDoubleVectorNames(RDoubleVector vector) { check.enable(vector); int[] result = check.convertDoubleVectorToIntData(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getNames()); @@ -317,7 +317,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RIntVector doDoubleVectorDimsNames(RDoubleVector vector) { + protected RIntVector doDoubleVectorDimsNames(RDoubleVector vector) { check.enable(vector); int[] result = check.convertDoubleVectorToIntData(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions(), vector.getNames()); @@ -328,7 +328,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RIntVector doDoubleVector(RDoubleVector vector) { + protected RIntVector doDoubleVector(RDoubleVector vector) { check.enable(vector); int[] result = check.convertDoubleVectorToIntData(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA()); @@ -339,7 +339,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RIntVector doRawVectorDims(RRawVector vector) { + protected RIntVector doRawVectorDims(RRawVector vector) { int[] result = dataFromRaw(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions()); if (isAttrPreservation()) { @@ -349,7 +349,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RIntVector doRawVectorNames(RRawVector vector) { + protected RIntVector doRawVectorNames(RRawVector vector) { int[] result = dataFromRaw(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getNames()); if (isAttrPreservation()) { @@ -359,7 +359,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RIntVector doRawVectorDimsNames(RRawVector vector) { + protected RIntVector doRawVectorDimsNames(RRawVector vector) { int[] result = dataFromRaw(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA(), vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -369,7 +369,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RIntVector doRawVector(RRawVector vector) { + protected RIntVector doRawVector(RRawVector vector) { int[] result = dataFromRaw(vector); RIntVector ret = RDataFactory.createIntVector(result, check.neverSeenNA()); if (isAttrPreservation()) { @@ -379,7 +379,7 @@ public abstract class CastIntegerNode extends CastNode { } @Specialization - public RIntVector doList(VirtualFrame frame, RList list) { + protected RIntVector doList(VirtualFrame frame, RList list) { int length = list.getLength(); int[] result = new int[length]; for (int i = 0; i < length; i++) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java index 5337a1777690d44119398619ca0f47ec82887ca3..45f7d3ea03b46bfec400843eed663238ba928446 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastListNode.java @@ -33,22 +33,22 @@ public abstract class CastListNode extends CastNode { @Specialization @SuppressWarnings("unused") - public RList doNull(RNull operand) { + protected RList doNull(RNull operand) { return RDataFactory.createList(); } @Specialization - public RList doDouble(double operand) { + protected RList doDouble(double operand) { return RDataFactory.createList(new Object[]{operand}); } @Specialization - public RList doInt(int operand) { + protected RList doInt(int operand) { return RDataFactory.createList(new Object[]{operand}); } @Specialization - public RList doAbstractVector(RAbstractVector operand) { + protected RList doAbstractVector(RAbstractVector operand) { Object[] data = new Object[operand.getLength()]; for (int i = 0; i < data.length; ++i) { data[i] = operand.getDataAtAsObject(i); 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 a0fa8c3af8e8f66779f63cdec3eb440aab800094..3c267508db67011d6584d4b2d702149e304a781c 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 @@ -50,41 +50,41 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization - public RNull doNull(@SuppressWarnings("unused") RNull operand) { + protected RNull doNull(@SuppressWarnings("unused") RNull operand) { return RNull.instance; } @Specialization - public byte doLogical(byte operand) { + protected byte doLogical(byte operand) { return operand; } @Specialization - public byte doDouble(double operand) { + protected byte doDouble(double operand) { naCheck.enable(operand); return naCheck.convertDoubleToLogical(operand); } @Specialization - public byte doInt(int operand) { + protected byte doInt(int operand) { naCheck.enable(operand); return naCheck.convertIntToLogical(operand); } @Specialization - public byte doComplex(RComplex operand) { + protected byte doComplex(RComplex operand) { naCheck.enable(operand); return naCheck.convertComplexToLogical(operand); } @Specialization - public byte doString(String operand) { + protected byte doString(String operand) { naCheck.enable(operand); return naCheck.convertStringToLogical(operand); } @Specialization - public byte doRaw(RRaw operand) { + protected byte doRaw(RRaw operand) { return RRuntime.raw2logical(operand); } @@ -118,32 +118,32 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization - public RLogicalVector doLogicalVector(RLogicalVector operand) { + protected RLogicalVector doLogicalVector(RLogicalVector operand) { return operand; } @Specialization - public RLogicalVector doIntVector(RIntVector operand) { + protected RLogicalVector doIntVector(RIntVector operand) { return performAbstractIntVector(operand); } @Specialization - public RLogicalVector doIntSequence(RIntSequence operand) { + protected RLogicalVector doIntSequence(RIntSequence operand) { return performAbstractIntVector(operand); } @Specialization - public RLogicalVector doDoubleVector(RDoubleVector operand) { + protected RLogicalVector doDoubleVector(RDoubleVector operand) { return performAbstractDoubleVector(operand); } @Specialization - public RLogicalVector doDoubleSequence(RDoubleSequence operand) { + protected RLogicalVector doDoubleSequence(RDoubleSequence operand) { return performAbstractDoubleVector(operand); } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RLogicalVector doStringVectorDims(RStringVector operand) { + protected RLogicalVector doStringVectorDims(RStringVector operand) { byte[] ldata = dataFromString(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA(), operand.getDimensions()); if (isAttrPreservation()) { @@ -153,7 +153,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RLogicalVector doStringVectorNames(RStringVector operand) { + protected RLogicalVector doStringVectorNames(RStringVector operand) { byte[] ldata = dataFromString(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA(), operand.getNames()); if (isAttrPreservation()) { @@ -163,7 +163,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RLogicalVector doStringVectorDimsNames(RStringVector operand) { + protected RLogicalVector doStringVectorDimsNames(RStringVector operand) { byte[] ldata = dataFromString(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA(), operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -173,7 +173,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RLogicalVector doStringVector(RStringVector operand) { + protected RLogicalVector doStringVector(RStringVector operand) { byte[] ldata = dataFromString(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -183,7 +183,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RLogicalVector doComplexVectorDims(RComplexVector operand) { + protected RLogicalVector doComplexVectorDims(RComplexVector operand) { byte[] ldata = dataFromComplex(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA(), operand.getDimensions()); if (isAttrPreservation()) { @@ -193,7 +193,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RLogicalVector doComplexVectorNames(RComplexVector operand) { + protected RLogicalVector doComplexVectorNames(RComplexVector operand) { byte[] ldata = dataFromComplex(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA(), operand.getNames()); if (isAttrPreservation()) { @@ -203,7 +203,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RLogicalVector doComplexVectorDimsNames(RComplexVector operand) { + protected RLogicalVector doComplexVectorDimsNames(RComplexVector operand) { byte[] ldata = dataFromComplex(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA(), operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -213,7 +213,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RLogicalVector doComplexVector(RComplexVector operand) { + protected RLogicalVector doComplexVector(RComplexVector operand) { byte[] ldata = dataFromComplex(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, naCheck.neverSeenNA()); if (isAttrPreservation()) { @@ -223,7 +223,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RLogicalVector doRawVectorDims(RRawVector operand) { + protected RLogicalVector doRawVectorDims(RRawVector operand) { byte[] ldata = dataFromRaw(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, RDataFactory.COMPLETE_VECTOR, operand.getDimensions()); if (isAttrPreservation()) { @@ -233,7 +233,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RLogicalVector doRawVectorNames(RRawVector operand) { + protected RLogicalVector doRawVectorNames(RRawVector operand) { byte[] ldata = dataFromRaw(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, RDataFactory.COMPLETE_VECTOR, operand.getNames()); if (isAttrPreservation()) { @@ -243,7 +243,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RLogicalVector doRawVectorDimsNames(RRawVector operand) { + protected RLogicalVector doRawVectorDimsNames(RRawVector operand) { byte[] ldata = dataFromRaw(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, RDataFactory.COMPLETE_VECTOR, operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -253,7 +253,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RLogicalVector doRawVector(RRawVector operand) { + protected RLogicalVector doRawVector(RRawVector operand) { byte[] ldata = dataFromRaw(operand); RLogicalVector ret = RDataFactory.createLogicalVector(ldata, RDataFactory.COMPLETE_VECTOR); if (isAttrPreservation()) { @@ -263,7 +263,7 @@ public abstract class CastLogicalNode extends CastNode { } @Specialization - public RLogicalVector doList(VirtualFrame frame, RList list) { + protected RLogicalVector doList(VirtualFrame frame, RList list) { int length = list.getLength(); byte[] result = new byte[length]; for (int i = 0; i < length; i++) { 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 7b6cb328304a46301c33e71dd29c83be58cdb146..a1ca5345fe3961ed500b659734e143f9d1449b82 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 @@ -41,12 +41,12 @@ public abstract class CastRawNode extends CastNode { public abstract Object executeRaw(VirtualFrame frame, Object o); @Specialization - public RNull doNull(@SuppressWarnings("unused") RNull operand) { + protected RNull doNull(@SuppressWarnings("unused") RNull operand) { return RNull.instance; } @Specialization - public RRaw doInt(int operand) { + protected RRaw doInt(int operand) { int intResult = RRuntime.int2rawIntValue(operand); if (intResult != operand) { RError.warning(RError.Message.OUT_OF_RANGE); @@ -55,7 +55,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization - public RRaw doDouble(double operand) { + protected RRaw doDouble(double operand) { int intResult = RRuntime.double2rawIntValue(operand); if (intResult != (int) operand) { RError.warning(RError.Message.OUT_OF_RANGE); @@ -64,7 +64,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization - public RRaw doComplex(RComplex operand) { + protected RRaw doComplex(RComplex operand) { int intResult = RRuntime.complex2rawIntValue(operand); if (operand.getImaginaryPart() != 0) { RError.warning(RError.Message.IMAGINARY_PARTS_DISCARDED_IN_COERCION); @@ -76,19 +76,19 @@ public abstract class CastRawNode extends CastNode { } @Specialization - public RRaw doRaw(RRaw operand) { + protected RRaw doRaw(RRaw operand) { return operand; } @Specialization - public RRaw doLogical(byte operand) { + protected RRaw doLogical(byte operand) { // need to convert to int so that NA-related warning is caught int intVal = RRuntime.logical2int(operand); return doInt(intVal); } @Specialization - public RRaw doString(String operand) { + protected RRaw doString(String operand) { // need to cast to int to catch conversion warnings int intVal = RRuntime.string2int(operand); if (RRuntime.isNA(intVal)) { @@ -163,17 +163,17 @@ public abstract class CastRawNode extends CastNode { } @Specialization - public RRawVector doIntVector(RIntVector value) { + protected RRawVector doIntVector(RIntVector value) { return performAbstractIntVector(value); } @Specialization - public RRawVector doIntSequence(RIntSequence value) { + protected RRawVector doIntSequence(RIntSequence value) { return performAbstractIntVector(value); } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RRawVector doLogicalVectorDims(RLogicalVector operand) { + protected RRawVector doLogicalVectorDims(RLogicalVector operand) { byte[] bdata = dataFromLogical(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getDimensions()); if (isAttrPreservation()) { @@ -183,7 +183,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RRawVector doLogicalVectorNames(RLogicalVector operand) { + protected RRawVector doLogicalVectorNames(RLogicalVector operand) { byte[] bdata = dataFromLogical(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getNames()); if (isAttrPreservation()) { @@ -193,7 +193,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RRawVector doLogicalVectorDimsNames(RLogicalVector operand) { + protected RRawVector doLogicalVectorDimsNames(RLogicalVector operand) { byte[] bdata = dataFromLogical(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -203,7 +203,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RRawVector doLogicalVector(RLogicalVector operand) { + protected RRawVector doLogicalVector(RLogicalVector operand) { byte[] bdata = dataFromLogical(operand); RRawVector ret = RDataFactory.createRawVector(bdata); if (isAttrPreservation()) { @@ -213,7 +213,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RRawVector doStringVectorDims(RStringVector operand) { + protected RRawVector doStringVectorDims(RStringVector operand) { byte[] bdata = dataFromString(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getDimensions()); if (isAttrPreservation()) { @@ -223,7 +223,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RRawVector doStringVectorNames(RStringVector operand) { + protected RRawVector doStringVectorNames(RStringVector operand) { byte[] bdata = dataFromString(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getNames()); if (isAttrPreservation()) { @@ -233,7 +233,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RRawVector doStringVectorDimsNames(RStringVector operand) { + protected RRawVector doStringVectorDimsNames(RStringVector operand) { byte[] bdata = dataFromString(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -243,7 +243,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RRawVector doStringVector(RStringVector operand) { + protected RRawVector doStringVector(RStringVector operand) { byte[] bdata = dataFromString(operand); RRawVector ret = RDataFactory.createRawVector(bdata); if (isAttrPreservation()) { @@ -253,7 +253,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"!preserveNames", "preserveDimensions"}) - public RRawVector doRawVectorDims(RComplexVector operand) { + protected RRawVector doRawVectorDims(RComplexVector operand) { byte[] bdata = dataFromComplex(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getDimensions()); if (isAttrPreservation()) { @@ -263,7 +263,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"preserveNames", "!preserveDimensions"}) - public RRawVector doComplexVectorNames(RComplexVector operand) { + protected RRawVector doComplexVectorNames(RComplexVector operand) { byte[] bdata = dataFromComplex(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getNames()); if (isAttrPreservation()) { @@ -273,7 +273,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"preserveNames", "preserveDimensions"}) - public RRawVector doComplexVectorDimsNames(RComplexVector operand) { + protected RRawVector doComplexVectorDimsNames(RComplexVector operand) { byte[] bdata = dataFromComplex(operand); RRawVector ret = RDataFactory.createRawVector(bdata, operand.getDimensions(), operand.getNames()); if (isAttrPreservation()) { @@ -283,7 +283,7 @@ public abstract class CastRawNode extends CastNode { } @Specialization(guards = {"!preserveNames", "!preserveDimensions"}) - public RRawVector doComplexVector(RComplexVector operand) { + protected RRawVector doComplexVector(RComplexVector operand) { byte[] bdata = dataFromComplex(operand); RRawVector ret = RDataFactory.createRawVector(bdata); if (isAttrPreservation()) { @@ -293,17 +293,17 @@ public abstract class CastRawNode extends CastNode { } @Specialization - public RRawVector doDoubleVector(RDoubleVector value) { + protected RRawVector doDoubleVector(RDoubleVector value) { return performAbstractDoubleVector(value); } @Specialization - public RRawVector doDoubleSequence(RDoubleSequence value) { + protected RRawVector doDoubleSequence(RDoubleSequence value) { return performAbstractDoubleVector(value); } @Specialization - public RRawVector doRawVector(RRawVector operand) { + protected RRawVector doRawVector(RRawVector operand) { return operand; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastStringNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastStringNode.java index 1291001b22c49c84b26bf3d257c1bf8d3b58aacc..69486c54db6d7a9862626e7d9e57125fcc11ec24 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastStringNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastStringNode.java @@ -47,32 +47,32 @@ public abstract class CastStringNode extends CastNode { } @Specialization - public RNull doNull(@SuppressWarnings("unused") RNull operand) { + protected RNull doNull(@SuppressWarnings("unused") RNull operand) { return RNull.instance; } @Specialization - public String doString(String value) { + protected String doString(String value) { return value; } @Specialization - public String doInteger(VirtualFrame frame, int value) { + protected String doInteger(VirtualFrame frame, int value) { return toString.executeString(frame, value); } @Specialization - public String doDouble(VirtualFrame frame, double value) { + protected String doDouble(VirtualFrame frame, double value) { return toString.executeString(frame, value); } @Specialization - public String doLogical(VirtualFrame frame, byte value) { + protected String doLogical(VirtualFrame frame, byte value) { return toString.executeString(frame, value); } @Specialization - public String doRaw(VirtualFrame frame, RRaw value) { + protected String doRaw(VirtualFrame frame, RRaw value) { return toString.executeString(frame, value); } @@ -113,37 +113,37 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = "isZeroLength") - public Object doEmptyVector(@SuppressWarnings("unused") RAbstractVector vector) { + protected Object doEmptyVector(@SuppressWarnings("unused") RAbstractVector vector) { return isEmptyVectorConvertedToNull() ? RNull.instance : RDataFactory.createStringVector(0); } @Specialization(guards = "!isZeroLength") - public RStringVector doStringVector(RStringVector vector) { + protected RStringVector doStringVector(RStringVector vector) { return vector; } @Specialization(guards = "!isZeroLength") - public RStringVector doIntVector(VirtualFrame frame, RIntVector vector) { + protected RStringVector doIntVector(VirtualFrame frame, RIntVector vector) { return performAbstractIntVector(frame, vector); } @Specialization(guards = "!isZeroLength") - public RStringVector doDoubleVector(VirtualFrame frame, RDoubleVector vector) { + protected RStringVector doDoubleVector(VirtualFrame frame, RDoubleVector vector) { return performAbstractDoubleVector(frame, vector); } @Specialization(guards = "!isZeroLength") - public RStringVector doIntSequence(VirtualFrame frame, RIntSequence vector) { + protected RStringVector doIntSequence(VirtualFrame frame, RIntSequence vector) { return performAbstractIntVector(frame, vector); } @Specialization(guards = "!isZeroLength") - public RStringVector doDoubleSequence(VirtualFrame frame, RDoubleSequence vector) { + protected RStringVector doDoubleSequence(VirtualFrame frame, RDoubleSequence vector) { return performAbstractDoubleVector(frame, vector); } @Specialization(guards = {"!isZeroLength", "!preserveNames", "preserveDimensions"}) - public RStringVector doLogicalVectorDims(VirtualFrame frame, RLogicalVector vector) { + protected RStringVector doLogicalVectorDims(VirtualFrame frame, RLogicalVector vector) { String[] result = dataFromLogical(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getDimensions()); if (isAttrPreservation()) { @@ -153,7 +153,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "!preserveDimensions"}) - public RStringVector doLogicalVectorNames(VirtualFrame frame, RLogicalVector vector) { + protected RStringVector doLogicalVectorNames(VirtualFrame frame, RLogicalVector vector) { String[] result = dataFromLogical(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getNames()); if (isAttrPreservation()) { @@ -163,7 +163,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "preserveDimensions"}) - public RStringVector doLogicalVectorDimsNames(VirtualFrame frame, RLogicalVector vector) { + protected RStringVector doLogicalVectorDimsNames(VirtualFrame frame, RLogicalVector vector) { String[] result = dataFromLogical(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -173,7 +173,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "!preserveNames", "!preserveDimensions"}) - public RStringVector doLogicalVector(VirtualFrame frame, RLogicalVector vector) { + protected RStringVector doLogicalVector(VirtualFrame frame, RLogicalVector vector) { String[] result = dataFromLogical(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR); if (isAttrPreservation()) { @@ -183,7 +183,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "!preserveNames", "preserveDimensions"}) - public RStringVector doComplexVectorDims(VirtualFrame frame, RComplexVector vector) { + protected RStringVector doComplexVectorDims(VirtualFrame frame, RComplexVector vector) { String[] result = dataFromComplex(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getDimensions()); if (isAttrPreservation()) { @@ -193,7 +193,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "!preserveDimensions"}) - public RStringVector doComplexVectorNames(VirtualFrame frame, RComplexVector vector) { + protected RStringVector doComplexVectorNames(VirtualFrame frame, RComplexVector vector) { String[] result = dataFromComplex(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getNames()); if (isAttrPreservation()) { @@ -203,7 +203,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "preserveDimensions"}) - public RStringVector doComplexVectorDimsNames(VirtualFrame frame, RComplexVector vector) { + protected RStringVector doComplexVectorDimsNames(VirtualFrame frame, RComplexVector vector) { String[] result = dataFromComplex(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -213,7 +213,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "!preserveNames", "!preserveDimensions"}) - public RStringVector doComplexVector(VirtualFrame frame, RComplexVector vector) { + protected RStringVector doComplexVector(VirtualFrame frame, RComplexVector vector) { String[] result = dataFromComplex(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR); if (isAttrPreservation()) { @@ -223,7 +223,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "!preserveNames", "preserveDimensions"}) - public RStringVector doRawVectorDims(VirtualFrame frame, RRawVector vector) { + protected RStringVector doRawVectorDims(VirtualFrame frame, RRawVector vector) { String[] result = dataFromRaw(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getDimensions()); if (isAttrPreservation()) { @@ -233,7 +233,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "!preserveDimensions"}) - public RStringVector doRawVectorNames(VirtualFrame frame, RRawVector vector) { + protected RStringVector doRawVectorNames(VirtualFrame frame, RRawVector vector) { String[] result = dataFromRaw(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getNames()); if (isAttrPreservation()) { @@ -243,7 +243,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "preserveDimensions"}) - public RStringVector doRawVectorDimsNames(VirtualFrame frame, RRawVector vector) { + protected RStringVector doRawVectorDimsNames(VirtualFrame frame, RRawVector vector) { String[] result = dataFromRaw(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, vector.getDimensions(), vector.getNames()); if (isAttrPreservation()) { @@ -253,7 +253,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "!preserveNames", "!preserveDimensions"}) - public RStringVector doRawVector(VirtualFrame frame, RRawVector vector) { + protected RStringVector doRawVector(VirtualFrame frame, RRawVector vector) { String[] result = dataFromRaw(frame, vector); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR); if (isAttrPreservation()) { @@ -263,7 +263,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "!preserveNames", "preserveDimensions"}) - public RStringVector doListDims(VirtualFrame frame, RList list) { + protected RStringVector doListDims(VirtualFrame frame, RList list) { String[] result = dataFromList(frame, list); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, list.getDimensions()); if (isAttrPreservation()) { @@ -273,7 +273,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "!preserveDimensions"}) - public RStringVector doListNames(VirtualFrame frame, RList list) { + protected RStringVector doListNames(VirtualFrame frame, RList list) { String[] result = dataFromList(frame, list); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, list.getNames()); if (isAttrPreservation()) { @@ -283,7 +283,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "preserveNames", "preserveDimensions"}) - public RStringVector doListDimsNames(VirtualFrame frame, RList list) { + protected RStringVector doListDimsNames(VirtualFrame frame, RList list) { String[] result = dataFromList(frame, list); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR, list.getDimensions(), list.getNames()); if (isAttrPreservation()) { @@ -293,7 +293,7 @@ public abstract class CastStringNode extends CastNode { } @Specialization(guards = {"!isZeroLength", "!preserveNames", "!preserveDimensions"}) - public RStringVector doList(VirtualFrame frame, RList list) { + protected RStringVector doList(VirtualFrame frame, RList list) { String[] result = dataFromList(frame, list); RStringVector ret = RDataFactory.createStringVector(result, RDataFactory.COMPLETE_VECTOR); if (isAttrPreservation()) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastSymbolNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastSymbolNode.java index 82a605f67a383e151e3f183f7496142f8c62368a..2e0d66c2d037182ce94a4ee0da2815f84482319c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastSymbolNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastSymbolNode.java @@ -36,48 +36,48 @@ public abstract class CastSymbolNode extends CastNode { @SuppressWarnings("unused") @Specialization - public RSymbol doNull(VirtualFrame frame, RNull value) { + protected RSymbol doNull(VirtualFrame frame, RNull value) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_TYPE_LENGTH, "symbol", 0); } @Specialization - public RSymbol doInteger(VirtualFrame frame, int value) { + protected RSymbol doInteger(VirtualFrame frame, int value) { return backQuote(toString.executeString(frame, value)); } @Specialization - public RSymbol doDouble(VirtualFrame frame, double value) { + protected RSymbol doDouble(VirtualFrame frame, double value) { return backQuote(toString.executeString(frame, value)); } @Specialization - public RSymbol doLogical(VirtualFrame frame, byte value) { + protected RSymbol doLogical(VirtualFrame frame, byte value) { return backQuote(toString.executeString(frame, value)); } @Specialization - public RSymbol doString(String value) { + protected RSymbol doString(String value) { return RDataFactory.createSymbol(value); } @Specialization - public RSymbol doStringVector(@SuppressWarnings("unused") VirtualFrame frame, RStringVector value) { + protected RSymbol doStringVector(@SuppressWarnings("unused") VirtualFrame frame, RStringVector value) { // Only element 0 interpreted return doString(value.getDataAt(0)); } @Specialization - public RSymbol doIntegerVector(VirtualFrame frame, RIntVector value) { + protected RSymbol doIntegerVector(VirtualFrame frame, RIntVector value) { return doInteger(frame, value.getDataAt(0)); } @Specialization - public RSymbol doDoubleVector(VirtualFrame frame, RDoubleVector value) { + protected RSymbol doDoubleVector(VirtualFrame frame, RDoubleVector value) { return doDouble(frame, value.getDataAt(0)); } @Specialization - public RSymbol doLogicalVector(VirtualFrame frame, RLogicalVector value) { + protected RSymbol doLogicalVector(VirtualFrame frame, RLogicalVector value) { return doLogical(frame, value.getDataAt(0)); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToContainerNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToContainerNode.java index a77dfb46c701e939deeb6f6e1b1a3d1dd23c849e..95c592ceb2955f0b61772581b2c50e744d9c96b0 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToContainerNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToContainerNode.java @@ -42,44 +42,44 @@ public abstract class CastToContainerNode extends CastNode { @Specialization(guards = "preserveNonContainer") @SuppressWarnings("unused") - public RNull castNull(RNull rnull) { + protected RNull castNull(RNull rnull) { return RNull.instance; } @Specialization(guards = "!preserveNonContainer") @SuppressWarnings("unused") - public RAbstractVector cast(RNull rnull) { + protected RAbstractVector cast(RNull rnull) { return RDataFactory.createList(); } @Specialization(guards = "preserveNonContainer") - public RFunction castFunction(RFunction f) { + protected RFunction castFunction(RFunction f) { return f; } @Specialization(guards = "!preserveNonContainer") @SuppressWarnings("unused") - public RAbstractVector cast(RFunction f) { + protected RAbstractVector cast(RFunction f) { return RDataFactory.createList(); } @Specialization - public RAbstractVector cast(RAbstractVector vector) { + protected RAbstractVector cast(RAbstractVector vector) { return vector; } @Specialization - public RDataFrame cast(RDataFrame dataFrame) { + protected RDataFrame cast(RDataFrame dataFrame) { return dataFrame; } @Specialization - public RExpression cast(RExpression expression) { + protected RExpression cast(RExpression expression) { return expression; } @Specialization - public RPairList cast(RPairList pairlist) { + protected RPairList cast(RPairList pairlist) { return pairlist; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToVectorNode.java index 2ab4db4da8c3515d2f3b30e7c574073416d1b689..1265f614724f7df9d285e3cdb5aa146771ca0327 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToVectorNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastToVectorNode.java @@ -40,29 +40,29 @@ public abstract class CastToVectorNode extends CastNode { @Specialization(guards = "preserveNonVector") @SuppressWarnings("unused") - public RNull castNull(RNull rnull) { + protected RNull castNull(RNull rnull) { return RNull.instance; } @Specialization(guards = "!preserveNonVector") @SuppressWarnings("unused") - public RAbstractVector cast(RNull rnull) { + protected RAbstractVector cast(RNull rnull) { return RDataFactory.createList(); } @Specialization(guards = "preserveNonVector") - public RFunction castFunction(RFunction f) { + protected RFunction castFunction(RFunction f) { return f; } @Specialization(guards = "!preserveNonVector") @SuppressWarnings("unused") - public RAbstractVector cast(RFunction f) { + protected RAbstractVector cast(RFunction f) { return RDataFactory.createList(); } @Specialization - public RAbstractVector cast(RAbstractVector vector) { + protected RAbstractVector cast(RAbstractVector vector) { return vector; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java index dc93d74735c3b895ca90170c8fc09e17388c3c8c..fe2b44dee05b1ecb73588d7d638a826d28e27225 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertBooleanNode.java @@ -41,7 +41,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { public abstract byte executeByte(VirtualFrame frame, Object operandValue); @Specialization - public byte doLogical(VirtualFrame frame, byte value) { + protected byte doLogical(VirtualFrame frame, byte value) { check.enable(value); if (check.check(value)) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.NA_UNEXP); @@ -50,7 +50,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization - public byte doInt(VirtualFrame frame, int value) { + protected byte doInt(VirtualFrame frame, int value) { check.enable(value); if (check.check(value)) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENT_NOT_INTERPRETABLE_LOGICAL); @@ -59,7 +59,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization - public byte doDouble(VirtualFrame frame, double value) { + protected byte doDouble(VirtualFrame frame, double value) { check.enable(value); if (check.check(value)) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENT_NOT_INTERPRETABLE_LOGICAL); @@ -68,7 +68,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization - public byte doComplex(VirtualFrame frame, RComplex value) { + protected byte doComplex(VirtualFrame frame, RComplex value) { check.enable(value); if (check.check(value)) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.ARGUMENT_NOT_INTERPRETABLE_LOGICAL); @@ -77,7 +77,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization - public byte doString(VirtualFrame frame, String value) { + protected byte doString(VirtualFrame frame, String value) { check.enable(value); byte logicalValue = check.convertStringToLogical(value); check.enable(logicalValue); @@ -88,12 +88,12 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization - public byte doRaw(RRaw value) { + protected byte doRaw(RRaw value) { return RRuntime.asLogical(value.getValue() != 0); } @Specialization - public byte doIntSequence(RIntSequence value) { + protected byte doIntSequence(RIntSequence value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); @@ -102,7 +102,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization - public byte doDoubleSequence(RDoubleSequence value) { + protected byte doDoubleSequence(RDoubleSequence value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); @@ -112,14 +112,14 @@ public abstract class ConvertBooleanNode extends UnaryNode { @SuppressWarnings("unused") @Specialization(guards = "isEmpty") - public byte doEmptyVector(VirtualFrame frame, RAbstractVector value) { + protected byte doEmptyVector(VirtualFrame frame, RAbstractVector value) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.LENGTH_ZERO); } - private BranchProfile moreThanOneElem = new BranchProfile(); + private final BranchProfile moreThanOneElem = new BranchProfile(); @Specialization(guards = "!isEmpty") - public byte doIntVector(VirtualFrame frame, RIntVector value) { + protected byte doIntVector(VirtualFrame frame, RIntVector value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); @@ -132,7 +132,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization(guards = "!isEmpty") - public byte doDoubleVector(VirtualFrame frame, RDoubleVector value) { + protected byte doDoubleVector(VirtualFrame frame, RDoubleVector value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); @@ -145,7 +145,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization(guards = "!isEmpty") - public byte doLogicalVector(VirtualFrame frame, RLogicalVector value) { + protected byte doLogicalVector(VirtualFrame frame, RLogicalVector value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); @@ -158,7 +158,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization(guards = "!isEmpty") - public byte doComplexVector(VirtualFrame frame, RComplexVector value) { + protected byte doComplexVector(VirtualFrame frame, RComplexVector value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); @@ -171,7 +171,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization(guards = "!isEmpty") - public byte doRawVector(RRawVector value) { + protected byte doRawVector(RRawVector value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); @@ -180,7 +180,7 @@ public abstract class ConvertBooleanNode extends UnaryNode { } @Specialization(guards = "!isEmpty") - public byte doStringVector(VirtualFrame frame, RStringVector value) { + protected byte doStringVector(VirtualFrame frame, RStringVector value) { if (value.getLength() > 1) { moreThanOneElem.enter(); RError.warning(this.getEncapsulatingSourceSection(), RError.Message.LENGTH_GT_1); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertInt.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertInt.java index 098fb3211eed697572c33c392f15d7a4cc7292c3..b94e55f1f265b373c5902df88d70103d2b8ae5ba 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertInt.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertInt.java @@ -39,17 +39,17 @@ public abstract class ConvertInt extends UnaryNode { public abstract int executeInteger(VirtualFrame frame, Object operand); @Specialization - public int doInt(int operand) { + protected int doInt(int operand) { return operand; } @Specialization - public int doDouble(double operand) { + protected int doDouble(double operand) { return (int) operand; } @Specialization - public int doLogical(byte operand) { + protected int doLogical(byte operand) { return RRuntime.logical2int(operand); } @@ -58,5 +58,4 @@ public abstract class ConvertInt extends UnaryNode { CompilerDirectives.transferToInterpreter(); throw new ConversionFailedException(operand.getClass().getName()); } - } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertIntExact.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertIntExact.java index 7a59266db82c9f348a12aa20273453cbe26cf7a1..af3632a46cc4ebf0ab4e1cd6aadc6cf246ed8b95 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertIntExact.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ConvertIntExact.java @@ -37,17 +37,17 @@ public abstract class ConvertIntExact extends UnaryNode { public abstract int executeInteger(VirtualFrame frame, Object operand); @Specialization - public int doInt(int operand) { + protected int doInt(int operand) { return operand; } @Specialization - public int doLogical(byte operand) { + protected int doLogical(byte operand) { return RRuntime.logical2int(operand); } @Specialization - public double doInt(RIntVector operand) { + protected double doInt(RIntVector operand) { if (operand.getLength() == 1) { return operand.getDataAt(0); } else { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/InheritsNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/InheritsNode.java index e1a0c9bfe8b994a8fe2ec3f01ff4438187ac5c90..36f85d40599ccacd20b83ab1ab7eedaa0ceb5e0b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/InheritsNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/InheritsNode.java @@ -29,19 +29,19 @@ public abstract class InheritsNode extends RBuiltinNode { @SuppressWarnings("unused") @Specialization - public Object doesInherit(RNull x, RAbstractStringVector what) { + protected Object doesInherit(RNull x, RAbstractStringVector what) { return RRuntime.LOGICAL_FALSE; } @SuppressWarnings("unused") @Specialization - public Object doesInherit(REnvironment x, RAbstractStringVector what) { + protected Object doesInherit(REnvironment x, RAbstractStringVector what) { return RRuntime.LOGICAL_FALSE; } // map operations lead to recursion resulting in compilation failure @Specialization - public Object doesInherit(RAbstractVector x, RAbstractStringVector what) { + protected Object doesInherit(RAbstractVector x, RAbstractStringVector what) { Map<String, Integer> classToPos = initClassToPos(x); for (int i = 0; i < what.getLength(); ++i) { if (classToPos.get(what.getDataAt(i)) != null) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/IsFactorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/IsFactorNode.java index dac985205cfd83d96f57c5ea1066cfc20ec63482..ab1520e014fcae7fdc9d07cf67c43e202334db2a 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/IsFactorNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/IsFactorNode.java @@ -25,7 +25,7 @@ public abstract class IsFactorNode extends UnaryNode { public abstract byte execute(VirtualFrame frame, Object x); @Specialization - public byte isFactor(VirtualFrame frame, Object x) { + protected byte isFactor(VirtualFrame frame, Object x) { if (typeofNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); typeofNode = insert(TypeofNodeFactory.create(null)); 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 bf68965d8bab0bab02124d68d8f51ea69fd153ca..3205a0e94e9b89d7ba2267c6bc0637677d0d55b1 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 @@ -61,82 +61,82 @@ public abstract class PrecedenceNode extends UnaryNode { } @Specialization - public int doNull(RNull val, byte recursive) { + protected int doNull(RNull val, byte recursive) { return NO_PRECEDENCE; } @Specialization - public int doRaw(RRaw val, byte recursive) { + protected int doRaw(RRaw val, byte recursive) { return RAW_PRECEDENCE; } @Specialization - public int doRawVector(RRawVector val, byte recursive) { + protected int doRawVector(RRawVector val, byte recursive) { return RAW_PRECEDENCE; } @Specialization - public int doLogical(byte val, byte recursive) { + protected int doLogical(byte val, byte recursive) { return LOGICAL_PRECEDENCE; } @Specialization - public int doLogical(RLogicalVector val, byte recursive) { + protected int doLogical(RLogicalVector val, byte recursive) { return LOGICAL_PRECEDENCE; } @Specialization - public int doInt(int val, byte recursive) { + protected int doInt(int val, byte recursive) { return INT_PRECEDENCE; } @Specialization - public int doComplex(RComplex val, byte recursive) { + protected int doComplex(RComplex val, byte recursive) { return COMPLEX_PRECEDENCE; } @Specialization - public int doInt(RIntVector val, byte recursive) { + protected int doInt(RIntVector val, byte recursive) { return INT_PRECEDENCE; } @Specialization - public int doInt(RIntSequence val, byte recursive) { + protected int doInt(RIntSequence val, byte recursive) { return INT_PRECEDENCE; } @Specialization - public int doDouble(double val, byte recursive) { + protected int doDouble(double val, byte recursive) { return DOUBLE_PRECEDENCE; } @Specialization - public int doDouble(RDoubleVector val, byte recursive) { + protected int doDouble(RDoubleVector val, byte recursive) { return DOUBLE_PRECEDENCE; } @Specialization - public int doDouble(RDoubleSequence val, byte recursive) { + protected int doDouble(RDoubleSequence val, byte recursive) { return DOUBLE_PRECEDENCE; } @Specialization - public int doComplex(RComplexVector val, byte recursive) { + protected int doComplex(RComplexVector val, byte recursive) { return COMPLEX_PRECEDENCE; } @Specialization - public int doString(String val, byte recursive) { + protected int doString(String val, byte recursive) { return STRING_PRECEDENCE; } @Specialization - public int doString(RStringVector val, byte recursive) { + protected int doString(RStringVector val, byte recursive) { return STRING_PRECEDENCE; } @Specialization(guards = "isRecursive") - public int doListRecursive(VirtualFrame frame, RList val, byte recursive) { + protected int doListRecursive(VirtualFrame frame, RList val, byte recursive) { int precedence = -1; for (int i = 0; i < val.getLength(); ++i) { Object data = val.getDataAt(i); @@ -146,12 +146,12 @@ public abstract class PrecedenceNode extends UnaryNode { } @Specialization(guards = "!isRecursive") - public int doList(RList val, byte recursive) { + protected int doList(RList val, byte recursive) { return LIST_PRECEDENCE; } @Specialization - public int doDataFrame(VirtualFrame frame, RDataFrame val, byte recursive) { + protected int doDataFrame(VirtualFrame frame, RDataFrame val, byte recursive) { return precedenceRecursive(frame, val.getVector(), recursive); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java index 958c3861af72fa4fc480e8074e804c45a2f171ba..e6f2fb81a252bfeecd2f8f9a5d87cba7bdf130dd 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/ToStringNode.java @@ -82,7 +82,7 @@ public abstract class ToStringNode extends UnaryNode { public abstract String executeString(VirtualFrame frame, Object o); @Specialization - public String toString(String value) { + protected String toString(String value) { if (RRuntime.isNA(value)) { return value; } @@ -94,43 +94,43 @@ public abstract class ToStringNode extends UnaryNode { } @Specialization - public String toString(@SuppressWarnings("unused") RNull vector) { + protected String toString(@SuppressWarnings("unused") RNull vector) { return "NULL"; } @Specialization - public String toString(RFunction function) { + protected String toString(RFunction function) { return RRuntime.toString(function); } @Specialization - public String toString(RComplex complex) { + protected String toString(RComplex complex) { return complex.toString(); } @Specialization - public String toString(RRaw raw) { + protected String toString(RRaw raw) { return raw.toString(); } - @Specialization() - public String toString(int operand) { + @Specialization + protected String toString(int operand) { return RRuntime.intToString(operand, intL); } @Specialization - public String toString(double operand) { + protected String toString(double operand) { return RRuntime.doubleToString(operand); } @Specialization - public String toString(byte operand) { + protected String toString(byte operand) { return RRuntime.logicalToString(operand); } @SlowPath @Specialization - public String toString(RIntVector vector) { + protected String toString(RIntVector vector) { int length = vector.getLength(); if (length == 0) { return "integer(0)"; @@ -147,7 +147,7 @@ public abstract class ToStringNode extends UnaryNode { @SlowPath @Specialization - public String toString(RDoubleVector vector) { + protected String toString(RDoubleVector vector) { int length = vector.getLength(); if (length == 0) { return "numeric(0)"; @@ -164,7 +164,7 @@ public abstract class ToStringNode extends UnaryNode { @SlowPath @Specialization - public String toString(RStringVector vector) { + protected String toString(RStringVector vector) { int length = vector.getLength(); if (length == 0) { return "character(0)"; @@ -181,7 +181,7 @@ public abstract class ToStringNode extends UnaryNode { @SlowPath @Specialization - public String toString(RLogicalVector vector) { + protected String toString(RLogicalVector vector) { int length = vector.getLength(); if (length == 0) { return "logical(0)"; @@ -198,7 +198,7 @@ public abstract class ToStringNode extends UnaryNode { @SlowPath @Specialization - public String toString(RRawVector vector) { + protected String toString(RRawVector vector) { int length = vector.getLength(); if (length == 0) { return "raw(0)"; @@ -215,7 +215,7 @@ public abstract class ToStringNode extends UnaryNode { @SlowPath @Specialization - public String toString(RComplexVector vector) { + protected String toString(RComplexVector vector) { int length = vector.getLength(); if (length == 0) { return "complex(0)"; @@ -232,7 +232,7 @@ public abstract class ToStringNode extends UnaryNode { @SlowPath @Specialization - public String toString(VirtualFrame frame, RList vector) { + protected String toString(VirtualFrame frame, RList vector) { int length = vector.getLength(); if (length == 0) { return "list()"; @@ -258,17 +258,17 @@ public abstract class ToStringNode extends UnaryNode { } @Specialization - public String toString(VirtualFrame frame, RIntSequence vector) { + protected String toString(VirtualFrame frame, RIntSequence vector) { return toStringRecursive(frame, vector.createVector()); } @Specialization - public String toString(VirtualFrame frame, RDoubleSequence vector) { + protected String toString(VirtualFrame frame, RDoubleSequence vector) { return toStringRecursive(frame, vector.createVector()); } @Specialization - public String toString(REnvironment env) { + protected String toString(REnvironment env) { return env.toString(); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/TypeofNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/TypeofNode.java index 293e55d6d0d4abc6adfb5787f13cf08edf4acb52..2988a19d672c8828b5434d43701b7c77a0d8480e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/TypeofNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/TypeofNode.java @@ -32,122 +32,122 @@ public abstract class TypeofNode extends UnaryNode { public abstract String execute(VirtualFrame frame, Object x); @Specialization - public String typeof(RNull vector) { + protected String typeof(RNull vector) { return "NULL"; } @Specialization - public String typeof(byte x) { + protected String typeof(byte x) { return "logical"; } @Specialization - public String typeof(int s) { + protected String typeof(int s) { return "integer"; } @Specialization - public String typeof(double x) { + protected String typeof(double x) { return "double"; } @Specialization - public String typeof(RComplex x) { + protected String typeof(RComplex x) { return "complex"; } @Specialization - public String typeof(RRaw x) { + protected String typeof(RRaw x) { return "raw"; } @Specialization - public String typeof(String x) { + protected String typeof(String x) { return "character"; } @Specialization - public String typeof(RIntSequence vector) { + protected String typeof(RIntSequence vector) { return "integer"; } @Specialization - public String typeof(RLogicalVector vector) { + protected String typeof(RLogicalVector vector) { return "logical"; } @Specialization - public String typeof(RIntVector vector) { + protected String typeof(RIntVector vector) { return "integer"; } @Specialization - public String typeof(RDoubleVector vector) { + protected String typeof(RDoubleVector vector) { return "double"; } @Specialization - public String typeof(RStringVector vector) { + protected String typeof(RStringVector vector) { return "character"; } @Specialization - public String typeof(RComplexVector vector) { + protected String typeof(RComplexVector vector) { return "complex"; } @Specialization - public String typeof(RRawVector vector) { + protected String typeof(RRawVector vector) { return "raw"; } @Specialization - public String typeof(RList list) { + protected String typeof(RList list) { return "list"; } - @Specialization() - public String typeof(REnvironment env) { + @Specialization + protected String typeof(REnvironment env) { return RRuntime.TYPE_ENVIRONMENT; } - @Specialization() - public String typeof(RSymbol symbol) { + @Specialization + protected String typeof(RSymbol symbol) { return "symbol"; } - @Specialization() - public String typeof(RLanguage language) { + @Specialization + protected String typeof(RLanguage language) { return "language"; } - @Specialization() - public String typeof(RPromise promise) { + @Specialization + protected String typeof(RPromise promise) { return "promise"; } - @Specialization() - public String typeof(RExpression symbol) { + @Specialization + protected String typeof(RExpression symbol) { return "expression"; } @Specialization - public String typeof(RPairList pairlist) { + protected String typeof(RPairList pairlist) { return RRuntime.TYPE_PAIR_LIST; } @Specialization(guards = "isFunctionBuiltin") - public String typeofBuiltin(RFunction obj) { + protected String typeofBuiltin(RFunction obj) { return "builtin"; } @Specialization(guards = "!isFunctionBuiltin") - public String typeofClosure(RFunction obj) { + protected String typeofClosure(RFunction obj) { return "closure"; } @Specialization - public String typeofFormula(RFormula f) { + protected String typeofFormula(RFormula f) { return "language"; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticNode.java index 3bd64875744a231e88d23da71135b5319e951a30..9d7043604a5247dbe2905af4a9a6fc3aeed8f6b5 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticNode.java @@ -48,42 +48,42 @@ public abstract class UnaryArithmeticNode extends UnaryNode { public abstract Object execute(VirtualFrame frame, Object operand); @Specialization(guards = "!isNA") - public int doInt(int operand) { + protected int doInt(int operand) { return arithmetic.op(operand); } @Specialization(guards = "isNA") - public int doIntNA(@SuppressWarnings("unused") int operand) { + protected int doIntNA(@SuppressWarnings("unused") int operand) { return RRuntime.INT_NA; } @Specialization(guards = "!isNA") - public double doDouble(double operand) { + protected double doDouble(double operand) { return arithmetic.op(operand); } @Specialization(guards = "isNA") - public double doDoubleNA(@SuppressWarnings("unused") double operand) { + protected double doDoubleNA(@SuppressWarnings("unused") double operand) { return RRuntime.DOUBLE_NA; } @Specialization(guards = "!isComplexNA") - public RComplex doComplex(RComplex operand) { + protected RComplex doComplex(RComplex operand) { return arithmetic.op(operand.getRealPart(), operand.getImaginaryPart()); } @Specialization(guards = "isComplexNA") - public RComplex doComplexNA(@SuppressWarnings("unused") RComplex operand) { + protected RComplex doComplexNA(@SuppressWarnings("unused") RComplex operand) { return RRuntime.createComplexNA(); } @Specialization(guards = "!isNA") - public int doLogical(byte operand) { + protected int doLogical(byte operand) { return arithmetic.op(operand); } @Specialization(guards = "isNA") - public int doLogicalNA(@SuppressWarnings("unused") byte operand) { + protected int doLogicalNA(@SuppressWarnings("unused") byte operand) { return RRuntime.INT_NA; } @@ -94,7 +94,7 @@ public abstract class UnaryArithmeticNode extends UnaryNode { } @Specialization(guards = "isComplete") - public RDoubleVector doDoubleVector(RAbstractDoubleVector operands) { + protected RDoubleVector doDoubleVector(RAbstractDoubleVector operands) { double[] res = new double[operands.getLength()]; for (int i = 0; i < operands.getLength(); ++i) { res[i] = arithmetic.op(operands.getDataAt(i)); @@ -105,7 +105,7 @@ public abstract class UnaryArithmeticNode extends UnaryNode { } @Specialization(guards = "!isComplete") - public RDoubleVector doDoubleVectorNA(RAbstractDoubleVector operands) { + protected RDoubleVector doDoubleVectorNA(RAbstractDoubleVector operands) { double[] res = new double[operands.getLength()]; na.enable(operands); for (int i = 0; i < operands.getLength(); ++i) { @@ -121,7 +121,7 @@ public abstract class UnaryArithmeticNode extends UnaryNode { } @Specialization(guards = "isComplete") - public RComplexVector doComplexVector(RAbstractComplexVector operands) { + protected RComplexVector doComplexVector(RAbstractComplexVector operands) { double[] res = new double[operands.getLength() * 2]; for (int i = 0; i < operands.getLength(); ++i) { RComplex r = arithmetic.op(operands.getDataAt(i).getRealPart(), operands.getDataAt(i).getImaginaryPart()); @@ -134,7 +134,7 @@ public abstract class UnaryArithmeticNode extends UnaryNode { } @Specialization(guards = "!isComplete") - public RComplexVector doComplexVectorNA(RAbstractComplexVector operands) { + protected RComplexVector doComplexVectorNA(RAbstractComplexVector operands) { double[] res = new double[operands.getLength() * 2]; na.enable(operands); for (int i = 0; i < operands.getLength(); ++i) { @@ -153,7 +153,7 @@ public abstract class UnaryArithmeticNode extends UnaryNode { } @Specialization(guards = "isComplete") - public RIntVector doIntVector(RAbstractIntVector operands) { + protected RIntVector doIntVector(RAbstractIntVector operands) { int[] res = new int[operands.getLength()]; for (int i = 0; i < operands.getLength(); ++i) { res[i] = arithmetic.op(operands.getDataAt(i)); @@ -164,7 +164,7 @@ public abstract class UnaryArithmeticNode extends UnaryNode { } @Specialization(guards = "!isComplete") - public RIntVector doIntVectorNA(RAbstractIntVector operands) { + protected RIntVector doIntVectorNA(RAbstractIntVector operands) { int[] res = new int[operands.getLength()]; na.enable(operands); for (int i = 0; i < operands.getLength(); ++i) { @@ -180,22 +180,22 @@ public abstract class UnaryArithmeticNode extends UnaryNode { } @Specialization(guards = "isComplete") - public RIntVector doLogicalVector(RAbstractLogicalVector operands) { + protected RIntVector doLogicalVector(RAbstractLogicalVector operands) { return doIntVector(RClosures.createLogicalToIntVector(operands, na)); } @Specialization(guards = "!isComplete") - public RIntVector doLogicalVectorNA(RAbstractLogicalVector operands) { + protected RIntVector doLogicalVectorNA(RAbstractLogicalVector operands) { return doIntVectorNA(RClosures.createLogicalToIntVector(operands, na)); } @Specialization - public Object doStringVector(VirtualFrame frame, @SuppressWarnings("unused") RAbstractStringVector operands) { + protected Object doStringVector(VirtualFrame frame, @SuppressWarnings("unused") RAbstractStringVector operands) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.INVALID_ARG_TYPE_UNARY); } @Specialization - public Object doRawVector(VirtualFrame frame, @SuppressWarnings("unused") RAbstractRawVector operands) { + protected Object doRawVector(VirtualFrame frame, @SuppressWarnings("unused") RAbstractRawVector operands) { throw RError.error(frame, this.getEncapsulatingSourceSection(), RError.Message.INVALID_ARG_TYPE_UNARY); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java index 00d4e444653bb613436af448521de9763fd55827..f6fdb0114aae2808e4f737d4c35850095b896c1e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticReduceNode.java @@ -55,7 +55,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization(guards = "isNullInt") - public int doInt(@SuppressWarnings("unused") RNull operand) { + protected int doInt(@SuppressWarnings("unused") RNull operand) { if (semantics.getEmptyWarning() != null) { RError.warning(semantics.emptyWarning); } @@ -63,7 +63,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization(guards = "!isNullInt") - public double doDouble(@SuppressWarnings("unused") RNull operand) { + protected double doDouble(@SuppressWarnings("unused") RNull operand) { if (semantics.getEmptyWarning() != null) { RError.warning(semantics.emptyWarning); } @@ -71,19 +71,19 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization - public int doInt(int operand) { + protected int doInt(int operand) { na.enable(operand); return na.check(operand) ? RRuntime.INT_NA : arithmetic.op(semantics.getIntStart(), operand); } @Specialization - public double doDouble(double operand) { + protected double doDouble(double operand) { na.enable(operand); return na.check(operand) ? RRuntime.DOUBLE_NA : arithmetic.op(semantics.getDoubleStart(), operand); } @Specialization - public int doIntVector(RIntVector operand) { + protected int doIntVector(RIntVector operand) { int result = semantics.getIntStart(); na.enable(operand); int i = 0; @@ -103,7 +103,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization - public double doDoubleVector(RDoubleVector operand) { + protected double doDoubleVector(RDoubleVector operand) { double result = semantics.getDoubleStart(); na.enable(operand); int i = 0; @@ -123,7 +123,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization - public int doLogicalVector(RLogicalVector operand) { + protected int doLogicalVector(RLogicalVector operand) { int result = semantics.getIntStart(); na.enable(operand); int i = 0; @@ -143,7 +143,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization - public int doIntSequence(RIntSequence operand) { + protected int doIntSequence(RIntSequence operand) { int result = semantics.getIntStart(); int current = operand.getStart(); int i = 0; @@ -162,7 +162,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization - public double doDoubleSequence(RDoubleSequence operand) { + protected double doDoubleSequence(RDoubleSequence operand) { double result = semantics.getDoubleStart(); double current = operand.getStart(); int i = 0; @@ -181,7 +181,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization - public RComplex doComplexVector(RComplexVector operand) { + protected RComplex doComplexVector(RComplexVector operand) { RComplex result = RRuntime.double2complex(semantics.getDoubleStart()); int i = 0; for (; i < operand.getLength(); ++i) { @@ -204,7 +204,7 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { // "largest" String for the implementation of max function @Specialization(guards = "empty") - public String doStringVectorEmpty(@SuppressWarnings("unused") RStringVector operand) { + protected String doStringVectorEmpty(@SuppressWarnings("unused") RStringVector operand) { if (semantics.getEmptyWarning() != null) { RError.warning(semantics.emptyWarning); } @@ -212,12 +212,12 @@ public abstract class UnaryArithmeticReduceNode extends UnaryNode { } @Specialization(guards = "lengthOne") - public String doStringVectorOneElem(RStringVector operand) { + protected String doStringVectorOneElem(RStringVector operand) { return operand.getDataAt(0); } @Specialization(guards = "longerThanOne") - public String doStringVector(RStringVector operand) { + protected String doStringVector(RStringVector operand) { String result = operand.getDataAt(0); na.enable(result); if (na.check(result)) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryNotNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryNotNode.java index 7831794decf56a87906c824939e55f4d35605e6b..e6815d69b47b4a85414b753eef0a410ad9f71ce9 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryNotNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryNotNode.java @@ -36,7 +36,7 @@ public abstract class UnaryNotNode extends RBuiltinNode { private final NACheck na = NACheck.create(); @Specialization - public byte doLogical(byte operand) { + protected byte doLogical(byte operand) { na.enable(operand); if (na.check(operand)) { return RRuntime.LOGICAL_NA; @@ -45,7 +45,7 @@ public abstract class UnaryNotNode extends RBuiltinNode { } @Specialization - public byte doInt(int operand) { + protected byte doInt(int operand) { na.enable(operand); if (na.check(operand)) { return RRuntime.LOGICAL_NA; @@ -54,7 +54,7 @@ public abstract class UnaryNotNode extends RBuiltinNode { } @Specialization - public byte doDouble(double operand) { + protected byte doDouble(double operand) { na.enable(operand); if (na.check(operand)) { return RRuntime.LOGICAL_NA; @@ -63,13 +63,13 @@ public abstract class UnaryNotNode extends RBuiltinNode { } @Specialization - public RRaw doRaw(RRaw operand) { + protected RRaw doRaw(RRaw operand) { return RDataFactory.createRaw(performRaw(operand)); } @SuppressWarnings("unused") @Specialization - public Object doNull(VirtualFrame frame, RNull operand) { + protected Object doNull(VirtualFrame frame, RNull operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARG_TYPE); } @@ -78,52 +78,52 @@ public abstract class UnaryNotNode extends RBuiltinNode { } @Specialization - public RLogicalVector performLogicalVectorNot(VirtualFrame frame, @SuppressWarnings("unused") RFunction operand) { + protected RLogicalVector performLogicalVectorNot(VirtualFrame frame, @SuppressWarnings("unused") RFunction operand) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARG_TYPE); } @Specialization(guards = "isZeroLength") - public RLogicalVector performLogicalVectorNot(@SuppressWarnings("unused") RAbstractVector vector) { + protected RLogicalVector performLogicalVectorNot(@SuppressWarnings("unused") RAbstractVector vector) { return RDataFactory.createEmptyLogicalVector(); } @Specialization - public RLogicalVector performLogicalVectorNot(VirtualFrame frame, @SuppressWarnings("unused") RAbstractStringVector vector) { + protected RLogicalVector performLogicalVectorNot(VirtualFrame frame, @SuppressWarnings("unused") RAbstractStringVector vector) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARG_TYPE); } @Specialization - public RLogicalVector performLogicalVectorNot(VirtualFrame frame, @SuppressWarnings("unused") RList list) { + protected RLogicalVector performLogicalVectorNot(VirtualFrame frame, @SuppressWarnings("unused") RList list) { throw RError.error(frame, getEncapsulatingSourceSection(), RError.Message.INVALID_ARG_TYPE); } @Specialization(guards = "!isZeroLength") - public RLogicalVector doLogicalVector(RLogicalVector vector) { + protected RLogicalVector doLogicalVector(RLogicalVector vector) { return performLogicalVectorNot(vector); } @Specialization(guards = "!isZeroLength") - public RLogicalVector doIntVector(RIntVector vector) { + protected RLogicalVector doIntVector(RIntVector vector) { return performAbstractIntVectorNot(vector); } @Specialization(guards = "!isZeroLength") - public RLogicalVector doDoubleVector(RDoubleVector vector) { + protected RLogicalVector doDoubleVector(RDoubleVector vector) { return performAbstractDoubleVectorNot(vector); } @Specialization(guards = "!isZeroLength") - public RLogicalVector doIntSequence(RIntSequence vector) { + protected RLogicalVector doIntSequence(RIntSequence vector) { return performAbstractIntVectorNot(vector); } @Specialization(guards = "!isZeroLength") - public RLogicalVector doDoubleSequence(RDoubleSequence vector) { + protected RLogicalVector doDoubleSequence(RDoubleSequence vector) { return performAbstractDoubleVectorNot(vector); } @Specialization(guards = "!isZeroLength") - public RRawVector doRawVector(RRawVector vector) { + protected RRawVector doRawVector(RRawVector vector) { return performRawVectorNot(vector); } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g index b5c35938e94a28472f5d65b19ac01fed8d5e29a0..2ceb70e462991d87d0164dbc20ff8a54863f899f 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/R.g @@ -293,7 +293,7 @@ function returns [ASTNode v] } @after { SourceSection srcs = sourceSection("function", $start, $stop); - vv = Function.create(l, $body.v, srcs); + vv = Function.create(srcs, l, $body.v); $v = vv; } : FUNCTION n_ LPAR n_ (par_decl[l] (n_ COMMA n_ par_decl[l])* n_)? RPAR n_ body=expr_or_assign diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ASTNode.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ASTNode.java index 85bf8aaeb8940373a3da810c3d2421670082aa7a..7b3d5b418442e8fa6b32a6d381cd62eb1fd5c599 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ASTNode.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ASTNode.java @@ -17,9 +17,11 @@ import com.oracle.truffle.api.CompilerDirectives.SlowPath; public abstract class ASTNode { - ASTNode parent; + private SourceSection source; - SourceSection source; + protected ASTNode(SourceSection source) { + this.source = source; + } public abstract <R> R accept(Visitor<R> v); @@ -44,27 +46,4 @@ public abstract class ASTNode { Precedence prec = clazz.getAnnotation(Precedence.class); return prec == null ? Precedence.MIN : prec.value(); } - - // FIXME: do we still need these Truffle-like methods for the AST tree? - public ASTNode getParent() { - return parent; - } - - public void setParent(ASTNode node) { - parent = node; - } - - protected <T extends ASTNode> T[] updateParent(T[] children) { - for (T node : children) { - updateParent(node); - } - return children; - } - - protected <T extends ASTNode> T updateParent(T child) { - if (child != null) { - child.setParent(this); - } - return child; - } } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVariable.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVariable.java index c3a8fb08f9f60147d288bd332d8685ddc3e32d3a..7271d50bcc24c0eaadfd7ddb5fca5312377d750b 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVariable.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVariable.java @@ -14,6 +14,10 @@ import com.oracle.truffle.api.source.*; public abstract class AccessVariable extends ASTNode { + protected AccessVariable(SourceSection source) { + super(source); + } + public static ASTNode create(SourceSection src, String name, boolean shouldCopyValue) { return new SimpleAccessVariable(src, Symbol.getSymbol(name), shouldCopyValue); } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVector.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVector.java index 709013dcee45956120f8024e408b309ea553e285..8f34456a41437e4053ebe8e3d14d7214f438477b 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVector.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AccessVector.java @@ -16,12 +16,11 @@ import com.oracle.truffle.api.source.*; public class AccessVector extends Call { - final ASTNode vector; - final boolean subset; + private final ASTNode vector; + private final boolean subset; - public AccessVector(SourceSection src, ASTNode vector, List<ArgNode> args, boolean subset) { - super(args); - this.source = src; + public AccessVector(SourceSection source, ASTNode vector, List<ArgNode> arguments, boolean subset) { + super(source, arguments); this.vector = vector; this.subset = subset; } @@ -43,5 +42,4 @@ public class AccessVector extends Call { public <R> List<R> visitAll(Visitor<R> v) { return Arrays.asList(vector.accept(v)); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Add.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Add.java index fd3102f5c9989b152088737165bea291f4948106..99253f2b7ce7684808de2d9cf7c62281340ba2e1 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Add.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Add.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.ADD_PRECEDENCE) public class Add extends BinaryOperation { - public Add(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Add(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/And.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/And.java index 61abcfeeb051559e5bbda9a165cba277d93bcea0..feb530aad56bcaeb75cf2c79f3c34419b127669c 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/And.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/And.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.AND_PRECEDENCE) public class And extends BinaryOperation { - public And(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public And(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ArgNode.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ArgNode.java index ecdfbbf74c147a6c6a2c8f47c90071b7650df835..e08bd5eee0ed2d51e01d5a76b0e49891f6860886 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ArgNode.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ArgNode.java @@ -28,22 +28,21 @@ import com.oracle.truffle.api.source.*; public class ArgNode extends ASTNode { - private Symbol name; + private final Symbol name; + private final ASTNode value; - private ASTNode value; - - public ArgNode(SourceSection src, Symbol name, ASTNode value) { - this.source = src; + private ArgNode(SourceSection source, Symbol name, ASTNode value) { + super(source); this.name = name; this.value = value; } - public static ArgNode create(SourceSection src, String name, ASTNode value) { - return new ArgNode(src, Symbol.getSymbol(name), value); + public static ArgNode create(SourceSection source, String name, ASTNode value) { + return new ArgNode(source, Symbol.getSymbol(name), value); } - public static ArgNode create(SourceSection src, Symbol name, ASTNode value) { - return new ArgNode(src, name, value); + public static ArgNode create(SourceSection source, Symbol name, ASTNode value) { + return new ArgNode(source, name, value); } public Symbol getName() { @@ -63,5 +62,4 @@ public class ArgNode extends ASTNode { public <R> List<R> visitAll(Visitor<R> v) { return Arrays.asList(getValue().accept(v)); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java index 24857ce3e0de2a6c1499323bc329d3ed559fedca..112e5546cc31d8209c4c04748eddf74a3e90d763 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java @@ -17,12 +17,13 @@ import com.oracle.truffle.r.runtime.*; public abstract class AssignVariable extends ASTNode { - final boolean isSuper; - ASTNode rhs; + private final boolean isSuper; + private final ASTNode rhs; - AssignVariable(boolean isSuper, ASTNode expr) { + protected AssignVariable(SourceSection source, boolean isSuper, ASTNode expr) { + super(source); this.isSuper = isSuper; - rhs = updateParent(expr); + this.rhs = expr; } @Override @@ -40,7 +41,7 @@ public abstract class AssignVariable extends ASTNode { public static ASTNode create(SourceSection src, boolean isSuper, ASTNode lhs, ASTNode rhs) { if (lhs instanceof SimpleAccessVariable) { - return writeVariable(src, isSuper, ((SimpleAccessVariable) lhs).symbol, rhs); + return writeVariable(src, isSuper, ((SimpleAccessVariable) lhs).getVariable(), rhs); } else if (lhs instanceof AccessVector) { return writeVector(src, isSuper, (AccessVector) lhs, rhs); } else if (lhs instanceof FieldAccess) { @@ -70,27 +71,22 @@ public abstract class AssignVariable extends ASTNode { if (!isSuper) { // ensure the vector is copied from an enclosing frame if it is not found in the // current frame - SimpleAccessVariable newAccessVector = new SimpleAccessVariable(simpleAccessVariable.getSource(), simpleAccessVariable.getSymbol(), true); - newLhs = new AccessVector(lhs.getSource(), newAccessVector, lhs.getArgs(), lhs.isSubset()); - newLhs.setParent(lhs.getParent()); + SimpleAccessVariable newAccessVector = new SimpleAccessVariable(simpleAccessVariable.getSource(), simpleAccessVariable.getVariable(), true); + newLhs = new AccessVector(lhs.getSource(), newAccessVector, lhs.getArguments(), lhs.isSubset()); } UpdateVector update = new UpdateVector(isSuper, newLhs, rhs); - lhs.args.add(ArgNode.create(rhs.getSource(), "value", rhs)); + lhs.getArguments().add(ArgNode.create(rhs.getSource(), "value", rhs)); return update; - } else if (first instanceof AccessVector) { + } else if (first instanceof AccessVector || first instanceof FieldAccess) { UpdateVector update = new UpdateVector(isSuper, lhs, rhs); - lhs.args.add(ArgNode.create(rhs.getSource(), "value", rhs)); - return update; - } else if (first instanceof FieldAccess) { - UpdateVector update = new UpdateVector(isSuper, lhs, rhs); - lhs.args.add(ArgNode.create(rhs.getSource(), "value", rhs)); + lhs.getArguments().add(ArgNode.create(rhs.getSource(), "value", rhs)); return update; } else if (first instanceof FunctionCall) { FunctionCall replacementFunc = (FunctionCall) first; - FunctionCall func = new FunctionCall(replacementFunc.getSource(), replacementFunc.getLhs(), replacementFunc.getArgs(), false); - AccessVector newLhs = new AccessVector(func.getSource(), func, lhs.getArgs(), lhs.isSubset()); + FunctionCall func = new FunctionCall(replacementFunc.getSource(), replacementFunc.getLhs(), replacementFunc.getArguments(), false); + AccessVector newLhs = new AccessVector(func.getSource(), func, lhs.getArguments(), lhs.isSubset()); UpdateVector update = new UpdateVector(isSuper, newLhs, rhs); - lhs.args.add(ArgNode.create(rhs.getSource(), "value", rhs)); + lhs.getArguments().add(ArgNode.create(rhs.getSource(), "value", rhs)); return writeFunction(lhs.getSource(), isSuper, replacementFunc, update); } else { Utils.nyi(); // TODO here we need to flatten complex assignments @@ -112,13 +108,9 @@ public abstract class AssignVariable extends ASTNode { } lhs.setAssignment(true); lhs.setSuper(isSuper); - if (lhs.args.size() > 0) { - ASTNode first = lhs.args.get(0).getValue(); - if (first instanceof SimpleAccessVariable) { - return new Replacement(src, isSuper, lhs, rhs); - } else if (first instanceof AccessVector) { - return new Replacement(src, isSuper, lhs, rhs); - } else if (first instanceof FieldAccess) { + if (lhs.getArguments().size() > 0) { + ASTNode first = lhs.getArguments().get(0).getValue(); + if (first instanceof SimpleAccessVariable || first instanceof AccessVector || first instanceof FieldAccess) { return new Replacement(src, isSuper, lhs, rhs); } else { Utils.nyi(); // TODO here we need to flatten complex assignments diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/BinaryOperation.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/BinaryOperation.java index 29d62797cc513a960e8b01422c869345203c9c4a..f94904be4e6bea465961936af17800ca104ffc39 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/BinaryOperation.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/BinaryOperation.java @@ -16,12 +16,11 @@ import com.oracle.truffle.api.source.*; public abstract class BinaryOperation extends Operation { - final ASTNode rhs; + private final ASTNode rhs; - public BinaryOperation(SourceSection src, ASTNode left, ASTNode right) { - super(left); - this.source = src; - this.rhs = updateParent(right); + protected BinaryOperation(SourceSection source, ASTNode left, ASTNode right) { + super(source, left); + this.rhs = right; } public ASTNode getRHS() { diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Break.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Break.java index fd885634522da73593898b89466758132218ee53..7a752420845c550e8c33dfaad23692251ce777cf 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Break.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Break.java @@ -14,12 +14,12 @@ import com.oracle.truffle.api.source.*; public class Break extends ControlStatement { - public static Break create(SourceSection src) { - return new Break(src); + public static Break create(SourceSection source) { + return new Break(source); } - public Break(SourceSection src) { - source = src; + private Break(SourceSection src) { + super(src); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Call.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Call.java index b9445106d289d20fa49e36aac760a26464a3982c..50d0a4b3efd5e223742c49bed167434be4015c07 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Call.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Call.java @@ -16,16 +16,17 @@ import com.oracle.truffle.api.source.*; public abstract class Call extends ASTNode { - final List<ArgNode> args; + private final List<ArgNode> arguments; - public Call(List<ArgNode> alist) { - args = alist; + protected Call(SourceSection source, List<ArgNode> arguments) { + super(source); + this.arguments = arguments; } @Override public <R> List<R> visitAll(Visitor<R> v) { List<R> list = new ArrayList<>(); - for (ArgNode e : args) { + for (ArgNode e : arguments) { ASTNode n = e.getValue(); if (n != null) { list.add(n.accept(v)); @@ -34,23 +35,23 @@ public abstract class Call extends ASTNode { return list; } - public List<ArgNode> getArgs() { - return args; + public List<ArgNode> getArguments() { + return arguments; } - public static ASTNode create(SourceSection src, ASTNode call, List<ArgNode> args) { + public static ASTNode create(SourceSection source, ASTNode call, List<ArgNode> arguments) { if (call instanceof SimpleAccessVariable) { SimpleAccessVariable ccall = (SimpleAccessVariable) call; - return create(src, ccall.getSymbol(), args); + return create(source, ccall.getVariable(), arguments); } else if (call instanceof Constant) { Constant c = (Constant) call; assert c.getType() == Constant.ConstantType.STRING; assert c.getValues().length == 1; - return create(src, Symbol.getSymbol(c.getValues()[0]), args); + return create(source, Symbol.getSymbol(c.getValues()[0]), arguments); } else if (call instanceof FunctionCall) { - return new FunctionCall(src, (FunctionCall) call, args); + return new FunctionCall(source, (FunctionCall) call, arguments); } else { - return new FunctionCall(src, call, args, false); + return new FunctionCall(source, call, arguments, false); } } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Colon.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Colon.java index 2d1b547704cf072c063d7e9dac33305ce4520004..2b8037e10524c19fd46d3a2fe0f521aea5c92d5f 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Colon.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Colon.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.COLON_PRECEDENCE) public class Colon extends BinaryOperation { - public Colon(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Colon(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Constant.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Constant.java index c8a395c98da8d0b66f6d9526d360fa261651f506..a09bfffd37374f618a5487e694b4553036a107da 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Constant.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Constant.java @@ -12,7 +12,6 @@ package com.oracle.truffle.r.parser.ast; import java.util.*; -import com.oracle.truffle.api.CompilerDirectives.SlowPath; import com.oracle.truffle.api.source.*; import com.oracle.truffle.r.runtime.*; @@ -29,13 +28,13 @@ public class Constant extends ASTNode { NULL } - final String[] values; - final ConstantType type; + private final String[] values; + private final ConstantType type; - public Constant(String[] values, ConstantType type, SourceSection source) { + private Constant(String[] values, ConstantType type, SourceSection source) { + super(source); this.values = values; this.type = type; - this.source = source; } public String[] getValues() { @@ -76,7 +75,6 @@ public class Constant extends ASTNode { return new Constant(values, ConstantType.INT, src); } - @SlowPath public static Constant createBoolConstant(SourceSection src, int value) { String strValue; if (value == RRuntime.LOGICAL_NA) { @@ -99,5 +97,4 @@ public class Constant extends ASTNode { public void addNegativeSign() { values[0] = "-" + values[0]; } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ControlStatement.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ControlStatement.java index 3a7e41a6571a373dd48a0f9d62e28a9e37bdcc31..4d55ef215cc1269c2104e3638c1d5918b741cd6a 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ControlStatement.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ControlStatement.java @@ -12,8 +12,14 @@ package com.oracle.truffle.r.parser.ast; import java.util.*; +import com.oracle.truffle.api.source.*; + public abstract class ControlStatement extends ASTNode { + protected ControlStatement(SourceSection source) { + super(source); + } + @Override public <R> List<R> visitAll(Visitor<R> v) { return Collections.emptyList(); diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Div.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Div.java index 0186b7c8b1ea824713e10033ec25f73cf92e6efa..275bac12d2b94ce0706e3fc7826832d664dd47cd 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Div.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Div.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.MULT_PRECEDENCE) public class Div extends BinaryOperation { - public Div(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Div(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/EQ.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/EQ.java index 064bc993b9135a3d918681271de962ec00d976eb..dcd6c3be4d1cfe9198a3c80c6d8ea89c853b18c7 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/EQ.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/EQ.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.EQ_PRECEDENCE) public class EQ extends BinaryOperation { - public EQ(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public EQ(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseAnd.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseAnd.java index be48508976eb1c340144d49f85e3822c607a9926..81a4d3913982e85acdcac047bd753810858965ea 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseAnd.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseAnd.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.AND_PRECEDENCE) public class ElementwiseAnd extends BinaryOperation { - public ElementwiseAnd(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public ElementwiseAnd(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseOr.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseOr.java index 68ca49ac8be0ab94f4aa3bdebda7d39ccc90e404..4dca6a4bb940a7bb6724b8ae94ce9d5aff3e3859 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseOr.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/ElementwiseOr.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.OR_PRECEDENCE) public class ElementwiseOr extends BinaryOperation { - public ElementwiseOr(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public ElementwiseOr(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FieldAccess.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FieldAccess.java index 5f44812f1192f7f164b62210df67f593993010e8..903b8eb154004fe0bb7d864c431f49ec5240555c 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FieldAccess.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FieldAccess.java @@ -16,13 +16,13 @@ import com.oracle.truffle.api.source.*; public class FieldAccess extends ASTNode { - final ASTNode lhs; - final Symbol name; + private final ASTNode lhs; + private final Symbol fieldName; - public FieldAccess(SourceSection src, ASTNode value, Symbol fieldName) { - this.source = src; - this.lhs = updateParent(value); - this.name = fieldName; + private FieldAccess(SourceSection source, ASTNode value, Symbol fieldName) { + super(source); + this.lhs = value; + this.fieldName = fieldName; } @Override @@ -49,7 +49,6 @@ public class FieldAccess extends ASTNode { } public Symbol getFieldName() { - return name; + return fieldName; } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/For.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/For.java index 3d4a6b0cd25826e242d8e44b3df167c040908bc0..4d419b3ad7b035580d752f55f74e6de4b6f90e93 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/For.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/For.java @@ -16,12 +16,12 @@ import com.oracle.truffle.api.source.*; public class For extends Loop { - final Symbol cvar; - final ASTNode range; + private final Symbol variable; + private final ASTNode range; - public For(SourceSection src, Symbol cvar, ASTNode range, ASTNode body) { - super(src, body); - this.cvar = cvar; + public For(SourceSection source, Symbol variable, ASTNode range, ASTNode body) { + super(source, body); + this.variable = variable; this.range = range; } @@ -29,8 +29,8 @@ public class For extends Loop { return range; } - public Symbol getCVar() { - return cvar; + public Symbol getVariable() { + return variable; } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Formula.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Formula.java index a4759318cb7bdad34f55cd68e9d3c94b09a6f85f..c83d86fa4495863c4a76e32553d03d4fea6c62a8 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Formula.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Formula.java @@ -31,10 +31,10 @@ public class Formula extends ASTNode { private final ASTNode response; private final ASTNode model; - public Formula(SourceSection source, ASTNode response, ASTNode model) { + private Formula(SourceSection source, ASTNode response, ASTNode model) { + super(source); this.response = response; this.model = model; - setSource(source); } public static Formula create(SourceSection source, ASTNode response, ASTNode model) { @@ -58,5 +58,4 @@ public class Formula extends ASTNode { public <R> List<R> visitAll(Visitor<R> v) { throw new IllegalStateException("should not reach here"); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Function.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Function.java index ffa3387563fcde442dbd2d03b88655e7b5e38dd7..8cf2e7051fe84743b99bc92ff6413f6ef828c04c 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Function.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Function.java @@ -16,13 +16,13 @@ import com.oracle.truffle.api.source.*; public class Function extends ASTNode { - final List<ArgNode> signature; - final ASTNode body; + private final List<ArgNode> signature; + private final ASTNode body; - Function(List<ArgNode> alist, ASTNode body, SourceSection src) { - this.signature = alist; - this.body = updateParent(body); - this.source = src; + private Function(SourceSection source, List<ArgNode> signature, ASTNode body) { + super(source); + this.signature = signature; + this.body = body; } public List<ArgNode> getSignature() { @@ -43,8 +43,7 @@ public class Function extends ASTNode { return Arrays.asList(body.accept(v)); } - public static ASTNode create(List<ArgNode> alist, ASTNode body, SourceSection src) { - return new Function(alist, body, src); + public static ASTNode create(SourceSection source, List<ArgNode> signature, ASTNode body) { + return new Function(source, signature, body); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FunctionCall.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FunctionCall.java index 99140d5f371e0de3124d9f581bc35188fc8ffefe..5a348772693eff5d9a84b9accca6aaa6c642db5e 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FunctionCall.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/FunctionCall.java @@ -18,23 +18,22 @@ public class FunctionCall extends Call { // LHS of a call does not need to be a symbol, it can be a lambda expression (FunctionCall) private Object lhs; - boolean isAssignment; - boolean isSuper; - boolean isReplacement; + private boolean isAssignment; + private boolean isSuper; + private boolean isReplacement; - public FunctionCall(SourceSection source, Object lhs, List<ArgNode> args, boolean isReplacement) { - super(args); - this.source = source; + public FunctionCall(SourceSection source, Object lhs, List<ArgNode> arguments, boolean isReplacement) { + super(source, arguments); this.lhs = lhs; this.isReplacement = isReplacement; } - public FunctionCall(SourceSection src, Symbol funName, List<ArgNode> args) { - this(src, funName, args, false); + public FunctionCall(SourceSection src, Symbol funName, List<ArgNode> arguments) { + this(src, funName, arguments, false); } - public FunctionCall(SourceSection src, FunctionCall funCall, List<ArgNode> args) { - this(src, funCall, args, false); + public FunctionCall(SourceSection src, FunctionCall funCall, List<ArgNode> arguments) { + this(src, funCall, arguments, false); } public Object getLhs() { @@ -50,17 +49,14 @@ public class FunctionCall extends Call { } public Symbol getName() { - assert lhs instanceof Symbol; return (Symbol) lhs; } public FunctionCall getFunctionCall() { - assert lhs instanceof FunctionCall; return (FunctionCall) lhs; } public ASTNode getLhsNode() { - assert lhs instanceof ASTNode; return (ASTNode) lhs; } @@ -68,14 +64,14 @@ public class FunctionCall extends Call { return isSuper; } - public boolean isAssignment() { - return isAssignment; - } - public void setSuper(boolean value) { this.isSuper = value; } + public boolean isAssignment() { + return isAssignment; + } + public void setAssignment(boolean value) { this.isAssignment = value; } @@ -88,5 +84,4 @@ public class FunctionCall extends Call { public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GE.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GE.java index 7133547c23c2cca238b46be3274dc4fcfefd40f7..2df08dfd3fe6873b001626d4ae50d89f0eb1e95f 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GE.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GE.java @@ -16,13 +16,12 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.COMPARE_PRECEDENCE) public class GE extends BinaryOperation { - public GE(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public GE(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GT.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GT.java index 93ffe452f3d0a3af7d6385a3c8fdfaa83d239ede..0f59f8f0cde8811c825063681ad4a146a5603955 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GT.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/GT.java @@ -16,13 +16,12 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.COMPARE_PRECEDENCE) public class GT extends BinaryOperation { - public GT(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public GT(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/If.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/If.java index b3a6eb8fd8affd3c416712961fac8defeb251fe3..7fc9a8ce74cf20fb5e42acb544b93453b34181bc 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/If.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/If.java @@ -16,19 +16,19 @@ import com.oracle.truffle.api.source.*; public class If extends ASTNode { - final ASTNode cond; - final ASTNode trueCase; - final ASTNode falseCase; + private final ASTNode condition; + private final ASTNode trueCase; + private final ASTNode falseCase; - If(SourceSection src, ASTNode cond, ASTNode truecase, ASTNode falsecase) { - this.source = src; - this.cond = updateParent(cond); - this.trueCase = updateParent(truecase); - this.falseCase = updateParent(falsecase); + private If(SourceSection source, ASTNode condition, ASTNode trueCase, ASTNode falseCase) { + super(source); + this.condition = condition; + this.trueCase = trueCase; + this.falseCase = falseCase; } - public ASTNode getCond() { - return cond; + public ASTNode getCondition() { + return condition; } public ASTNode getTrueCase() { @@ -47,7 +47,7 @@ public class If extends ASTNode { @Override public <R> List<R> visitAll(Visitor<R> v) { List<R> nodes = new ArrayList<>(); - nodes.add(getCond().accept(v)); + nodes.add(getCondition().accept(v)); nodes.add(getTrueCase().accept(v)); if (getFalseCase() != null) { nodes.add(getFalseCase().accept(v)); diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/In.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/In.java index 13c474209f6b8151646deebb092ef5764682f64d..9d817ede40da952a544898e5a70f589399f7ced9 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/In.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/In.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.IN_PRECEDENCE) public class In extends BinaryOperation { - public In(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public In(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/IntegerDiv.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/IntegerDiv.java index 54f666c6a5ef5bd881be2ca04bd0f8c77f501281..5ddc37427da0251c0546dae929acb92f97918e10 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/IntegerDiv.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/IntegerDiv.java @@ -16,13 +16,12 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.INTEGER_DIV_PRECEDENCE) public class IntegerDiv extends BinaryOperation { - public IntegerDiv(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public IntegerDiv(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LE.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LE.java index 2e75a437bc2ead44524baf735832943abe0da747..21a459002b9b1762dc1ce5abf902c6aeb0b8e50f 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LE.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LE.java @@ -16,13 +16,12 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.COMPARE_PRECEDENCE) public class LE extends BinaryOperation { - public LE(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public LE(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LT.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LT.java index db6a749ad6fa9688480081d5c0c5aebe7e6e971b..4aec919d74d92a0f6f38af88b4de5737a01df79e 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LT.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/LT.java @@ -16,13 +16,12 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.COMPARE_PRECEDENCE) public class LT extends BinaryOperation { - public LT(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public LT(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Loop.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Loop.java index 56ac09b23f353c957b840c19dad4fce2f1a69918..d9a47edfe0970ec8469e3298323b4123f9ad507d 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Loop.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Loop.java @@ -16,11 +16,11 @@ import com.oracle.truffle.api.source.*; public abstract class Loop extends ASTNode { - final ASTNode body; + private final ASTNode body; - public Loop(SourceSection src, ASTNode body) { - this.source = src; - this.body = updateParent(body); + protected Loop(SourceSection source, ASTNode body) { + super(source); + this.body = body; } public ASTNode getBody() { diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mod.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mod.java index f5aefcf486298b77feb3771bfdfb271ef2c516cf..d93e087e135ad020d664e08d30b7622dd290c990 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mod.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mod.java @@ -16,13 +16,12 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.MOD_PRECEDENCE) public class Mod extends BinaryOperation { - public Mod(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Mod(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mult.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mult.java index 17794d342f96ffb261cb646aedcad54ebe480d46..c572251bf20bef3b8adfe81103e30b3d88738242 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mult.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Mult.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.MULT_PRECEDENCE) public class Mult extends BinaryOperation { - public Mult(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Mult(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/NE.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/NE.java index ff4f918f92239c86d320129831944db186b53d9a..4d4bf377af575af834ccb0d4cfb166647bb4d87e 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/NE.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/NE.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.EQ_PRECEDENCE) public class NE extends BinaryOperation { - public NE(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public NE(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Next.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Next.java index e2b2af32db255d9ef96fa85903b35c8c13bc12b1..a25a2928f1100b84fbce02ec4648c23db04bca91 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Next.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Next.java @@ -14,12 +14,12 @@ import com.oracle.truffle.api.source.*; public class Next extends ControlStatement { - public static Next create(SourceSection src) { - return new Next(src); + public static Next create(SourceSection source) { + return new Next(source); } - public Next(SourceSection src) { - source = src; + private Next(SourceSection src) { + super(src); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Not.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Not.java index 4448d407ffdf2c9e700855282a2b5f6ed85ee1ea..4f3b0f0cb4377c1af1924269cf5e8d6a5dfb3c48 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Not.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Not.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @PrettyName("!") public class Not extends UnaryOperation { - public Not(SourceSection src, ASTNode operand) { - super(src, operand); + public Not(SourceSection source, ASTNode operand) { + super(source, operand); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Operation.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Operation.java index e37b16513f34fe374c0766a66f846315a44bbd9c..0c05d315c6b0fd2351a976ddb76645a82ddc6f61 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Operation.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Operation.java @@ -12,6 +12,8 @@ package com.oracle.truffle.r.parser.ast; import java.util.*; +import com.oracle.truffle.api.source.*; + public abstract class Operation extends ASTNode { public static final int EQ_PRECEDENCE = 1; @@ -35,10 +37,11 @@ public abstract class Operation extends ASTNode { public static final int SIGN_PRECEDENCE = COLON_PRECEDENCE + 1; public static final int POW_PRECEDENCE = SIGN_PRECEDENCE + 1; - final ASTNode lhs; + private final ASTNode lhs; - public Operation(ASTNode left) { - this.lhs = updateParent(left); + protected Operation(SourceSection source, ASTNode left) { + super(source); + this.lhs = left; } public ASTNode getLHS() { diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Or.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Or.java index bcee5165cb934ced88e4f50ba3f0f2fb93e89a80..5b482592b43547fbb2d31f55c33555e643a3218f 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Or.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Or.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.OR_PRECEDENCE) public class Or extends BinaryOperation { - public Or(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Or(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/OuterMult.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/OuterMult.java index 1a9ee5675ef284e5b03f84a643cdbb314d92bf41..42f33e2230cf4b4221966b6242d7ac1ced82a6ab 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/OuterMult.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/OuterMult.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.OUTER_MULT_PRECEDENCE) public class OuterMult extends BinaryOperation { - public OuterMult(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public OuterMult(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Pow.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Pow.java index 9b31b44088658ee9acff69e7b916662bbb5bb9f4..487e38ebf09336ef48ac42598b9189b2b53d56ea 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Pow.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Pow.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.POW_PRECEDENCE) public class Pow extends BinaryOperation { - public Pow(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Pow(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Repeat.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Repeat.java index 114f2995521ad3948b7599b5a34c988dacefc82c..dabb6c4880a6cb37dfa8838c58ab2501834ed784 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Repeat.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Repeat.java @@ -14,8 +14,8 @@ import com.oracle.truffle.api.source.*; public class Repeat extends Loop { - public Repeat(SourceSection src, ASTNode body) { - super(src, body); + public Repeat(SourceSection source, ASTNode body) { + super(source, body); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Replacement.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Replacement.java index 2d91db17382a9b411db5f18f6998291b08c1e476..47ad92ad5471a15060dd4dd7c819de2866fff929 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Replacement.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Replacement.java @@ -26,15 +26,14 @@ import com.oracle.truffle.api.source.*; public class Replacement extends AssignVariable { - final FunctionCall replacementFunctionCall; + private final FunctionCall replacementFunctionCall; - public Replacement(SourceSection src, boolean isSuper, FunctionCall builtin, ASTNode rhs) { - super(isSuper, rhs); - this.replacementFunctionCall = builtin; - this.source = src; + public Replacement(SourceSection src, boolean isSuper, FunctionCall replacementFunctionCall, ASTNode rhs) { + super(src, isSuper, rhs); + this.replacementFunctionCall = replacementFunctionCall; } - public FunctionCall getBuiltin() { + public FunctionCall getReplacementFunctionCall() { return replacementFunctionCall; } @@ -42,5 +41,4 @@ public class Replacement extends AssignVariable { public <R> R accept(Visitor<R> v) { return v.visit(this); } - } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sequence.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sequence.java index 067f215d41513d1a4089e6fc97285bc45576754a..1416a65f68dafa8116f9c77d3efd6cde880eebf7 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sequence.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sequence.java @@ -16,11 +16,11 @@ import com.oracle.truffle.api.source.*; public class Sequence extends ASTNode { - ASTNode[] exprs; + private final ASTNode[] expressions; - Sequence(SourceSection src, ASTNode[] e) { - exprs = updateParent(e); // FIXME or not ... do we need to duplicate this array - source = src; + private Sequence(SourceSection source, ASTNode[] expressions) { + super(source); + this.expressions = expressions; // FIXME or not ... do we need to duplicate this array } @Override @@ -28,14 +28,14 @@ public class Sequence extends ASTNode { return v.visit(this); } - public ASTNode[] getExprs() { - return exprs; + public ASTNode[] getExpressions() { + return expressions; } @Override public <R> List<R> visitAll(Visitor<R> v) { List<R> list = new ArrayList<>(); - for (ASTNode e : exprs) { + for (ASTNode e : expressions) { list.add(e.accept(v)); } return list; diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessTempVariable.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessTempVariable.java index 13df5b2eb73887786478ce1fe19bb0af75f2f729..b2110b1b6d1277c4ec2feb8d839a1b578330710d 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessTempVariable.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessTempVariable.java @@ -29,10 +29,10 @@ import com.oracle.truffle.api.source.*; @Precedence(Precedence.MAX) public class SimpleAccessTempVariable extends AccessVariable { - Object tempSymbol; + private final Object tempSymbol; public SimpleAccessTempVariable(SourceSection source, Object tempSymbol) { - this.source = source; + super(source); this.tempSymbol = tempSymbol; } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessVariable.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessVariable.java index badf15b4ba762db171bf1717d13ba73d406481e8..263d191bdc6273d2d698ab7faa1043a902974f4d 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessVariable.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAccessVariable.java @@ -17,17 +17,17 @@ import com.oracle.truffle.api.source.*; @Precedence(Precedence.MAX) public class SimpleAccessVariable extends AccessVariable { - Symbol symbol; - boolean shouldCopyValue; + private final Symbol variable; + private final boolean shouldCopyValue; - public SimpleAccessVariable(SourceSection src, Symbol sym, boolean copy) { - source = src; - symbol = sym; - shouldCopyValue = copy; + public SimpleAccessVariable(SourceSection source, Symbol variable, boolean shouldCopyValue) { + super(source); + this.variable = variable; + this.shouldCopyValue = shouldCopyValue; } - public Symbol getSymbol() { - return symbol; + public Symbol getVariable() { + return variable; } public boolean shouldCopyValue() { diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAssignVariable.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAssignVariable.java index b763f22ee9749b09a0634dafda5e780c22f8da74..b82e2c01b27036bbae0f943e2b67a1fd727b9d14 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAssignVariable.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/SimpleAssignVariable.java @@ -14,15 +14,14 @@ import com.oracle.truffle.api.source.*; public class SimpleAssignVariable extends AssignVariable { - Symbol variable; + private final Symbol variable; - public SimpleAssignVariable(SourceSection src, boolean isSuper, Symbol var, ASTNode rhs) { - super(isSuper, rhs); - source = src; - variable = var; + public SimpleAssignVariable(SourceSection source, boolean isSuper, Symbol variable, ASTNode rhs) { + super(source, isSuper, rhs); + this.variable = variable; } - public Symbol getSymbol() { + public Symbol getVariable() { return variable; } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sub.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sub.java index 4d3793cfd690a2994804c1dbb22f966fe78a690e..3ba54fc5246809ef1a4f2fdbd006674f808466bc 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sub.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Sub.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @Precedence(Operation.SUB_PRECEDENCE) public class Sub extends BinaryOperation { - public Sub(SourceSection src, ASTNode l, ASTNode r) { - super(src, l, r); + public Sub(SourceSection source, ASTNode l, ASTNode r) { + super(source, l, r); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Symbol.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Symbol.java index f4b2d3c45af6caaef7e712ae36a507895ace3150..9781ce0da08c83efee66542f605b1bc8649fd613 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Symbol.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/Symbol.java @@ -43,7 +43,7 @@ public final class Symbol { // TODO A less stupid implementation for symbol table // i.e., close to a set implementation with linear probing - final Map<String, Symbol> table = new HashMap<>(); + private final Map<String, Symbol> table = new HashMap<>(); private Symbol get(String name) { Symbol sym = table.get(name); diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryMinus.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryMinus.java index dcae65018f5ca2bb5a35aa36adaae5267fc5cd17..057d2c6ff1605ae867ac0d9560f083e36d26d287 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryMinus.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryMinus.java @@ -16,8 +16,8 @@ import com.oracle.truffle.api.source.*; @PrettyName("-") public class UnaryMinus extends UnaryOperation { - public UnaryMinus(SourceSection src, ASTNode operand) { - super(src, operand); + public UnaryMinus(SourceSection source, ASTNode operand) { + super(source, operand); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryOperation.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryOperation.java index 8b6469cf761b377b85a59901ee84610e7a0d6644..7181e9d89a5ab3ac2faa70646c24fe7341a0704e 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryOperation.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UnaryOperation.java @@ -14,19 +14,18 @@ import com.oracle.truffle.api.source.*; public abstract class UnaryOperation extends Operation { - public UnaryOperation(SourceSection src, ASTNode op) { - super(op); - source = src; + public UnaryOperation(SourceSection source, ASTNode op) { + super(source, op); } - public static ASTNode create(SourceSection src, UnaryOperator op, ASTNode operand) { + public static ASTNode create(SourceSection source, UnaryOperator op, ASTNode operand) { switch (op) { case PLUS: - return new Not(src, operand); + return new Not(source, operand); case MINUS: - return new UnaryMinus(src, operand); + return new UnaryMinus(source, operand); case NOT: - return new Not(src, operand); + return new Not(source, operand); } throw new Error("No node implemented for: '" + op + "' (" + operand + ")"); } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateField.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateField.java index 952072504d339e08c0796824e6847d08318b09aa..9e8c101fca8f7dfd012534f582a7c6681b637668 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateField.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateField.java @@ -19,14 +19,14 @@ import com.oracle.truffle.api.source.*; */ public class UpdateField extends ASTNode { - FieldAccess vector; - ASTNode rhs; - final boolean isSuper; + private final FieldAccess vector; + private final ASTNode rhs; + private final boolean isSuper; public UpdateField(SourceSection src, boolean isSuper, FieldAccess vector, ASTNode rhs) { - this.source = src; - this.vector = updateParent(vector); - this.rhs = updateParent(rhs); + super(src); + this.vector = vector; + this.rhs = rhs; this.isSuper = isSuper; } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateVector.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateVector.java index baed9376bc0a6b2a9d99d5c67e164431473e222d..655221730ab856e67aaa8afa3b374a08617a3065 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateVector.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/UpdateVector.java @@ -14,13 +14,14 @@ import java.util.*; public class UpdateVector extends ASTNode { - final AccessVector vector; - final ASTNode rhs; - final boolean isSuper; + private final AccessVector vector; + private final ASTNode rhs; + private final boolean isSuper; public UpdateVector(boolean isSuper, AccessVector vector, ASTNode rhs) { - this.vector = updateParent(vector); - this.rhs = updateParent(rhs); + super(null); + this.vector = vector; + this.rhs = rhs; this.isSuper = isSuper; } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/While.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/While.java index c99517aea1f663c7304dc655aa4577257e22afe6..a42da7657e04a2d9f24f37bf48c7672b4b210c34 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/While.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/While.java @@ -16,24 +16,20 @@ import com.oracle.truffle.api.source.*; public class While extends Loop { - ASTNode cond; + private final ASTNode condition; - public While(SourceSection src, ASTNode cond, ASTNode expr) { - super(src, expr); - setCond(cond); + public While(SourceSection source, ASTNode condition, ASTNode expression) { + super(source, expression); + this.condition = condition; } - public ASTNode getCond() { - return cond; - } - - public void setCond(ASTNode cond) { - this.cond = updateParent(cond); + public ASTNode getCondition() { + return condition; } @Override public <R> List<R> visitAll(Visitor<R> v) { - return Arrays.asList(getCond().accept(v), getBody().accept(v)); + return Arrays.asList(getCondition().accept(v), getBody().accept(v)); } @Override diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/PrettyPrinter.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/PrettyPrinter.java index a7b6c7f4ec4ade141aa3a32278ac8366736c071c..718aaa9d94f75cfe904310d70de5decbab66e793 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/PrettyPrinter.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/PrettyPrinter.java @@ -19,9 +19,9 @@ public class PrettyPrinter extends BasicVisitor<Void> { public static final boolean PARENTHESIS = false; - int level = 0; - final PrintStream out; - StringBuilder buff = new StringBuilder(); + private int level = 0; + private final PrintStream out; + private final StringBuilder buff = new StringBuilder(); private static PrettyPrinter pp = getStringPrettyPrinter(); public PrettyPrinter(PrintStream stream) { @@ -109,7 +109,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { @Override public Void visit(Sequence n) { - ASTNode[] exprs = n.getExprs(); + ASTNode[] exprs = n.getExpressions(); switch (exprs.length) { case 0: print("{}"); @@ -138,7 +138,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { @Override public Void visit(If n) { print("if("); - n.getCond().accept(this); + n.getCondition().accept(this); print(") "); n.getTrueCase().accept(this); ASTNode f = n.getFalseCase(); @@ -212,7 +212,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { @Override public Void visit(While n) { print("while("); - n.getCond().accept(this); + n.getCondition().accept(this); print(") "); n.getBody().accept(this); return null; @@ -221,7 +221,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { @Override public Void visit(For n) { print("for("); - print(n.getCVar().pretty()); + print(n.getVariable().pretty()); print(" in "); n.getRange().accept(this); print(") "); @@ -231,7 +231,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { @Override public Void visit(SimpleAssignVariable n) { - print(n.getSymbol().pretty()); + print(n.getVariable().pretty()); print(" <- "); n.getExpr().accept(this); return null; @@ -241,7 +241,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { public Void visit(AccessVector n) { print(n.getVector()); print(n.isSubset() ? "[" : "[["); - print(n.getArgs(), true); + print(n.getArguments(), true); print(n.isSubset() ? "]" : "]]"); return null; } @@ -257,7 +257,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { @Override public Void visit(FunctionCall n) { print(n.getName().pretty() + "("); - print(n.getArgs(), true); + print(n.getArguments(), true); print(")"); return null; } @@ -273,7 +273,7 @@ public class PrettyPrinter extends BasicVisitor<Void> { @Override public Void visit(SimpleAccessVariable n) { - print(n.getSymbol().pretty()); + print(n.getVariable().pretty()); return null; } diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/TreeViewer.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/TreeViewer.java index 58d6751f868fecc2ffc2b4d2bc5bc64d2eceff54..4ce2678e8995fd7fc254ae34164575dbdaff0a7a 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/TreeViewer.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/tools/TreeViewer.java @@ -18,9 +18,6 @@ import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; -import com.oracle.truffle.api.CompilerDirectives.*; -import com.oracle.truffle.r.parser.ast.*; - public class TreeViewer extends JTree { private static final long serialVersionUID = 1L; @@ -28,31 +25,44 @@ public class TreeViewer extends JTree { private static Map<Class<?>, Field[]> fieldsForClass = new LinkedHashMap<>(); private static TreeViewer treeViewer; + private static final Object[] roots = new Object[100]; - public static void showTree(ASTNode root) { + public static void showTree(Object root) { + System.arraycopy(roots, 0, roots, 1, roots.length - 1); + roots[0] = root; if (treeViewer == null) { - treeViewer = new TreeViewer("Basic Tree viewer (using reflection)", root); + try { + UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { + e.printStackTrace(); + } + treeViewer = new TreeViewer("Basic Tree viewer (using reflection)"); } else { - treeViewer.setRoot(root); + treeViewer.updateRoots(); } } - ASTNode root; - JFrame frame; + private JFrame frame; private static Field[] getFieldsFor(Class<?> clazz) { + if (clazz.getName().startsWith("java.lang.") || Enum.class.isAssignableFrom(clazz)) { + return new Field[0]; + } if (fieldsForClass.containsKey(clazz)) { return fieldsForClass.get(clazz); } Class<?> current = clazz; ArrayList<Field> fields = new ArrayList<>(); - while (current != ASTNode.class) { - Field[] f = current.getDeclaredFields(); - for (int i = 0; i < f.length; i++) { - if (ASTNode.class.isAssignableFrom(f[i].getType())) { - f[i].setAccessible(true); - fields.add(f[i]); + while (current != Object.class) { + for (Field f : current.getDeclaredFields()) { + if (Modifier.isStatic(f.getModifiers()) || Modifier.isSynchronized(f.getModifiers())) { + continue; } + if (f.getName().equals("parent") || f.getName().equals("source")) { + continue; + } + f.setAccessible(true); + fields.add(f); } current = current.getSuperclass(); } @@ -61,16 +71,15 @@ public class TreeViewer extends JTree { return res; } - void setRoot(ASTNode newRoot) { - root = newRoot; + private void updateRoots() { setModel(newModel()); treeDidChange(); frame.setVisible(true); } - public TreeViewer(String title, ASTNode node) { - super(); - + public TreeViewer(String title) { + setRootVisible(false); + setShowsRootHandles(true); frame = new JFrame(title); JScrollPane scrollPane = new JScrollPane(this); @@ -83,55 +92,56 @@ public class TreeViewer extends JTree { frame.setAlwaysOnTop(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); - - setRoot(node); + frame.setSize(800, 400); frame.setVisible(true); } - @Override - @SlowPath - public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { - StringBuffer res = new StringBuffer(); - if (hasFocus) { - ASTNode parent = ((ASTNode) value).getParent(); - if (parent != null) { - for (Field f : getFieldsFor(parent.getClass())) { - try { - if (f.get(parent) == value) { - res.append('['); - res.append(f.getName()); - res.append("] "); - break; - } - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } + private static final class Node { + public final String text; + public final Object value; + + public Node(String text, Object value) { + if (value instanceof Object[]) { + this.text = text + " = " + value.getClass().getComponentType().getSimpleName() + "[" + ((Object[]) value).length + "]"; + } else { + String valueString = String.valueOf(value); + if (valueString.length() > 80) { + valueString = valueString.substring(0, 80) + "..."; } + this.text = text + " = " + (value == null ? "null" : ("\"" + valueString + "\" (" + value.getClass().getSimpleName() + ")")); } + this.value = value; } - res.append(value.getClass().getSimpleName()); - res.append(": "); - res.append(value.toString()); - if (!hasFocus) { - res.append(" "); - } - return res.toString(); + } + @Override + public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { + if (value instanceof Node) { + return ((Node) value).text; + } else { + return String.valueOf(value); + } } - private TreeModel newModel() { + private static TreeModel newModel() { return new TreeModel() { @Override public Object getRoot() { - return root; + return new Node("root", roots); } @Override public Object getChild(Object parent, int index) { + Object parentValue = ((Node) parent).value; try { - return getFieldsFor(parent.getClass())[index].get(parent); + if (parentValue instanceof Object[]) { + return new Node("[" + index + "]", ((Object[]) parentValue)[index]); + } else { + Field field = getFieldsFor(parentValue.getClass())[index]; + return new Node(field.getName(), field.get(parentValue)); + } } catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } @@ -140,7 +150,14 @@ public class TreeViewer extends JTree { @Override public int getChildCount(Object parent) { - return getFieldsFor(parent.getClass()).length; + Object parentValue = ((Node) parent).value; + if (parentValue instanceof Object[]) { + return ((Object[]) parentValue).length; + } else if (parentValue != null) { + return getFieldsFor(parentValue.getClass()).length; + } else { + return 0; + } } @Override @@ -154,13 +171,28 @@ public class TreeViewer extends JTree { @Override public int getIndexOfChild(Object parent, Object child) { - int i = 0; - Field[] fields = getFieldsFor(parent.getClass()); - for (Field field : fields) { - if (field == child) { - return i; + Object parentValue = ((Node) parent).value; + Object childValue = ((Node) child).value; + if (parentValue instanceof Object[]) { + Object[] array = (Object[]) parentValue; + for (int i = 0; i < array.length; i++) { + if (array[i] == childValue) { + return i; + } + } + } else { + int i = 0; + Field[] fields = getFieldsFor(parentValue.getClass()); + for (Field field : fields) { + try { + if (field.get(parentValue) == childValue) { + return i; + } + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + i++; } - i++; } return -1; } diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java.disable b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java similarity index 100% rename from com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java.disable rename to com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jnr/JNR_RFFIFactory.java b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jnr/JNR_RFFIFactory.java index e0df51148e3f7d24ab604f1e24e46f6719f45772..44ff75d2b9a6a1db3bfc651229d338066fd05a30 100644 --- a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jnr/JNR_RFFIFactory.java +++ b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jnr/JNR_RFFIFactory.java @@ -610,7 +610,4 @@ public class JNR_RFFIFactory extends RFFIFactory implements RFFI, BaseRFFI, RDer public int uncompress(byte[] dest, long[] destlen, byte[] source) { return zip().uncompress(dest, destlen, source, source.length); } - - - } diff --git a/com.oracle.truffle.r.runtime/.checkstyle_checks.xml b/com.oracle.truffle.r.runtime/.checkstyle_checks.xml.disabled similarity index 100% rename from com.oracle.truffle.r.runtime/.checkstyle_checks.xml rename to com.oracle.truffle.r.runtime/.checkstyle_checks.xml.disabled diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCmdOptions.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCmdOptions.java index a720fdef9fd22c195c7b88cc2d3e7877814b202f..942e227406c494e8ce8884daa9a235ec789e4970 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCmdOptions.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCmdOptions.java @@ -131,19 +131,19 @@ public class RCmdOptions { /** * The option name prefixed by {@code --} or {@code null} if no {@code --} form. */ - final String name; + private final String name; /** * The short option name prefixed by {@code -} or {@code null} if no {@code -} form. */ - final String shortName; + private final String shortName; /** * The '=' separated suffix, e.g. {@code --file=FILE}. */ - String suffix; + private String suffix; /** * The space separated suffix, e.g. {@code -g TYPE}. */ - String shortSuffix; + private String shortSuffix; /** * The help text. */ diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RContext.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RContext.java index 17f44119cd80056358c2959fc9ab954effac8d7d..69622bd4be13bf7bc6cd7a913bfd83021b9e691d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RContext.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RContext.java @@ -171,7 +171,9 @@ public final class RContext extends ExecutionContext { * @param envForFrame the environment that {@code frame} is bound to. * @return the object returned by the evaluation or {@code null} if an error occurred. */ - Object parseAndEval(String rscript, VirtualFrame frame, REnvironment envForFrame, boolean printResult); + Object parseAndEval(String rscript, VirtualFrame frame, REnvironment envForFrame, boolean printResult, boolean allowIncompleteSource); + + static final Object INCOMPLETE_SOURCE = new Object(); /** * diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java index b1362c32b997a432d6535af4ac847d02a2a2a7ee..ec17635f5c999736277caa878e674eab07a28e7e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java @@ -138,7 +138,7 @@ public class RDeparse { private static final PPInfo BUILTIN = new PPInfo(PP.FUNCALL, 0, false); - static PPInfo ppInfo(String op) { + private static PPInfo ppInfo(String op) { for (Func func : FUNCTAB) { if (func.op.equals(op)) { return func.info; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvironment.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvironment.java index b33799831ef61b29bd5cb8e1aa33b532216fd741..2f3d3420f586edadc4b36be26c2d4047db67164a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvironment.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvironment.java @@ -500,7 +500,7 @@ public abstract class REnvironment implements RAttributable { */ private RStringVector getNamespaceSpec() { Object value = frameAccess.get(NAMESPACE_KEY); - if (value != null && value instanceof REnvironment) { + if (value instanceof REnvironment) { REnvironment info = (REnvironment) value; Object spec = info.frameAccess.get("spec"); if ((spec != null) && spec instanceof RStringVector) { @@ -596,11 +596,15 @@ public abstract class REnvironment implements RAttributable { * namespaces are a special case; they have no name attribute, but they print with the * name which is buried. */ - RStringVector spec = getNamespaceSpec(); - if (spec != null) { - return "namespace:" + spec.getDataAt(0); + if (frameAccess == noFrameAccess) { + return "function def"; } else { - return String.format("%#x", hashCode()); + RStringVector spec = getNamespaceSpec(); + if (spec != null) { + return "namespace:" + spec.getDataAt(0); + } else { + return String.format("%#x", hashCode()); + } } } else { return attrName; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackageVariables.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackageVariables.java index e894524c4cce5453cb0b25c89e5e06619d7e06a7..a1d2fe6bd04d4f6d60ac91dc213670cd4da75788 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackageVariables.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackageVariables.java @@ -27,7 +27,7 @@ import java.util.*; import com.oracle.truffle.r.runtime.REnvironment.PackageKind; /** - * Support for (global) variables deined by packages (e.g. {@code base)}. Similar to + * Support for (global) variables defined by packages (e.g. {@code base)}. Similar to * {@link ROptions}, when a package is loaded, if it defines (global) variables, it must register * with this class. On startup, the {@code Handler} is called with the {@link REnvironment} instance * for the package, which can be used to define the variables. diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackages.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackages.java index d6d17eaf544809e7079d6d5b4cd14c2239618e4b..da31a30937f5b916dc40219604f233c0743eb23b 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackages.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RPackages.java @@ -28,9 +28,9 @@ import java.util.*; * Support for recording the set of default R packages. */ public class RPackages { - public static class RPackage { - final String name; - final String path; + static class RPackage { + public final String name; + public final String path; RPackage(String name, String path) { this.name = name; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java index 67e2c84ee01824616bea2c07f66f63b1deb997c7..58857384fa15ddbf24d57fada0e3c5593651e67a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java @@ -349,20 +349,21 @@ public class RRuntime { } public static byte string2logicalNoCheck(String s) { - if (s.equals("TRUE") || s.equals("T")) { - return TRUE; + switch (s) { + case "TRUE": + case "T": + case "True": + case "true": + return TRUE; + case "FALSE": + case "F": + case "False": + case "false": + return FALSE; + default: + RContext.getInstance().getAssumptions().naIntroduced.invalidate(); + return LOGICAL_NA; } - if (s.equals("FALSE") || s.equals("F")) { - return FALSE; - } - if (s.equals("True") || s.equals("true")) { - return TRUE; - } - if (s.equals("False") || s.equals("false")) { - return FALSE; - } - RContext.getInstance().getAssumptions().naIntroduced.invalidate(); - return LOGICAL_NA; } public static byte string2logical(String s) { @@ -634,41 +635,41 @@ public class RRuntime { return value == LOGICAL_NA; } - public static boolean isNA(int left) { - return left == INT_NA; + public static boolean isNA(int value) { + return value == INT_NA; } - public static boolean isNA(double left) { - return Double.doubleToRawLongBits(left) == NA_LONGBITS; + public static boolean isNA(double value) { + return Double.doubleToRawLongBits(value) == NA_LONGBITS; } - public static boolean isNA(RComplex left) { - return isNA(left.getRealPart()); + public static boolean isNA(RComplex value) { + return isNA(value.getRealPart()); } - public static boolean isComplete(String left) { - return !isNA(left); + public static boolean isComplete(String value) { + return !isNA(value); } - public static boolean isComplete(byte left) { - return !isNA(left); + public static boolean isComplete(byte value) { + return !isNA(value); } - public static boolean isComplete(int left) { - return !isNA(left); + public static boolean isComplete(int value) { + return !isNA(value); } - public static boolean isComplete(double left) { - return !isNA(left); + public static boolean isComplete(double value) { + return !isNA(value); } - public static boolean isComplete(RComplex left) { - return !isNA(left); + public static boolean isComplete(RComplex value) { + return !isNA(value); } @SlowPath - public static String quoteString(String data) { - return isNA(data) ? STRING_NA : "\"" + data + "\""; + public static String quoteString(String value) { + return isNA(value) ? STRING_NA : "\"" + value + "\""; } public static FrameSlotKind getSlotKind(Object value) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/VisibilityController.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/VisibilityController.java index 381b2ed54ca0977741146e9efcc83a7431c0c47b..89573c928355ac5928c07667bbcf0920f1b9289f 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/VisibilityController.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/VisibilityController.java @@ -53,5 +53,4 @@ public interface VisibilityController { RContext.setVisible(getVisibility()); } } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java index 57e7ecde17bf4b66d076e503b3b530ecea92ef92..e13a72c8a9a0c64039fe4599d6386a27bc8db148 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java @@ -33,7 +33,7 @@ import com.oracle.truffle.r.runtime.*; public interface RAttributable { /** * If the attribute set is not initialized, then initialize it. - * + * * @return the pre-existing or new value */ RAttributes initAttributes(); @@ -79,5 +79,4 @@ public interface RAttributable { attributes.remove(name); } } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributes.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributes.java index 44eb52724df41d1fc3a66b0f7ffe7c741787869c..2e03c58e0cd4d2eeff516188788291013eaeb682 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributes.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributes.java @@ -25,7 +25,7 @@ package com.oracle.truffle.r.runtime.data; import java.util.*; import com.oracle.truffle.api.*; -import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; +import com.oracle.truffle.api.CompilerDirectives.*; import com.oracle.truffle.r.runtime.*; /** @@ -46,6 +46,7 @@ public abstract class RAttributes implements Iterable<RAttributes.RAttribute> { Object getValue(); } + @ValueType private static class AttrInstance implements RAttribute { private String name; private Object value; @@ -69,7 +70,6 @@ public abstract class RAttributes implements Iterable<RAttributes.RAttribute> { public String toString() { return name + "=" + value; } - } public abstract void put(String name, Object value); @@ -340,7 +340,6 @@ public abstract class RAttributes implements Iterable<RAttributes.RAttribute> { private int maxSize; RAttributesStatsImpl() { - super(); hist[0]++; } @@ -397,5 +396,4 @@ public abstract class RAttributes implements Iterable<RAttributes.RAttribute> { } } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RBounded.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RBounded.java index a53a3a008da03b515fd1b132dd7f66c1473efb25..8de99685e8e13b3d771ddd460de67c7ad6046dae 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RBounded.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RBounded.java @@ -52,5 +52,4 @@ public abstract class RBounded { throw RError.error(frame, sourceSection, RError.Message.DIMS_DONT_MATCH_LENGTH, length, getLength()); } } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java index 3f50acf70b2956862e2a7ccf66eeb1219cb7bf99..1d6c27a5912b70e1a7d582904ff592b385c8776c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplex.java @@ -23,9 +23,10 @@ package com.oracle.truffle.r.runtime.data; import com.oracle.truffle.api.CompilerDirectives.SlowPath; +import com.oracle.truffle.api.CompilerDirectives.ValueType; import com.oracle.truffle.r.runtime.*; -@com.oracle.truffle.api.CompilerDirectives.ValueType +@ValueType public final class RComplex extends RScalar { private final double realPart; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java index dfae974cba710fc03b507019ca26288acfe7c1d3..1f4e6f04524a1460135db0ef997ffe9ae737571e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RComplexVector.java @@ -41,7 +41,7 @@ public final class RComplexVector extends RVector implements RAbstractComplexVec this.data = data; } - RComplexVector(double[] data, boolean complete, int[] dims) { + private RComplexVector(double[] data, boolean complete, int[] dims) { this(data, complete, dims, null); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java index a484c8e7ccf33d5deddc0b472aab8ebbaf477847..6319f7751364d1894065d630c06e3a9d4e1ed305 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDouble.java @@ -23,13 +23,14 @@ package com.oracle.truffle.r.runtime.data; import com.oracle.truffle.api.CompilerDirectives.SlowPath; +import com.oracle.truffle.api.CompilerDirectives.ValueType; -@com.oracle.truffle.api.CompilerDirectives.ValueType +@ValueType public final class RDouble extends RScalar { private final double value; - RDouble(double value) { + private RDouble(double value) { this.value = value; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java index db48cd672057b35ca05c4090c3bad31d5a0e6165..7a277630d25c3bda8756f51ce22c828f9239903d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleSequence.java @@ -108,5 +108,4 @@ public final class RDoubleSequence extends RSequence implements RAbstractDoubleV RDoubleVector.resizeData(data, data, getLength(), fillNA); return RDataFactory.createDoubleVector(data, !(fillNA && size > getLength())); } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java index af6f0d9d1d15b13094fe27d7d787049e86bf19d0..f5e1372eaacd0aa86fbf908a7f37c9d8e12664dd 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDoubleVector.java @@ -46,7 +46,7 @@ public final class RDoubleVector extends RVector implements RAbstractDoubleVecto this.data = data; } - RDoubleVector(double[] data, boolean complete, int[] dims) { + private RDoubleVector(double[] data, boolean complete, int[] dims) { this(data, complete, dims, null); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RExpression.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RExpression.java index 6b1da35195d2d1f4ad170af246f8f1b94803d473..33d0a909cb4e3a6beca8d856ff9ec0b2b1e259e4 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RExpression.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RExpression.java @@ -117,5 +117,4 @@ public class RExpression implements RShareable, RAbstractContainer { public RShareable materializeToShareable() { return this; } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFormula.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFormula.java index 27677923ea56ba1d152fbb4278ae0dd974961bbb..43d57b97005be8dfb6e1aefe90478a04a3210d07 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFormula.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFormula.java @@ -53,5 +53,4 @@ public class RFormula extends RScalar { public Object getModel() { return model; } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFunction.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFunction.java index 3b29ea28ea6a6faf5ce31a5343cff08ae842c0c7..a0820043d8ec6423ac7cec04b6c160be031bce99 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFunction.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RFunction.java @@ -80,7 +80,6 @@ public final class RFunction extends RScalar { public void setEnclosingFrame(MaterializedFrame frame) { this.enclosingFrame = frame; } - public void setUsePromises() { usePromises = true; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInt.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInt.java index e1e59f9572b68c485da68c463a8f2104f392e4d4..a22d1b7ff1c076d3798e062e3e6489486038eb08 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInt.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RInt.java @@ -22,9 +22,10 @@ */ package com.oracle.truffle.r.runtime.data; +import com.oracle.truffle.api.CompilerDirectives.ValueType; import com.oracle.truffle.r.runtime.*; -@com.oracle.truffle.api.CompilerDirectives.ValueType +@ValueType public final class RInt extends RScalar { private final int value; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java index 774d7d0e294661e2ea42aa020a9594fca15673f1..cfe868729c3258204abb820eb67b1534ca8b82aa 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntSequence.java @@ -33,7 +33,7 @@ public final class RIntSequence extends RSequence implements RAbstractIntVector RIntSequence(int start, int stride, int length) { super(length); -// assert length > 0; + // assert length > 0; this.start = start; this.stride = stride; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java index 6003ab0cf40608137f17ba5148c5ae69e68f946f..e642994fc98e53c53c83e96f512c364fa173b194 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RIntVector.java @@ -46,7 +46,7 @@ public final class RIntVector extends RVector implements RAbstractIntVector { this.data = data; } - RIntVector(int[] data, boolean complete, int[] dims) { + private RIntVector(int[] data, boolean complete, int[] dims) { this(data, complete, dims, null); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java index 6cddc5bf77f566435edabbf6e45c8acbea073cd6..12227e09271b18d60eb8128619ff9a2ae0e0258c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java @@ -22,14 +22,15 @@ */ package com.oracle.truffle.r.runtime.data; +import com.oracle.truffle.api.CompilerDirectives.ValueType; + /** * Denotes an (unevaluated) element of, e.g. an {@link RExpression}. */ -@com.oracle.truffle.api.CompilerDirectives.ValueType +@ValueType public class RLanguage extends RLanguageRep { public RLanguage(Object rep) { super(rep); } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguageRep.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguageRep.java index 5603604e36cecb024aaf8719ac6ec0d026a5366b..357947dccd9fbb24d3c5700519435ca42ad27697 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguageRep.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguageRep.java @@ -31,6 +31,7 @@ package com.oracle.truffle.r.runtime.data; * and {@link RPromise}. */ public class RLanguageRep { + private final Object rep; public RLanguageRep(Object rep) { @@ -40,5 +41,4 @@ public class RLanguageRep { public Object getRep() { return rep; } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RList.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RList.java index 364241210364682d1a02571ce4a813b3f0cb04cd..ed0c75b277a7d93facca22b0425d2d349284afd7 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RList.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RList.java @@ -44,7 +44,7 @@ public final class RList extends RVector implements RAbstractVector { this.data = data; } - RList(Object[] data, boolean isComplete, int[] dims) { + private RList(Object[] data, boolean isComplete, int[] dims) { this(data, isComplete, dims, null); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java index 18b371336546836c6b3ea93b1bd73df9bd4d007d..f4e86c794d629d102c868013231af873692c7a1e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogical.java @@ -22,14 +22,15 @@ */ package com.oracle.truffle.r.runtime.data; +import com.oracle.truffle.api.CompilerDirectives.ValueType; import com.oracle.truffle.r.runtime.*; -@com.oracle.truffle.api.CompilerDirectives.ValueType +@ValueType public final class RLogical extends RScalar { private final byte value; - RLogical(byte value) { + private RLogical(byte value) { this.value = value; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java index 0bd02e5f96320928c3d25ebc375bbf05b7958610..70eca190472e2d7e128bf72a09f1482b3ab1e9d5 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLogicalVector.java @@ -40,7 +40,7 @@ public final class RLogicalVector extends RVector implements RAbstractLogicalVec this.data = data; } - RLogicalVector(byte[] data, boolean complete, int[] dims) { + private RLogicalVector(byte[] data, boolean complete, int[] dims) { this(data, complete, dims, null); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java index 0544ce74b73d6ad0bc5f8f7297aab39b425132c6..35d480a82558cc1546d68c7368f003ff6223ffcf 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java @@ -31,10 +31,11 @@ import com.oracle.truffle.r.runtime.gnur.*; * Denotes the (rarely seen) {@code pairlist} type in R. */ public class RPairList implements RAttributable, RAbstractContainer { - private Object car; - private Object cdr; + private final Object car; + private final Object cdr; private Object tag; private RAttributes attributes; + /** * Denotes the (GnuR) typeof entity that the pairlist represents. */ @@ -182,5 +183,4 @@ public class RPairList implements RAttributable, RAbstractContainer { public boolean isObject() { return false; } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPromise.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPromise.java index 0142a9b114d76153f08ac5cab00211fffafcbf07..cc84a9efaa7f79b687fe644ac3ba373799072e97 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPromise.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPromise.java @@ -25,14 +25,15 @@ package com.oracle.truffle.r.runtime.data; import com.oracle.truffle.api.*; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.CompilerDirectives.SlowPath; +import com.oracle.truffle.api.CompilerDirectives.ValueType; import com.oracle.truffle.api.frame.*; import com.oracle.truffle.r.runtime.*; /** * Denotes an R {@code promise}. It extends {@link RLanguageRep} with a (lazily) evaluated value. */ -@com.oracle.truffle.api.CompilerDirectives.ValueType -public class RPromise { +@ValueType +public final class RPromise { /** * The policy used to evaluate a promise. @@ -133,7 +134,7 @@ public class RPromise { * @param env {@link #env} * @param expr {@link #exprRep} */ - RPromise(EvalPolicy evalPolicy, PromiseType type, REnvironment env, Object expr) { + private RPromise(EvalPolicy evalPolicy, PromiseType type, REnvironment env, Object expr) { this.evalPolicy = evalPolicy; this.type = type; this.env = env; @@ -307,26 +308,6 @@ public class RPromise { return "[" + evalPolicy + ", " + type + ", " + env + ", expr=" + exprRep.getRep() + ", " + value + ", " + isEvaluated + "]"; } - /** - * A {@link RPromise} implementation that already has its argument value evaluated. - * - * @see #RPromise(EvalPolicy, PromiseType, Object) - */ - public static class RPromiseArgEvaluated extends RPromise { - - /** - * @param evalPolicy {@link EvalPolicy} - * @param argumentValue The already evaluated value of the supplied argument. - * <code>RMissing.instance</code> denotes 'argument not supplied', aka. - * 'missing'. - */ - public RPromiseArgEvaluated(EvalPolicy evalPolicy, PromiseType type, Object argumentValue) { - super(evalPolicy, type, null, null); - this.value = argumentValue; - this.isEvaluated = true; - } - } - /** * A factory which produces instances of {@link RPromise}. * @@ -381,12 +362,16 @@ public class RPromise { } /** - * @param argumentValue The already evaluated argument value + * @param argumentValue The already evaluated value of the supplied argument. + * <code>RMissing.instance</code> denotes 'argument not supplied', aka. + * 'missing'. * @return A {@link RPromise} whose supplied argument has already been evaluated - * @see RPromiseArgEvaluated */ public RPromise createPromiseArgEvaluated(Object argumentValue) { - return new RPromiseArgEvaluated(evalPolicy, type, argumentValue); + RPromise result = new RPromise(evalPolicy, type, null, null); + result.value = argumentValue; + result.isEvaluated = true; + return result; } public Object getExpr() { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java index e1f25a7b0408fadef7ef076e31fb1ef2b62d5ebd..982c90234153a64a22229103c4cd62e70dbed66b 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRaw.java @@ -22,9 +22,10 @@ */ package com.oracle.truffle.r.runtime.data; -import com.oracle.truffle.api.CompilerDirectives.*; +import com.oracle.truffle.api.CompilerDirectives.SlowPath; +import com.oracle.truffle.api.CompilerDirectives.ValueType; -@com.oracle.truffle.api.CompilerDirectives.ValueType +@ValueType public final class RRaw extends RScalar { private final byte value; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java index e981270f89326f9ebf90839a828a4e7aa306df55..a3a65f017ca99938d14e738428ef09f662244675 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java @@ -39,7 +39,7 @@ public final class RRawVector extends RVector implements RAbstractRawVector { this.data = data; } - RRawVector(byte[] data, int[] dims) { + private RRawVector(byte[] data, int[] dims) { this(data, dims, null); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RScalar.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RScalar.java index 4dba385b2cdd7b248ea8770ba4e5750a7ac18af4..ac5d0796bbdf3c49c85a67b6d0b88fb9434d030e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RScalar.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RScalar.java @@ -22,6 +22,8 @@ */ package com.oracle.truffle.r.runtime.data; -@com.oracle.truffle.api.CompilerDirectives.ValueType +import com.oracle.truffle.api.CompilerDirectives.ValueType; + +@ValueType public class RScalar { } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSequence.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSequence.java index 0ff4ec1c8083ed15f6aa4f4789797bbef2ba4361..338384a5414e8a321cd5afb1b28b36d9f47d8075 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSequence.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSequence.java @@ -120,5 +120,4 @@ public abstract class RSequence extends RBounded implements RAbstractVector { public RShareable materializeToShareable() { return this.materialize(); } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java index b00cb551e38cfbab4e353ca8a59f6d6d5a9aa32b..4de2a2d2c10d1a792279e8d717bacfc0899da70b 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RString.java @@ -22,12 +22,14 @@ */ package com.oracle.truffle.r.runtime.data; -@com.oracle.truffle.api.CompilerDirectives.ValueType +import com.oracle.truffle.api.CompilerDirectives.ValueType; + +@ValueType public final class RString { private final String value; - RString(String value) { + private RString(String value) { this.value = value; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java index 3c937d385115a971389383641ef158c001e08739..5016545d8056486f186f0180097da6ee26dbc28e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RStringVector.java @@ -39,7 +39,7 @@ public final class RStringVector extends RVector implements RAbstractStringVecto this.data = data; } - RStringVector(String[] data, boolean complete, int[] dims) { + private RStringVector(String[] data, boolean complete, int[] dims) { this(data, complete, dims, null); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSymbol.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSymbol.java index fca9e5e1f20b170b6f58cb901f47e24397c0c43a..ab97d2504da75bc40db41e5e88a2fe6504947c46 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSymbol.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RSymbol.java @@ -22,12 +22,15 @@ */ package com.oracle.truffle.r.runtime.data; +import com.oracle.truffle.api.CompilerDirectives.ValueType; + /** * Denotes an R "symbol" or "name". Its rep is a {@code String} but it's a different type in the * Truffle sense. */ -@com.oracle.truffle.api.CompilerDirectives.ValueType +@ValueType public class RSymbol { + private final String name; public RSymbol(String name) { @@ -42,5 +45,4 @@ public class RSymbol { public String toString() { return name; } - } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java index 1725f29af7745be9f2b1f962f8b02c26c434167f..3e138dd3a4a99876ba4a8766b857fc69f9b40f6a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java @@ -48,7 +48,7 @@ import edu.umd.cs.findbugs.annotations.*; */ public abstract class RVector extends RBounded implements RShareable, RAttributable, RAbstractVector { - protected boolean complete; + protected boolean complete; // "complete" means: does not contain NAs private int matrixDimension; protected int[] dimensions; protected Object names; 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 211a53126c0fd2a55eee458d6eb4893197553dcf..41f8d0602f443d87e3d84480c625c076da720452 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 @@ -36,45 +36,35 @@ public interface LapackRFFI extends RFFI { /** * See <a href="http://www.netlib.org/lapack/explore-html/d9/d28/dgeev_8f.html">spec</a>. */ - // @formatter:off - int dgeev(char jobVL, char jobVR, int n, double[] a, int lda, double[] wr, double[] wi, double[] vl, int ldvl, - double[] vr, int ldvr, double[] work, int lwork); + int dgeev(char jobVL, char jobVR, int n, double[] a, int lda, double[] wr, double[] wi, double[] vl, int ldvl, double[] vr, int ldvr, double[] work, int lwork); /** * See <a href="http://www.netlib.org/lapack/explore-html/db/de5/dgeqp3_8f.html">spec</a>. */ - // @formatter:off int dgeqp3(int m, int n, double[] a, int lda, int[] jpvt, double[] tau, double[] work, int lwork); /** * See <a href="http://www.netlib.org/lapack/explore-html/da/d82/dormqr_8f.html">spec</a>. */ - // @formatter:off - int dormqr(char side, char trans, int m, int n, int k, double[] a, int lda, double[] tau, double[] c, int ldc, - double[] work, int lwork); - + int dormqr(char side, char trans, int m, int n, int k, double[] a, int lda, double[] tau, double[] c, int ldc, double[] work, int lwork); /** * See <a href="http://www.netlib.org/lapack/explore-html/d6/d6f/dtrtrs_8f.html">spec</a>. */ - // @formatter:off int dtrtrs(char uplo, char trans, char diag, int n, int nrhs, double[] a, int lda, double[] b, int ldb); /** * See <a href="http://www.netlib.org/lapack/explore-html/d3/d6a/dgetrf_8f.html">spec</a>. */ - // @formatter:off int dgetrf(int m, int n, double[] a, int lda, int[] ipiv); /** * See <a href="http://www.netlib.org/lapack/explore-html/d0/d8a/dpotrf_8f.html">spec</a>. */ - // @formatter:off int dpotrf(char uplo, int n, double[] a, int lda); /** * See <a href="http://www.netlib.org/lapack/explore-html/dd/dad/dpstrf_8f.html">spec</a>. */ - // @formatter:off int dpstrf(char uplo, int n, double[] a, int lda, int[] piv, int[] rank, double tol, double[] work); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java index f6a09585339b0db416d9bf5cc6e08eea9b29000e..e9158d0fbcfc9fae960097b7d20c37a6058195ba 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java @@ -407,7 +407,7 @@ public abstract class BinaryArithmetic extends Operation { // LICENSE: transcribed code from GCC, which is licensed under GPL // libgcc2 - private BranchProfile everSeenNaN = new BranchProfile(); + private final BranchProfile everSeenNaN = new BranchProfile(); @Override public RComplex op(double leftReal, double leftImag, double rightReal, double rightImag) { @@ -696,7 +696,7 @@ public abstract class BinaryArithmetic extends Operation { private static class CHypot extends Node { - private BranchProfile everSeenInfinite = new BranchProfile(); + private final BranchProfile everSeenInfinite = new BranchProfile(); public double chypot(double real, double imag) { double res = Math.sqrt(real * real + imag * imag); @@ -717,7 +717,7 @@ public abstract class BinaryArithmetic extends Operation { private static class CPow2 extends Node { - private BranchProfile everSeenNaN = new BranchProfile(); + private final BranchProfile everSeenNaN = new BranchProfile(); public RComplex cpow2(double cre, double cim) { double cre2 = cre * cre; @@ -823,7 +823,7 @@ public abstract class BinaryArithmetic extends Operation { private static class CReciprocal extends Node { - private BranchProfile everSeenNaN = new BranchProfile(); + private final BranchProfile everSeenNaN = new BranchProfile(); public RComplex creciprocal(RComplex c) { double cre = c.getRealPart(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/na/NACheck.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/na/NACheck.java index d68f8557781953cfbc61179bd7d73319f1dc1a69..a5aac4c810084ac7c422ae2e2ab4e3afbf3e70ea 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/na/NACheck.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/na/NACheck.java @@ -25,6 +25,7 @@ package com.oracle.truffle.r.runtime.ops.na; import static com.oracle.truffle.r.runtime.RRuntime.*; import com.oracle.truffle.api.*; +import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.CompilerDirectives.SlowPath; import com.oracle.truffle.api.utilities.*; import com.oracle.truffle.r.runtime.*; @@ -37,9 +38,10 @@ public final class NACheck { private static final int CHECK_DEOPT = 1; private static final int CHECK = 2; - @CompilerDirectives.CompilationFinal int state; - private BranchProfile conversionOverflowReached = new BranchProfile(); - @CompilerDirectives.CompilationFinal boolean seenNaN; + private final BranchProfile conversionOverflowReached = new BranchProfile(); + + @CompilationFinal int state; + @CompilationFinal boolean seenNaN; public static NACheck create() { return new NACheck(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java index 50d3a470f95b647fe5b4c8ab0a0f1c80673e4aca..d754b835055a08486078eec50dc0cf9387e84f8a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java @@ -69,7 +69,7 @@ public class RRNG { static final Kind[] VALUES = values(); - final boolean available; + private final boolean available; GeneratorPrivate generator; /** diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/mt/MersenneTwister.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/mt/MersenneTwister.java index a28568eec8ba8dae1777d086dfdfcdbbbd78fde7..28878deb65b632c83a692e3adac8b2829195b83e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/mt/MersenneTwister.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/mt/MersenneTwister.java @@ -63,6 +63,7 @@ */ package com.oracle.truffle.r.runtime.rng.mt; +import com.oracle.truffle.api.CompilerDirectives.SlowPath; import com.oracle.truffle.r.runtime.rng.*; public final class MersenneTwister extends RNGInitAdapter implements RRNG.GeneratorPrivate { @@ -179,7 +180,7 @@ public final class MersenneTwister extends RNGInitAdapter implements RRNG.Genera return y; } - @com.oracle.truffle.api.CompilerDirectives.SlowPath + @SlowPath private void generateNewNumbers() { int y; int kk; diff --git a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/JLineConsoleHandler.java b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/JLineConsoleHandler.java index e148cfda65db67026edab16ee4585b79301943df..4f97460df52d6e0d9bca6bbdb8b9ea3d0f70d862 100644 --- a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/JLineConsoleHandler.java +++ b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/JLineConsoleHandler.java @@ -30,11 +30,11 @@ import com.oracle.truffle.api.CompilerDirectives.*; import com.oracle.truffle.r.runtime.*; public class JLineConsoleHandler implements RContext.ConsoleHandler { - final ConsoleReader console; - final boolean isInteractive; - final PrintWriter printWriter; + private final ConsoleReader console; + private final boolean isInteractive; + private final PrintWriter printWriter; - JLineConsoleHandler(boolean isInteractive, ConsoleReader console) { + public JLineConsoleHandler(boolean isInteractive, ConsoleReader console) { this.console = console; printWriter = new PrintWriter(console.getOutput()); this.isInteractive = isInteractive; @@ -97,5 +97,4 @@ public class JLineConsoleHandler implements RContext.ConsoleHandler { public int getWidth() { return RContext.CONSOLE_WIDTH; } - } diff --git a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java index 211055738473df2a9251b0b9638618b7d151f0c7..f0eeac6539d7191390bd332a012ecaa7a75a1744 100644 --- a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java +++ b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java @@ -30,6 +30,7 @@ import java.util.*; import com.oracle.truffle.api.frame.*; import com.oracle.truffle.r.engine.*; import com.oracle.truffle.r.runtime.*; +import com.oracle.truffle.r.runtime.RContext.Engine; import com.oracle.truffle.r.runtime.ffi.*; import jline.console.*; @@ -121,9 +122,6 @@ public class RCommand { ConsoleReader console = null; try { console = new RJLineConsoleReader(consoleInput, consoleOutput); - if (SLAVE.getValue()) { - console.setPrompt(""); - } } catch (IOException ex) { Utils.fail("unexpected error opening console reader"); } @@ -156,11 +154,10 @@ public class RCommand { String content = new String(bytes); JLineConsoleHandler consoleHandler = new JLineConsoleHandler(false, new ConsoleReader(null, System.out)); VirtualFrame frame = REngine.initialize(commandArgs, consoleHandler, true, true); - REngine.getInstance().parseAndEval(content, frame, REnvironment.globalEnv(), false); + REngine.getInstance().parseAndEval(content, frame, REnvironment.globalEnv(), false, false); } catch (IOException ex) { Utils.fail("unexpected error reading file input"); } - } private static void readEvalPrint(boolean isInteractive, ConsoleReader console, String[] commandArgs) { @@ -172,23 +169,30 @@ public class RCommand { VirtualFrame globalFrame = REngine.initialize(commandArgs, new JLineConsoleHandler(isInteractive, console), true, false); // console.println("initialize time: " + (System.currentTimeMillis() - start)); for (;;) { - String line = console.readLine(); - if (line == null) { - break; + console.setPrompt(SLAVE.getValue() ? "" : "> "); + String input = console.readLine(); + if (input == null) { + return; } - line = line.trim(); - if (line.equals("") || line.charAt(0) == '#') { + input = input.trim(); + if (input.equals("") || input.charAt(0) == '#') { continue; } - REngine.getInstance().parseAndEval(line, globalFrame, REnvironment.globalEnv(), true); + while (REngine.getInstance().parseAndEval(input, globalFrame, REnvironment.globalEnv(), true, true) == Engine.INCOMPLETE_SOURCE) { + console.setPrompt(SLAVE.getValue() ? "" : "+ "); + String additionalInput = console.readLine(); + if (additionalInput == null) { + return; + } + input = input + "\n" + additionalInput; + } } } catch (UserInterruptException e) { // interrupted } catch (IOException ex) { Utils.fail("unexpected error reading console input"); } - } } diff --git a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RJLineConsoleReader.java b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RJLineConsoleReader.java index bf66c2fa83571c807c0bb6d816ae1f6f63670514..28695b90e9a09d1e138d826bf3a7be6d53990720 100644 --- a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RJLineConsoleReader.java +++ b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RJLineConsoleReader.java @@ -34,6 +34,5 @@ public class RJLineConsoleReader extends ConsoleReader { super(in, out); setHandleUserInterrupt(true); setExpandEvents(false); - setPrompt("> "); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 2d96f71014afa07721e961edd011e44c2d6cf179..8d0017b14f5a2089ff4bd44b9e3a68ee11556313 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -7105,6 +7105,14 @@ NULL #{ c(1,2,3,4,5) %in% c(1,2,1,2) } [1] TRUE TRUE FALSE FALSE FALSE +##com.oracle.truffle.r.test.simple.TestSimpleBuiltins.testInherits +#{ inherits(NULL, "try-error") } +[1] FALSE + +##com.oracle.truffle.r.test.simple.TestSimpleBuiltins.testInherits +#{ inherits(new.env(), "try-error") } +[1] FALSE + ##com.oracle.truffle.r.test.simple.TestSimpleBuiltins.testInherits #{x <- 10; inherits(x, "a") ;} [1] FALSE diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/all/AllTests.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/all/AllTests.java index 9918a25a2684d19f86b578eaf51deb68c46f224b..b72571807c6d42871bad3ee5176a434ed5dc974f 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/all/AllTests.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/all/AllTests.java @@ -7923,6 +7923,16 @@ public class AllTests extends TestBase { assertEval("{x <- 10;class(x) <- c(\"a\", \"b\");inherits(x, \"a\", c(TRUE)) ;}"); } + @Test + public void TestSimpleBuiltins_testInherits_836249d31734a1237010e42b01dd40d1() { + assertEval("{ inherits(NULL, \"try-error\") }"); + } + + @Test + public void TestSimpleBuiltins_testInherits_c3babb7ceea8dc93b0085895b3a09d12() { + assertEval("{ inherits(new.env(), \"try-error\") }"); + } + @Test public void TestSimpleBuiltins_testInheritsIgnore_d0dc6389c924878311546ba61d753a22() { assertEval("{x <- 10;class(x) <- c(\"a\", \"b\");inherits(x, 2, c(TRUE)) ;}"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/simple/TestSimpleBuiltins.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/simple/TestSimpleBuiltins.java index d299887dafad27e31ddde2c22affd6385542a979..29f0155e94ed826b6f75d6958471661b891fa103 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/simple/TestSimpleBuiltins.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/simple/TestSimpleBuiltins.java @@ -2833,6 +2833,8 @@ public class TestSimpleBuiltins extends TestBase { assertEval("{x <- 10;class(x) <- c(\"a\", \"b\");inherits(x, c(\"c\", \"q\", \"b\"), TRUE) ;}"); assertEval("{x <- 10;class(x) <- c(\"a\", \"b\");inherits(x, c(\"c\", \"q\", \"b\")) ;}"); assertEval("{x <- 10;class(x) <- c(\"a\", \"b\");inherits(x, \"a\", c(TRUE)) ;}"); + assertEval("{ inherits(NULL, \"try-error\") }"); + assertEval("{ inherits(new.env(), \"try-error\") }"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeRBuiltin.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeRBuiltin.java index 0265f4eb582c7672b51a79657dc604de61549cd8..12333d6f69fe62e899099b4c6a7d1346895f2adf 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeRBuiltin.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeRBuiltin.java @@ -76,7 +76,7 @@ public class AnalyzeRBuiltin { } - enum Visibility { + private enum Visibility { ON("Force ON"), OFF("Force OFF"), ON_UPDATE("Force ON, implementation may UPDATE"); @@ -88,7 +88,7 @@ public class AnalyzeRBuiltin { } } - enum Kind { + private enum Kind { Primitive, Internal } diff --git a/mx.fastr/projects b/mx.fastr/projects index a5a0472e4744e9d29fe130883b9ee499b0982b0f..eca237fc57ff52c5e37b3e94e12912a91ac68265 100644 --- a/mx.fastr/projects +++ b/mx.fastr/projects @@ -4,9 +4,9 @@ mxversion=2.5.2 library@JDK_TOOLS@path=${JAVA_HOME}/lib/tools.jar library@JDK_TOOLS@sha1=NOCHECK -library@CHECKSTYLE@path=lib/checkstyle-5.5-all.jar -library@CHECKSTYLE@urls=jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/5.5/checkstyle-5.5-bin.zip/download!/checkstyle-5.5/checkstyle-5.5-all.jar -library@CHECKSTYLE@sha1=6f4bb2b3dafb9426a67fa9c47f96ffed3b44749a +#library@CHECKSTYLE@path=lib/checkstyle-5.5-all.jar +#library@CHECKSTYLE@urls=jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/5.5/checkstyle-5.5-bin.zip/download!/checkstyle-5.5/checkstyle-5.5-all.jar +#library@CHECKSTYLE@sha1=6f4bb2b3dafb9426a67fa9c47f96ffed3b44749a library@ANTLR@path=lib/antlr-runtime-3.5.jar library@ANTLR@urls=http://central.maven.org/maven2/org/antlr/antlr-runtime/3.5/antlr-runtime-3.5.jar @@ -163,8 +163,7 @@ project@com.oracle.truffle.r.runtime@workingSets=Truffle,FastR # com.oracle.truffle.r.runtime.ffi project@com.oracle.truffle.r.runtime.ffi@sourceDirs=src -#project@com.oracle.truffle.r.runtime.ffi@dependencies=com.oracle.truffle.r.runtime,com.oracle.nfi,ASM_ANALYSIS,JNR_POSIX,ASM_UTIL,JFFI,JNR_FFI,NETLIB,JNR_CONSTANTS,JFFI_NATIVE,JNR_INVOKE,JNR_UDIS86,ASM,ASM_TREE,ASM_COMMONS,JNR_X86ASM -project@com.oracle.truffle.r.runtime.ffi@dependencies=com.oracle.truffle.r.runtime,ASM_ANALYSIS,JNR_POSIX,ASM_UTIL,JFFI,JNR_FFI,NETLIB,JNR_CONSTANTS,JFFI_NATIVE,JNR_INVOKE,JNR_UDIS86,ASM,ASM_TREE,ASM_COMMONS,JNR_X86ASM +project@com.oracle.truffle.r.runtime.ffi@dependencies=com.oracle.truffle.r.runtime,com.oracle.nfi,com.oracle.graal.compiler.common,ASM_ANALYSIS,JNR_POSIX,ASM_UTIL,JFFI,JNR_FFI,NETLIB,JNR_CONSTANTS,JFFI_NATIVE,JNR_INVOKE,JNR_UDIS86,ASM,ASM_TREE,ASM_COMMONS,JNR_X86ASM project@com.oracle.truffle.r.runtime.ffi@checkstyle=com.oracle.truffle.r.runtime project@com.oracle.truffle.r.runtime.ffi@javaCompliance=1.8 project@com.oracle.truffle.r.runtime.ffi@workingSets=Truffle,FastR