diff --git a/com.oracle.truffle.r.native/fficall/src/include/Defn.h b/com.oracle.truffle.r.native/fficall/src/include/Defn.h index d431e33c736142a2c2e51e16815c95a9593e528f..2b4d813d23ac84d29dd8e6990d3c4f440ddc9e07 100644 --- a/com.oracle.truffle.r.native/fficall/src/include/Defn.h +++ b/com.oracle.truffle.r.native/fficall/src/include/Defn.h @@ -61,7 +61,7 @@ extern Rboolean mbcslocale; extern Rboolean latin1locale; #define INI_as(v) -extern char OutDec INI_as('.'); +extern char* OutDec INI_as("."); extern Rboolean known_to_be_latin1 INI_as(FALSE); extern Rboolean known_to_be_utf8 INI_as(FALSE); diff --git a/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c b/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c index 4a7fdffdd3cd064131e9ed347aecae97bd9c66df..af705d11e94160a54ca31a0d02fece4069410853 100644 --- a/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c +++ b/com.oracle.truffle.r.native/fficall/src/jni/Rinternals.c @@ -54,6 +54,7 @@ static jmethodID Rf_warningcallMethodID; static jmethodID Rf_warningMethodID; static jmethodID Rf_errorMethodID; static jmethodID Rf_NewHashedEnvMethodID; +static jmethodID Rf_classgetsMethodID; static jmethodID Rf_rPsortMethodID; static jmethodID Rf_iPsortMethodID; static jmethodID RprintfMethodID; @@ -154,6 +155,7 @@ void init_internals(JNIEnv *env) { Rf_duplicateMethodID = checkGetMethodID(env, CallRFFIHelperClass, "Rf_duplicate", "(Ljava/lang/Object;I)Ljava/lang/Object;", 1); Rf_anyDuplicatedMethodID = checkGetMethodID(env, CallRFFIHelperClass, "Rf_anyDuplicated", "(Ljava/lang/Object;I)I", 1); Rf_NewHashedEnvMethodID = checkGetMethodID(env, CallRFFIHelperClass, "Rf_createNewEnv", "(Lcom/oracle/truffle/r/runtime/env/REnvironment;Ljava/lang/String;ZI)Lcom/oracle/truffle/r/runtime/env/REnvironment;", 1); + Rf_classgetsMethodID = checkGetMethodID(env, CallRFFIHelperClass, "Rf_classgets", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", 1); RprintfMethodID = checkGetMethodID(env, CallRFFIHelperClass, "printf", "(Ljava/lang/String;)V", 1); R_do_MAKE_CLASS_MethodID = checkGetMethodID(env, CallRFFIHelperClass, "R_do_MAKE_CLASS", "(Ljava/lang/String;)Ljava/lang/Object;", 1); R_FindNamespaceMethodID = checkGetMethodID(env, CallRFFIHelperClass, "R_FindNamespace", "(Ljava/lang/Object;)Ljava/lang/Object;", 1); @@ -675,9 +677,10 @@ SEXP R_NewHashedEnv(SEXP parent, SEXP size) { return checkRef(thisenv, result); } -SEXP Rf_classgets(SEXP x, SEXP y) { - unimplemented("Rf_classgets"); - return NULL; +SEXP Rf_classgets(SEXP vec, SEXP klass) { + JNIEnv *thisenv = getEnv(); + SEXP result = (*thisenv)->CallStaticObjectMethod(thisenv, RDataFactoryClass, Rf_classgetsMethodID, vec, klass); + return checkRef(thisenv, result); } const char *Rf_translateChar(SEXP x) { diff --git a/com.oracle.truffle.r.native/fficall/src/jni/rffiutils.c b/com.oracle.truffle.r.native/fficall/src/jni/rffiutils.c index c083d5a7811e31bc3d106fb65b55defeb8c4a6c8..381fd1bbd330935ecbb9c4beace5183490c43502 100644 --- a/com.oracle.truffle.r.native/fficall/src/jni/rffiutils.c +++ b/com.oracle.truffle.r.native/fficall/src/jni/rffiutils.c @@ -384,7 +384,7 @@ SEXP addGlobalRef(JNIEnv *env, SEXP obj, int permanent) { SEXP checkRef(JNIEnv *env, SEXP obj) { SEXP gref = findCachedGlobalRef(env, obj); - TRACE(TARGpp, obj, global); + TRACE(TARGpp, obj, gref); if (gref == NULL) { return obj; } else { diff --git a/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h b/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h index 9ab6cb36a2dd04d30fd90242b6955138ab369ccf..01f2643b7dd05d124e0cfd40815233163a5ee0d1 100644 --- a/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h +++ b/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h @@ -89,7 +89,7 @@ Rboolean R_interrupts_suspended; int R_interrupts_pending; Rboolean mbcslocale; Rboolean useaqua; -char OutDec = '.'; +char* OutDec = "."; Rboolean utf8locale = FALSE; Rboolean mbcslocale = FALSE; Rboolean latin1locale = FALSE; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeFunctions.java index 82458154281a76cb2b7d6b71a4e48a5471be5e55..6628d127dc2cf233ff558a54283552d84eee6909 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/IsTypeFunctions.java @@ -28,9 +28,11 @@ import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Fallback; import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.builtin.CastBuilder; @@ -42,6 +44,7 @@ import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RAttributable; import com.oracle.truffle.r.runtime.data.RAttributeProfiles; +import com.oracle.truffle.r.runtime.data.RAttributes; import com.oracle.truffle.r.runtime.data.RComplex; import com.oracle.truffle.r.runtime.data.RDouble; import com.oracle.truffle.r.runtime.data.RExpression; @@ -472,48 +475,49 @@ public class IsTypeFunctions { @RBuiltin(name = "is.vector", kind = INTERNAL, parameterNames = {"x", "mode"}, behavior = PURE) public abstract static class IsVector extends RBuiltinNode { - private final RAttributeProfiles attrProfiles = RAttributeProfiles.create(); + private final ConditionProfile attrNull = ConditionProfile.createBinaryProfile(); + private final ConditionProfile attrEmpty = ConditionProfile.createBinaryProfile(); + private final ConditionProfile attrNames = ConditionProfile.createBinaryProfile(); @Override protected void createCasts(CastBuilder casts) { casts.arg("x").conf(c -> c.allowNull().mustNotBeMissing(null, RError.Message.ARGUMENT_MISSING, "x")); - casts.arg("mode").defaultError(this, RError.Message.INVALID_ARGUMENT, "mode").mustBe(stringValue()).asStringVector().mustBe(size(1)); + casts.arg("mode").defaultError(this, RError.Message.INVALID_ARGUMENT, "mode").mustBe(stringValue()).asStringVector().mustBe(size(1)).findFirst(); } - @Override - public Object[] getDefaultParameterValues() { - // INTERNAL does not need default parameters - return RNode.EMPTY_OBJECT_ARRAY; + @TruffleBoundary + protected static RType typeFromMode(String mode) { + return RType.fromMode(mode); } - @Specialization - protected byte isVector(RAbstractVector x, String mode) { - if (!namesOnlyOrNoAttr(x) || !modeIsAnyOrMatches(x, mode)) { - return RRuntime.LOGICAL_FALSE; - } else { + @Specialization(limit = "5", guards = "cachedMode == mode") + protected byte isVectorCached(RAbstractVector x, String mode, + @Cached("mode") String cachedMode, + @Cached("typeFromMode(mode)") RType type) { + if (namesOnlyOrNoAttr(x) && (type == RType.Any || x.getRType() == type)) { return RRuntime.LOGICAL_TRUE; + } else { + return RRuntime.LOGICAL_FALSE; } } + @Specialization(contains = "isVectorCached") + protected byte isVector(RAbstractVector x, String mode) { + return isVectorCached(x, mode, mode, typeFromMode(mode)); + } + @Fallback protected byte isVector(Object x, Object mode) { return RRuntime.LOGICAL_FALSE; } private boolean namesOnlyOrNoAttr(RAbstractVector x) { - // there should be no attributes other than names - if (x.getNames(attrProfiles) == null) { - assert x.getAttributes() == null || x.getAttributes().size() > 0; - return x.getAttributes() == null ? true : false; + RAttributes attributes = x.getAttributes(); + if (attrNull.profile(attributes == null) || attrEmpty.profile(attributes.size() == 0)) { + return true; } else { - assert x.getAttributes() != null; - return x.getAttributes().size() == 1 ? true : false; + return attributes.size() == 1 && attrNames.profile(attributes.getNameAtIndex(0) == RRuntime.NAMES_ATTR_KEY); } } - - private static boolean modeIsAnyOrMatches(RAbstractVector x, String mode) { - return RType.Any.getName().equals(mode) || (x instanceof RList && mode.equals("list")) || (x.getElementClass() == RDouble.class && RType.Double.getName().equals(mode)) || - RRuntime.classToString(x.getElementClass()).equals(mode); - } } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quantifier.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quantifier.java index 4d482f36010504900fd34ed5d067042dc7e55cef..54ea1667f9c2ad16c2241a538238538824630191 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quantifier.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Quantifier.java @@ -22,8 +22,10 @@ */ package com.oracle.truffle.r.nodes.builtin.base; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.*; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.instanceOf; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.logicalValue; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.size; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.toBoolean; import java.util.function.Function; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample2.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample2.java index 36acfb3a7d69ad400b47ab33447114bb3fe0a40c..54c5da31bc222161b8039a957a99fef263eadaa9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample2.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Sample2.java @@ -113,7 +113,7 @@ public abstract class Sample2 extends RBuiltinNode { } } - private double ru() { + private static double ru() { return (Math.floor(U * RRNG.unifRand()) + RRNG.unifRand()) / U; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java index 47862084142edcf3fdf6232a1b40f7d2a55843b1..c513f62c7b117f7c8cc1fd1e894429acfaba5750 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/SpecialsUtils.java @@ -97,7 +97,7 @@ class SpecialsUtils { return cachedField == null || (cachedField == field && list.getNames() == cachedNames); } - protected final int getIndex(RAbstractStringVector names, String field) { + protected static int getIndex(RAbstractStringVector names, String field) { for (int i = 0; i < names.getLength(); i++) { String current = names.getDataAt(i); if (current == field || current.equals(field)) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java index 177b16a70499c1366fcb1fef5c3640acbb72a669..67f7371186c1adb6b6d202909e62e288c234aa72 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java @@ -501,7 +501,7 @@ public class ArgumentMatcher { int varArgIndex = formalSignature.getVarArgIndex(); boolean hasVarArgs = varArgIndex != ArgumentsSignature.NO_VARARG; - // MATCH by exact name + // MATCH by exact and partial name int[] resultPermutation = new int[formalSignature.getLength()]; String[] resultSignature = new String[formalSignature.getLength()]; Arrays.fill(resultPermutation, MatchPermutation.UNMATCHED); @@ -509,21 +509,20 @@ public class ArgumentMatcher { boolean[] matchedSuppliedArgs = new boolean[signature.getLength()]; for (int suppliedIndex = 0; suppliedIndex < signature.getLength(); suppliedIndex++) { - if (signature.getName(suppliedIndex) == null || signature.getName(suppliedIndex).isEmpty()) { + String suppliedName = signature.getName(suppliedIndex); + if (suppliedName == null || suppliedName.isEmpty()) { continue; } // Search for argument name inside formal arguments - int formalIndex = findParameterPosition(formalSignature, signature.getName(suppliedIndex), resultPermutation, suppliedIndex, hasVarArgs, callingNode, varArgIndex, errorString, builtin); + int formalIndex = findParameterPosition(formalSignature, suppliedName, resultPermutation, suppliedIndex, hasVarArgs, callingNode, varArgIndex, errorString, builtin); if (formalIndex != MatchPermutation.UNMATCHED) { resultPermutation[formalIndex] = suppliedIndex; - resultSignature[formalIndex] = signature.getName(suppliedIndex); + resultSignature[formalIndex] = suppliedName; matchedSuppliedArgs[suppliedIndex] = true; } } - // TODO MATCH by partial name (up to the vararg, which consumes all non-exact matches) - // MATCH by position int suppliedIndex = -1; int regularArgumentCount = hasVarArgs ? varArgIndex : formalSignature.getLength(); @@ -631,37 +630,41 @@ public class ArgumentMatcher { */ private static <T> int findParameterPosition(ArgumentsSignature formalsSignature, String suppliedName, int[] resultPermutation, int suppliedIndex, boolean hasVarArgs, RBaseNode callingNode, int varArgIndex, IntFunction<String> errorString, RBuiltinDescriptor builtin) { - int found = MatchPermutation.UNMATCHED; + assert suppliedName != null && !suppliedName.isEmpty(); for (int i = 0; i < formalsSignature.getLength(); i++) { String formalName = formalsSignature.getName(i); - if (formalName == null) { - continue; + if (formalName != null) { + if (formalName.equals(suppliedName)) { + if (resultPermutation[i] != MatchPermutation.UNMATCHED) { + if (builtin != null && builtin.getKind() == RBuiltinKind.PRIMITIVE && hasVarArgs) { + // for primitives, the first argument is matched, and the others are + // folded + // into varargs, for example: + // x<-1:64; dim(x)<-c(4,4,2,2); x[1,drop=FALSE,1,drop=TRUE,-1] + return MatchPermutation.UNMATCHED; + } else { + // Has already been matched: Error! + throw RError.error(callingNode, RError.Message.FORMAL_MATCHED_MULTIPLE, formalName); + } + } + return i; + } } - - if (formalName.equals(suppliedName)) { - found = i; - if (resultPermutation[found] != MatchPermutation.UNMATCHED) { - if (builtin != null && builtin.getKind() == RBuiltinKind.PRIMITIVE && hasVarArgs) { - // for primitives, the first argument is matched, and the others are folded - // into varargs, for example: - // x<-1:64; dim(x)<-c(4,4,2,2); x[1,drop=FALSE,1,drop=TRUE,-1] - found = MatchPermutation.UNMATCHED; - } else { - // Has already been matched: Error! + } + int found = MatchPermutation.UNMATCHED; + for (int i = 0; i < formalsSignature.getLength(); i++) { + String formalName = formalsSignature.getName(i); + if (formalName != null) { + if (formalName.startsWith(suppliedName) && ((varArgIndex != ArgumentsSignature.NO_VARARG && i < varArgIndex) || varArgIndex == ArgumentsSignature.NO_VARARG)) { + // partial-match only if the formal argument is positioned before ... + if (found >= 0) { + throw RError.error(callingNode, RError.Message.ARGUMENT_MATCHES_MULTIPLE, 1 + suppliedIndex); + } + found = i; + if (resultPermutation[found] != MatchPermutation.UNMATCHED) { throw RError.error(callingNode, RError.Message.FORMAL_MATCHED_MULTIPLE, formalName); } } - break; - } else if (!suppliedName.isEmpty() && formalName.startsWith(suppliedName) && - ((varArgIndex != ArgumentsSignature.NO_VARARG && i < varArgIndex) || varArgIndex == ArgumentsSignature.NO_VARARG)) { - // partial-match only if the formal argument is positioned before ... - if (found >= 0) { - throw RError.error(callingNode, RError.Message.ARGUMENT_MATCHES_MULTIPLE, 1 + suppliedIndex); - } - found = i; - if (resultPermutation[found] != MatchPermutation.UNMATCHED) { - throw RError.error(callingNode, RError.Message.FORMAL_MATCHED_MULTIPLE, formalName); - } } } if (found >= 0 || hasVarArgs) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/VarArgsHelper.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/VarArgsHelper.java index b0b110efecb3470bd4b48d404f831aa15b605cfd..cd3d69081b061d4175b3841ab7a1282911a4025c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/VarArgsHelper.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/VarArgsHelper.java @@ -115,9 +115,9 @@ public final class VarArgsHelper { if (varArgs[valuesIdx] != null) { assert values[valuesIdx] instanceof RArgsValuesAndNames; assert ((RArgsValuesAndNames) values[valuesIdx]).getSignature() == varArgs[valuesIdx]; - RArgsValuesAndNames varArgs = (RArgsValuesAndNames) values[valuesIdx]; - for (int i = 0; i < varArgs.getLength(); i++) { - result[resultIdx++] = varArgs.getArgument(i); + RArgsValuesAndNames varArgsValues = (RArgsValuesAndNames) values[valuesIdx]; + for (int i = 0; i < varArgsValues.getLength(); i++) { + result[resultIdx++] = varArgsValues.getArgument(i); } } else if (!signature.isUnmatched(valuesIdx)) { result[resultIdx++] = values[valuesIdx]; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/NonNANode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/NonNANode.java index cfeed6b5eae610a7cc77fdad07ae01d6b2bccd6e..5fec2dfc86a5f1000c52245ae71df02a0dc0492f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/NonNANode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/NonNANode.java @@ -22,7 +22,6 @@ */ package com.oracle.truffle.r.nodes.unary; -import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.r.runtime.RError; diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/CallRFFIHelper.java b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/CallRFFIHelper.java index 62dceba674c6d9765c1c085b05acb6b7e01bda16..17b709e42409978a85f50726d3b066533256a8bf 100644 --- a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/CallRFFIHelper.java +++ b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/jni/CallRFFIHelper.java @@ -1377,4 +1377,10 @@ public class CallRFFIHelper { return x == y ? 1 : 0; } + public static Object Rf_classgets(Object x, Object y) { + RAbstractVector vector = guaranteeInstanceOf(x, RAbstractVector.class); + vector.setClassAttr(guaranteeInstanceOf(y, RStringVector.class)); + return RNull.instance; + } + } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DefaultResourceHandlerFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DefaultResourceHandlerFactory.java index 0f90524e98b782cbc2fed6760582fa4c96e4a0e7..bc3a8db00d9cee4b415f25ff0769c7108e9cb373 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DefaultResourceHandlerFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/DefaultResourceHandlerFactory.java @@ -26,7 +26,6 @@ import java.io.BufferedReader; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.URI; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java index 9da38a9af9e03e131dadae2b0f7bc36b94c89fea..fe0a57bac502c4d7f5fb31cd1a4cfe03f82e17c7 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java @@ -143,6 +143,7 @@ public enum RType { return Builtin; case "special": return Special; + case "name": case "symbol": return Symbol; case "environment": 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 872652954e2863f1c016e2ffffbaf8ebebd4cfa8..ed8ecb1284b0485bb393ee49f0eafadf98306817 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 @@ -57411,6 +57411,10 @@ Error in f(h = 1) : argument 1 matches multiple formal arguments #{ f <- function(hello, hi) { hello + hi } ; f(hello = 1, bye = 3) } Error in f(hello = 1, bye = 3) : unused argument (bye = 3) +##com.oracle.truffle.r.test.functions.TestFunctions.testMatching# +#{ f <- function(xy, x) xy + x; f(xy=1,x=2) } +[1] 3 + ##com.oracle.truffle.r.test.functions.TestFunctions.testMatching# #{ f<-function(..., val=1) { c(list(...), val) }; f(v=7, 2) } $v diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_structure.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_structure.java index 364a6b46ae28fd2e15dadd30ce7c441e6a0c28b9..645dd290d3dfbf241863a78d35b62b2331e6468d 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_structure.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_structure.java @@ -20,8 +20,7 @@ public class TestBuiltin_structure extends TestBase { @Test public void teststructure1() { - assertEval( - "argv <- structure(list(.Data = structure(c(1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1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L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L), .Label = c('13', '14', '15', '16', '17'), class = 'factor'), .Label = c('13', '14', '15', '16', '17'), class = 'factor'), .Names = c('.Data', '.Label', 'class'));" + - "do.call('structure', argv)"); + assertEval("argv <- structure(list(.Data = structure(c(1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 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1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L), .Label = c('13', '14', '15', '16', '17'), class = 'factor'), .Label = c('13', '14', '15', '16', '17'), class = 'factor'), .Names = c('.Data', '.Label', 'class'));" + + "do.call('structure', argv)"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tdefault.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tdefault.java index 6d1687f6aa98c20989125c44c677ebbdf332e29e..58b7bf9977d3a3335d234442028cb08902a32198 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tdefault.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tdefault.java @@ -125,8 +125,7 @@ public class TestBuiltin_tdefault extends TestBase { @Test public void testtdefault22() { - assertEval( - "argv <- list(structure(c(8.3, 8.6, 8.8, 10.5, 10.7, 10.8, 11, 11, 11.1, 11.2, 11.3, 11.4, 11.4, 11.7, 12, 12.9, 12.9, 13.3, 13.7, 13.8, 14, 14.2, 14.5, 16, 16.3, 17.3, 17.5, 17.9, 18, 18, 20.6, 70, 65, 63, 72, 81, 83, 66, 75, 80, 75, 79, 76, 76, 69, 75, 74, 85, 86, 71, 64, 78, 80, 74, 72, 77, 81, 82, 80, 80, 80, 87, 10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), .Dim = c(31L, 3L), .Dimnames = list(NULL, c('Girth', 'Height', 'Volume')))); .Internal(t.default(argv[[1]]))"); + assertEval("argv <- list(structure(c(8.3, 8.6, 8.8, 10.5, 10.7, 10.8, 11, 11, 11.1, 11.2, 11.3, 11.4, 11.4, 11.7, 12, 12.9, 12.9, 13.3, 13.7, 13.8, 14, 14.2, 14.5, 16, 16.3, 17.3, 17.5, 17.9, 18, 18, 20.6, 70, 65, 63, 72, 81, 83, 66, 75, 80, 75, 79, 76, 76, 69, 75, 74, 85, 86, 71, 64, 78, 80, 74, 72, 77, 81, 82, 80, 80, 80, 87, 10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), .Dim = c(31L, 3L), .Dimnames = list(NULL, c('Girth', 'Height', 'Volume')))); .Internal(t.default(argv[[1]]))"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_unlist.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_unlist.java index 853d5074055bfc51991e6ef5c3263b5b823511cc..442097e3a4fee220d36f8700788fdec4b6a1013e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_unlist.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_unlist.java @@ -106,14 +106,12 @@ public class TestBuiltin_unlist extends TestBase { @Test public void testunlist18() { - assertEval( - "argv <- list(list(c(NA_real_, NA_real_), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi')), TRUE, TRUE); .Internal(unlist(argv[[1]], argv[[2]], argv[[3]]))"); + assertEval("argv <- list(list(c(NA_real_, NA_real_), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi'), c('Svansota', 'No. 462', 'Manchuria', 'No. 475', 'Velvet', 'Peatland', 'Glabron', 'No. 457', 'Wisconsin No. 38', 'Trebi')), TRUE, TRUE); .Internal(unlist(argv[[1]], argv[[2]], argv[[3]]))"); } @Test public void testunlist19() { - assertEval( - "argv <- list(list(structure(list('/home/lzhao/tmp/RtmpTzriDZ/R.INSTALL30d4108a07be/mgcv/R/gamm.r'), row.names = c(NA, -1L), class = 'data.frame'), structure(list(1522L), row.names = c(NA, -1L), class = 'data.frame'), structure(list(1522L), row.names = c(NA, -1L), class = 'data.frame')), FALSE, FALSE); .Internal(unlist(argv[[1]], argv[[2]], argv[[3]]))"); + assertEval("argv <- list(list(structure(list('/home/lzhao/tmp/RtmpTzriDZ/R.INSTALL30d4108a07be/mgcv/R/gamm.r'), row.names = c(NA, -1L), class = 'data.frame'), structure(list(1522L), row.names = c(NA, -1L), class = 'data.frame'), structure(list(1522L), row.names = c(NA, -1L), class = 'data.frame')), FALSE, FALSE); .Internal(unlist(argv[[1]], argv[[2]], argv[[3]]))"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestFunctions.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestFunctions.java index bce570f903c34c7adf70c8a76b6332518dddbad4..78259d758de8733c7c38a1d39a2de73cf1c607ce 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestFunctions.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/functions/TestFunctions.java @@ -230,6 +230,8 @@ public class TestFunctions extends TestBase { assertEval("{ f <- function(hello, hi) { hello + hi } ; f(hello = 1, bye = 3) }"); assertEval("{ f <- function(a) { a } ; f(1,2) }"); + assertEval("{ f <- function(xy, x) xy + x; f(xy=1,x=2) }"); + // with ... partial-match only if formal parameter are before ... assertEval("{ f<-function(..., val=1) { c(list(...), val) }; f(v=7, 2) }"); assertEval("{ f<-function(er=1, ..., val=1) { c(list(...), val, er) }; f(v=7, 2, e=8) }"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeExpectedTestOutput.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeExpectedTestOutput.java index 40d357268c2a78387e2037c6e99425bf9514de3d..17bf41a39d88abe4b81e6fb575d48835067fd791 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeExpectedTestOutput.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tools/AnalyzeExpectedTestOutput.java @@ -27,8 +27,6 @@ import java.util.ArrayList; import java.util.Map; import java.util.SortedMap; -import com.oracle.truffle.r.test.ArithmeticWhiteList; -import com.oracle.truffle.r.test.TestBase; import com.oracle.truffle.r.test.TestBase.Output; import com.oracle.truffle.r.test.TestTrait; import com.oracle.truffle.r.test.WhiteList;