diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java index 385068b962e9778e2a57a8c6c5b3b901ec02782b..60b6a089028cf268afd4a74c3634019979dfcc84 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java @@ -186,7 +186,7 @@ class RRuntimeASTAccessImpl implements RRuntimeASTAccess { } else { result = call.getSyntaxArguments()[index - 1]; if (result == null) { - result = RSyntaxLookup.createDummyLookup(null, "", false); + result = RSyntaxLookup.createDummyLookup(RSyntaxNode.LAZY_DEPARSE, "", false); } } } else if (s instanceof RSyntaxFunction) { @@ -501,16 +501,6 @@ class RRuntimeASTAccessImpl implements RRuntimeASTAccess { return RNull.instance; } - @Override - public RSyntaxNode[] isReplacementNode(Node node) { - if (node instanceof ReplacementDispatchNode) { - ReplacementDispatchNode rn = (ReplacementDispatchNode) node; - return new RSyntaxNode[]{rn.getLhs(), rn.getRhs()}; - } else { - return null; - } - } - @Override public boolean isFunctionDefinitionNode(Node node) { return node instanceof FunctionDefinitionNode; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AllNames.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AllNames.java index 905fb5e0d0e90b19380f9fc56fe0ee2f68a8d9fc..053928da25d4bfc8bdf9cd7855288bc9f79efe1e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AllNames.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AllNames.java @@ -46,6 +46,7 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxConstant; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxFunction; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; +import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; import com.oracle.truffle.r.runtime.nodes.RSyntaxVisitor; @RBuiltin(name = "all.names", kind = INTERNAL, parameterNames = {"expr", "functions", "max.names", "unique"}, behavior = PURE) @@ -133,7 +134,7 @@ public abstract class AllNames extends RBuiltinNode { @Override protected Void visit(RSyntaxFunction element) { - accept(RSyntaxLookup.createDummyLookup(null, "function", true)); + accept(RSyntaxLookup.createDummyLookup(RSyntaxNode.INTERNAL, "function", true)); accept(element.getSyntaxBody()); // functions do not recurse into the arguments return null; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Args.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Args.java index 43bdf6a77b0b6ed3a414c37364e406ee7fca132e..3e2232794d820121f706f64d602e1573d07f115a 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Args.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Args.java @@ -83,8 +83,8 @@ public abstract class Args extends RBuiltinNode { RRootNode rootNode = (RRootNode) fun.getTarget().getRootNode(); FormalArguments formals = rootNode.getFormalArguments(); String newDesc = "args(" + rootNode.getDescription() + ")"; - FunctionDefinitionNode newNode = FunctionDefinitionNode.create(RSyntaxNode.EAGER_DEPARSE, rootNode.getFrameDescriptor(), null, SaveArgumentsNode.NO_ARGS, - ConstantNode.create(RSyntaxNode.EAGER_DEPARSE, RNull.instance), formals, newDesc, null); + FunctionDefinitionNode newNode = FunctionDefinitionNode.create(RSyntaxNode.LAZY_DEPARSE, rootNode.getFrameDescriptor(), null, SaveArgumentsNode.NO_ARGS, + ConstantNode.create(RSyntaxNode.LAZY_DEPARSE, RNull.instance), formals, newDesc, null); RDeparse.ensureSourceSection(newNode); return RDataFactory.createFunction(newDesc, Truffle.getRuntime().createCallTarget(newNode), null, REnvironment.globalEnv().getFrame()); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java index 721a2337534b85ac57bb4c89cdf22c1e64591786..4c326d7e1158209e3a6a9129e329a6e0ec26d5f7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/AsFunction.java @@ -147,7 +147,7 @@ public abstract class AsFunction extends RBuiltinNode { FrameDescriptor descriptor = new FrameDescriptor(); FrameSlotChangeMonitor.initializeFunctionFrameDescriptor("<as.function.default>", descriptor); FrameSlotChangeMonitor.initializeEnclosingFrame(descriptor, envir.getFrame()); - FunctionDefinitionNode rootNode = FunctionDefinitionNode.create(RSyntaxNode.EAGER_DEPARSE, descriptor, null, saveArguments, (RSyntaxNode) body, formals, "from AsFunction", null); + FunctionDefinitionNode rootNode = FunctionDefinitionNode.create(RSyntaxNode.LAZY_DEPARSE, descriptor, null, saveArguments, (RSyntaxNode) body, formals, "from AsFunction", null); RDeparse.ensureSourceSection(rootNode); RootCallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode); return RDataFactory.createFunction(RFunction.NO_NAME, callTarget, null, envir.getFrame()); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Call.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Call.java index 5dd891aee4366a26d6628a3cd0f1dd076da3554b..b219b18a59b1eae4700ad3e57955c31ca3ae14ab 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Call.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Call.java @@ -36,7 +36,6 @@ import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode; import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; -import com.oracle.truffle.r.runtime.RDeparse; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.builtins.RBuiltin; @@ -77,7 +76,7 @@ public abstract class Call extends RBuiltinNode { @TruffleBoundary private static RLanguage makeCall(String name, RArgsValuesAndNames args) { - return "function".equals(name) ? makeFunction(args) : makeCall0(ReadVariableNode.createFunctionLookup(RSyntaxNode.EAGER_DEPARSE, name), false, args); + return "function".equals(name) ? makeFunction(args) : makeCall0(ReadVariableNode.createFunctionLookup(RSyntaxNode.LAZY_DEPARSE, name), false, args); } private static RLanguage makeFunction(RArgsValuesAndNames args) { @@ -95,17 +94,16 @@ public abstract class Call extends RBuiltinNode { RPairList pl = (RPairList) argList; String name = ((RSymbol) pl.getTag()).getName(); RSyntaxNode value = RASTUtils.createNodeForValue(pl.car()).asRSyntaxNode(); - finalArgs.add(RCodeBuilder.argument(RSyntaxNode.EAGER_DEPARSE, name, value)); + finalArgs.add(RCodeBuilder.argument(RSyntaxNode.LAZY_DEPARSE, name, value)); argList = pl.cdr(); } - RSyntaxNode function = RContext.getASTBuilder().function(RSyntaxNode.EAGER_DEPARSE, finalArgs, RASTUtils.createNodeForValue(body).asRSyntaxNode(), null); - RDeparse.ensureSourceSection(function); + RSyntaxNode function = RContext.getASTBuilder().function(RSyntaxNode.LAZY_DEPARSE, finalArgs, RASTUtils.createNodeForValue(body).asRSyntaxNode(), null); return RDataFactory.createLanguage(function.asRNode()); } @TruffleBoundary protected static RLanguage makeCallSourceUnavailable(String name, RArgsValuesAndNames args) { - return "function".equals(name) ? makeFunction(args) : makeCall0(ReadVariableNode.createFunctionLookup(RSyntaxNode.EAGER_DEPARSE, name), true, args); + return "function".equals(name) ? makeFunction(args) : makeCall0(ReadVariableNode.createFunctionLookup(RSyntaxNode.LAZY_DEPARSE, name), true, args); } @TruffleBoundary 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 af8caf98a7321c563a8647c00537528cd141ccc9..9c2419064f4da5df84e0744831c4fb383a9ceba0 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 @@ -43,7 +43,6 @@ import com.oracle.truffle.r.nodes.function.call.CallRFunctionCachedNode; import com.oracle.truffle.r.nodes.function.call.CallRFunctionCachedNodeGen; import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RCompression; -import com.oracle.truffle.r.runtime.RDeparse; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RInternalError; @@ -118,7 +117,6 @@ public class HiddenInternalFunctions { RCallNode expr0 = RCallNode.createCloneReplacingArgs(callNode, vecNode); try { // We want this call to have a SourceSection - RDeparse.ensureSourceSection(expr0); aenv.put(name, RDataFactory.createPromise(PromiseState.Explicit, Closure.create(expr0), eenv.getFrame())); } catch (PutException ex) { /* 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 63b11a187c3b94bd87bc60a62d6323612990d50f..600d84a3c05a608c1cfca0d6ac255d4068d88790 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 @@ -37,6 +37,7 @@ import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; +import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RAttributable; import com.oracle.truffle.r.runtime.data.RAttributes; @@ -183,7 +184,7 @@ public abstract class Identical extends RBuiltinNode { @SuppressWarnings("unused") @Specialization protected byte doInternalIdentical(RSymbol x, RSymbol y, boolean numEq, boolean singleNA, boolean attribAsSet, boolean ignoreBytecode, boolean ignoreEnvironment) { - assert x.getName() == x.getName().intern() && y.getName() == y.getName().intern(); + assert Utils.isInterned(x.getName()) && Utils.isInterned(y.getName()); return x.getName() == y.getName() ? RRuntime.LOGICAL_TRUE : RRuntime.LOGICAL_FALSE; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java index 2825463c7679da160107b42929f18bba1d333d5e..6c4e907480e70cdc8229dd55ea3bcca78968b29f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java @@ -28,6 +28,7 @@ import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.function.WrapArgumentNode; import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RPromise; import com.oracle.truffle.r.runtime.data.RSymbol; @@ -68,7 +69,7 @@ public abstract class Slot extends RBuiltinNode { protected Object getSlot(Object object, Object nameObj, @Cached("createClassProfile()") ValueProfile nameObjProfile) { String name = getName(nameObjProfile.profile(nameObj)); - assert name == name.intern(); + assert Utils.isInterned(name); return accessSlotNode.executeAccess(object, name); } } 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 003fb96b284730de7da4a616d917c24c3f2d541e..b9f41698d5966fe4c557badf8f03da94e0b95225 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 @@ -15,11 +15,11 @@ import static com.oracle.truffle.r.runtime.RDispatch.INTERNAL_GENERIC; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; -import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.r.nodes.builtin.CastBuilder; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import com.oracle.truffle.r.nodes.unary.CastToVectorNode; -import com.oracle.truffle.r.nodes.unary.CastToVectorNodeGen; +import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RAttributeProfiles; @@ -30,18 +30,13 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractVector; @RBuiltin(name = "levels<-", kind = PRIMITIVE, parameterNames = {"x", "value"}, dispatch = INTERNAL_GENERIC, behavior = PURE) public abstract class UpdateLevels extends RBuiltinNode { - @Child private CastToVectorNode castVector; + @Override + protected void createCasts(CastBuilder casts) { + casts.arg("value").allowNull().asVector(false); + } private final RAttributeProfiles attrProfiles = RAttributeProfiles.create(); - private RAbstractVector castVector(Object value) { - if (castVector == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - castVector = insert(CastToVectorNodeGen.create(false)); - } - return (RAbstractVector) castVector.execute(value); - } - @Specialization protected RAbstractVector updateLevels(RAbstractVector vector, @SuppressWarnings("unused") RNull levels) { RVector<?> v = (RVector<?>) vector.getNonShared(); @@ -49,14 +44,20 @@ public abstract class UpdateLevels extends RBuiltinNode { return v; } - @Specialization(guards = "levelsNotNull(levels)") + @Specialization(guards = "!isRNull(levels)") protected RAbstractVector updateLevels(RAbstractVector vector, Object levels) { RVector<?> v = (RVector<?>) vector.getNonShared(); - v.setAttr(RRuntime.LEVELS_ATTR_KEY, castVector(levels)); + v.setAttr(RRuntime.LEVELS_ATTR_KEY, levels); return v; } - protected boolean levelsNotNull(Object levels) { - return levels != RNull.instance; + @Specialization + protected RNull updateLevels(@SuppressWarnings("unused") RNull vector, @SuppressWarnings("unused") RNull levels) { + return RNull.instance; + } + + @Specialization(guards = "!isRNull(levels)") + protected RAbstractVector updateLevels(@SuppressWarnings("unused") RNull vector, @SuppressWarnings("unused") Object levels) { + throw RError.error(this, Message.SET_ATTRIBUTES_ON_NULL); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/AccessField.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/AccessField.java index 0aafef63839fe6e7fb309d335155efc1b8a8c9b5..36866074464c2b3f440152f76350d05a393b6dbc 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/AccessField.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/AccessField.java @@ -59,7 +59,8 @@ abstract class AccessFieldSpecial extends SpecialsUtils.ListFieldSpecialBase { @Child private ExtractListElement extractListElement = ExtractListElement.create(); @Specialization(guards = {"isSimpleList(list)", "isCached(list, field)", "list.getNames() != null"}) - public Object doList(RList list, String field, @Cached("getIndex(list.getNames(), field)") int index) { + public Object doList(RList list, String field, + @Cached("getIndex(list.getNames(), field)") int index) { if (index == -1) { throw RSpecialFactory.throwFullCallNeeded(); } @@ -67,6 +68,11 @@ abstract class AccessFieldSpecial extends SpecialsUtils.ListFieldSpecialBase { return extractListElement.execute(list, index); } + @Specialization(contains = "doList", guards = {"isSimpleList(list)", "list.getNames() != null"}) + public Object doListDynamic(RList list, String field) { + return doList(list, field, getIndex(list.getNames(), field)); + } + @Fallback @SuppressWarnings("unused") public void doFallback(Object container, Object field) { 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 7618a1d5e34b074989a62718d94ea289367d62ab..a72d60cf059516649d731875c9f2352777135446 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 @@ -24,12 +24,12 @@ package com.oracle.truffle.r.nodes.builtin.base.infix; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.function.ClassHierarchyNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RStringVector; -import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; import com.oracle.truffle.r.runtime.nodes.RNode; @@ -101,14 +101,25 @@ class SpecialsUtils { return cachedField == null || (cachedField == field && list.getNames() == cachedNames); } - protected static int getIndex(RAbstractStringVector names, String field) { + protected static int getIndex(RStringVector names, String field) { + int fieldHash = field.hashCode(); for (int i = 0; i < names.getLength(); i++) { String current = names.getDataAt(i); - if (current == field || current.equals(field)) { + if (current == field || hashCodeEquals(current, fieldHash) && contentsEquals(current, field)) { return i; } } return -1; } + + @TruffleBoundary + private static boolean contentsEquals(String current, String field) { + return field.equals(current); + } + + @TruffleBoundary + private static boolean hashCodeEquals(String current, int fieldHash) { + return current.hashCode() == fieldHash; + } } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateField.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateField.java index 7a9928cbd661f3ee540bbac308e5f8190d38d11e..da44b6344da226739efbb89c77cbb9067773ccbe 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateField.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateField.java @@ -66,10 +66,10 @@ abstract class UpdateFieldSpecial extends SpecialsUtils.ListFieldSpecialBase { } @Specialization(guards = {"isSimpleList(list)", "!list.isShared()", "isCached(list, field)", "list.getNames() != null", "isNotRNullRList(value)"}) - public RList doList(RList list, String field, Object value, @Cached("getIndex(list.getNames(), field)") int index) { + public RList doList(RList list, String field, Object value, + @Cached("getIndex(list.getNames(), field)") int index) { if (index == -1) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - throw RSpecialFactory.throwFullCallNeeded(); + throw RSpecialFactory.throwFullCallNeeded(value); } updateCache(list, field); Object sharedValue = value; @@ -81,9 +81,15 @@ abstract class UpdateFieldSpecial extends SpecialsUtils.ListFieldSpecialBase { return list; } + @Specialization(contains = "doList", guards = {"isSimpleList(list)", "!list.isShared()", "list.getNames() != null", "isNotRNullRList(value)"}) + public RList doListDynamic(RList list, String field, Object value) { + return doList(list, field, value, getIndex(list.getNames(), field)); + } + + @SuppressWarnings("unused") @Fallback public void doFallback(Object container, Object field, Object value) { - throw RSpecialFactory.throwFullCallNeeded(); + throw RSpecialFactory.throwFullCallNeeded(value); } private ShareObjectNode getShareObjectNode() { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java index 4d17163f6d024c20abb2f8c7cba29e93e613a98f..5a68b3998b0e09edf9ddc0c2374f005f7b0675f9 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/infix/UpdateSubscript.java @@ -128,7 +128,7 @@ abstract class UpdateSubscriptSpecial extends SubscriptSpecialCommon { @SuppressWarnings("unused") @Fallback protected static Object setFallback(Object vector, Object index, Object value) { - throw RSpecialFactory.throwFullCallNeeded(); + throw RSpecialFactory.throwFullCallNeeded(value); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/DoubleVectorPrinter.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/DoubleVectorPrinter.java index 3bec697593cce250ab55be0995abc261d476d914..ac9c3b375ceb2816c1e32e8ec8913255f9e45d81 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/DoubleVectorPrinter.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/DoubleVectorPrinter.java @@ -151,11 +151,7 @@ public final class DoubleVectorPrinter extends VectorPrinter<RAbstractDoubleVect mnl = left; /* min digits to left of . */ } if (sleft > mxsl) { - mxsl = sleft; /* - * max left includingimport static - * com.oracle.truffle.r.nodes.builtin.base.printer.Utils.*; - * sign(s) - */ + mxsl = sleft; /* max left including sign(s) */ } if (nsig > mxns) { mxns = nsig; /* max sig digits */ @@ -191,7 +187,7 @@ public final class DoubleVectorPrinter extends VectorPrinter<RAbstractDoubleVect e = (mxl > 100 || mnl <= -99) ? 2 : 1; /* 3 digit exponent */ if (mxns != RRuntime.INT_MIN_VALUE) { d = mxns - 1; - w = neg + (d != 0 ? 1 : 1) + d + 4 + e; /* width for E format */ + w = neg + (d > 0 ? 1 : 0) + d + 4 + e; /* width for E format */ if (wF <= w + sciPen) { /* Fixpoint if it needs less space */ e = 0; if (nsmall > rgt) { @@ -390,50 +386,55 @@ public final class DoubleVectorPrinter extends VectorPrinter<RAbstractDoubleVect return encodeReal(x, dm.maxWidth, dm.d, dm.e, '.', pp); } + // caching some commonly used formats + private static final DecimalFormat[] CACHED_FORMATS = new DecimalFormat[32]; + @TruffleBoundary static String encodeReal(double initialX, int w, int d, int e, char cdec, String naString) { - final String buff; - String fmt; - /* IEEE allows signed zeros (yuck!) */ double x = RRuntime.normalizeZero(initialX); if (!RRuntime.isFinite(x)) { - int numBlanks = Math.min(w, (NB - 1)); - String naFmt = "%" + Utils.asBlankArg(numBlanks) + "s"; + String id; if (RRuntime.isNA(x)) { - buff = snprintf(NB, naFmt, naString); + id = naString; } else if (RRuntime.isNAorNaN(x)) { - buff = snprintf(NB, naFmt, "NaN"); - } else if (x > 0) { - buff = snprintf(NB, naFmt, "Inf"); + id = "NaN"; } else { - buff = snprintf(NB, naFmt, "-Inf"); + id = x > 0 ? "Inf" : "-Inf"; } + return prependBlanks(w, id); } else if (e != 0) { - if (d != 0) { - fmt = String.format("%%#%d.%de", Math.min(w, (NB - 1)), d); - buff = snprintf(NB, fmt, x); - } else { - fmt = String.format("%%%d.%de", Math.min(w, (NB - 1)), d); - buff = snprintf(NB, fmt, x); - } + String fmt = String.format((d != 0) ? "%%#%d.%de" : "%%%d.%de", Math.min(w, (NB - 1)), d); + return snprintf(NB, fmt, x).replace('.', cdec); } else { /* e = 0 */ - DecimalFormat df = new DecimalFormat("#.#"); - df.setRoundingMode(RoundingMode.HALF_EVEN); - df.setDecimalSeparatorAlwaysShown(false); - df.setMinimumFractionDigits(d); - df.setMaximumFractionDigits(d); - String ds = df.format(x); - int blanks = w - ds.length(); - fmt = "%" + Utils.asBlankArg(blanks) + "s%s"; - buff = String.format(fmt, "", ds); + DecimalFormat df = null; + if (d < CACHED_FORMATS.length) { + df = CACHED_FORMATS[d]; + } + if (df == null) { + df = new DecimalFormat("#.#"); + df.setRoundingMode(RoundingMode.HALF_EVEN); + df.setDecimalSeparatorAlwaysShown(false); + df.setMinimumFractionDigits(d); + df.setMaximumFractionDigits(d); + if (d < CACHED_FORMATS.length) { + CACHED_FORMATS[d] = df; + } + } + return prependBlanks(w, df.format(x)).replace('.', cdec); } + } - if (cdec != '.') { - buff.replace('.', cdec); + private static String prependBlanks(int width, String id) { + assert id.length() <= width; + if (id.length() == width) { + return id; } - - return buff; + StringBuilder str = new StringBuilder(width); + for (int i = 0; i < width - id.length(); i++) { + str.append(' '); + } + return str.append(id).toString(); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java index a56f3e5159b8a69a283ef3cf45d87cc4394b2fed..caed0874e9fe810fa18e624cabbba2f25e540198 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRSyntaxTree.java @@ -22,7 +22,8 @@ */ package com.oracle.truffle.r.nodes.builtin.fastr; -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.toBoolean; import static com.oracle.truffle.r.runtime.RVisibility.OFF; import static com.oracle.truffle.r.runtime.builtins.RBehavior.IO; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; @@ -52,7 +53,6 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxFunction; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNodeVisitor; import com.oracle.truffle.r.runtime.nodes.RSyntaxVisitor; /** @@ -62,8 +62,6 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxVisitor; * Only nodes that return {@code true} to {@link RSyntaxNode#isSyntax()} are processed. N.B. This * will reach nodes that implement {@link RSyntaxNode} but are used in {@link RSyntaxNode#INTERNAL} * mode</li> - * <li><b>rsyntaxnode</b>: Use the {@link RSyntaxNodeVisitor}. The main difference from mode - * {@code node} is that the children of non-syntax nodes are not visited at all.</li> * <li><b<syntaxelement</b>: Use the {@link RSyntaxVisitor} to visit the "logical" syntax tree.</li> * </ol> * @@ -105,20 +103,6 @@ public abstract class FastRSyntaxTree extends RBuiltinNode { }); break; - case "rsyntaxnode": - RSyntaxNode.accept(root, 0, new RSyntaxNodeVisitor() { - - @Override - public boolean visit(RSyntaxNode node, int depth) { - printIndent(depth); - writeString(node.getClass().getSimpleName(), false); - processRSyntaxNode(node, printSource, printTags); - printnl(); - return true; - } - }, true); - break; - case "syntaxelement": RSyntaxVisitor<Void> visitor = new RSyntaxVisitor<Void>() { private int depth; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java index 514c608b84adf4c87d6b43b49493632414f4d57e..801a83f816c25b5822288e925ed6b6a4f5384bf6 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java @@ -55,9 +55,12 @@ import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.RFunction; import com.oracle.truffle.r.runtime.nodes.RBaseNode; import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; +import com.oracle.truffle.r.runtime.nodes.RSyntaxConstant; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; +import com.oracle.truffle.r.runtime.nodes.RSyntaxFunction; +import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNodeVisitor; +import com.oracle.truffle.r.runtime.nodes.RSyntaxVisitor; /** * The implementation of the R debug functions. @@ -157,17 +160,35 @@ public class DebugHandling { instrumenter.attachListener(statementBuilder.build(), fser.getStatementListener()); // Finally attach loop listeners to all loop nodes SourceSectionFilter.Builder loopBuilder = RInstrumentation.createFunctionFilter(fdn, RSyntaxTags.LoopTag.class); - RSyntaxNode.accept(fdn, 0, new RSyntaxNodeVisitor() { + new RSyntaxVisitor<Void>() { @Override - public boolean visit(RSyntaxNode node, int depth) { - if (node instanceof AbstractLoopNode) { - instrumenter.attachListener(loopBuilder.build(), fser.getLoopStatementReceiver(node)); + protected Void visit(RSyntaxCall element) { + if (element instanceof AbstractLoopNode) { + instrumenter.attachListener(loopBuilder.build(), fser.getLoopStatementReceiver((AbstractLoopNode) element)); } - return true; + accept(element.getSyntaxLHS()); + for (RSyntaxElement arg : element.getSyntaxArguments()) { + accept(arg); + } + return null; } - }, false); + @Override + protected Void visit(RSyntaxConstant element) { + return null; + } + + @Override + protected Void visit(RSyntaxLookup element) { + return null; + } + + @Override + protected Void visit(RSyntaxFunction element) { + return null; + } + }.accept(fdn); return fser; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java index 630d3da88adc1d0578fdf2807ca06fcc3ac7a772..441422963fbecd470e0edaede395022b40dbdb17 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java @@ -41,7 +41,6 @@ import com.oracle.truffle.r.nodes.control.IfNode; import com.oracle.truffle.r.nodes.control.NextNode; import com.oracle.truffle.r.nodes.control.RepeatNode; import com.oracle.truffle.r.nodes.control.ReplacementDispatchNode; -import com.oracle.truffle.r.nodes.control.ReplacementDispatchNode.LHSError; import com.oracle.truffle.r.nodes.control.WhileNode; import com.oracle.truffle.r.nodes.function.FormalArguments; import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode; @@ -54,7 +53,6 @@ import com.oracle.truffle.r.nodes.function.WrapDefaultArgumentNode; import com.oracle.truffle.r.nodes.function.signature.MissingNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.FastROptions; -import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.builtins.FastPathFactory; import com.oracle.truffle.r.runtime.data.REmpty; @@ -62,8 +60,6 @@ import com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor; import com.oracle.truffle.r.runtime.nodes.EvaluatedArgumentsVisitor; import com.oracle.truffle.r.runtime.nodes.RCodeBuilder; import com.oracle.truffle.r.runtime.nodes.RNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; -import com.oracle.truffle.r.runtime.nodes.RSyntaxConstant; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; @@ -88,6 +84,7 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { this.constants = constants; } + @SuppressWarnings({"unused", "static-method"}) private RCallNode unused() { return null; // we need reference to RCallNode, otherwise it won't compile, compilation bug? } @@ -95,27 +92,28 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { @Override public RSyntaxNode call(SourceSection source, RSyntaxNode lhs, List<Argument<RSyntaxNode>> args) { if (lhs instanceof RSyntaxLookup) { - String symbol = ((RSyntaxLookup) lhs).getIdentifier(); + RSyntaxLookup lhsLookup = (RSyntaxLookup) lhs; + String symbol = lhsLookup.getIdentifier(); if (args.size() == 0) { switch (symbol) { case "break": - return new BreakNode(source); + return new BreakNode(source, lhsLookup); case "next": - return new NextNode(source); + return new NextNode(source, lhsLookup); } } else if (args.size() == 1) { switch (symbol) { case "repeat": - return RepeatNode.create(source, args.get(0).value); + return new RepeatNode(source, lhsLookup, args.get(0).value); case "(": return args.get(0).value; } } else if (args.size() == 2) { switch (symbol) { case "while": - return WhileNode.create(source, args.get(0).value, args.get(1).value); + return new WhileNode(source, lhsLookup, args.get(0).value, args.get(1).value); case "if": - return IfNode.create(source, args.get(0).value, args.get(1).value, null); + return new IfNode(source, lhsLookup, args.get(0).value, args.get(1).value, null); case "=": case "<-": case ":=": @@ -124,57 +122,38 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { case "->>": boolean isSuper = "<<-".equals(symbol) || "->>".equals(symbol); boolean switchArgs = "->".equals(symbol) || "->>".equals(symbol); - String operator = "=".equals(symbol) ? "=" : isSuper ? "<<-" : "<-"; - return createReplacement(source, operator, isSuper, args.get(switchArgs ? 1 : 0).value, args.get(switchArgs ? 0 : 1).value); + // fix the operators while keeping the correct source sections + if ("->>".equals(symbol)) { + lhsLookup = ReadVariableNode.createForcedFunctionLookup(lhs.getLazySourceSection(), "<<-"); + } else if ("->".equals(symbol)) { + lhsLookup = ReadVariableNode.createForcedFunctionLookup(lhs.getLazySourceSection(), "<-"); + } + // switch the args if needed + RSyntaxNode lhsArg = args.get(switchArgs ? 1 : 0).value; + RSyntaxNode rhsArg = args.get(switchArgs ? 0 : 1).value; + return new ReplacementDispatchNode(source, lhsLookup, lhsArg, rhsArg, isSuper, context.getReplacementVarsStartIndex()); } } else if (args.size() == 3) { switch (symbol) { case "for": if (args.get(0).value instanceof RSyntaxLookup) { - String name = ((RSyntaxLookup) args.get(0).value).getIdentifier(); - WriteVariableNode cvar = WriteVariableNode.create(source, name, null, false); - return ForNode.create(source, cvar, args.get(1).value, args.get(2).value); + RSyntaxLookup var = (RSyntaxLookup) args.get(0).value; + return new ForNode(source, lhsLookup, var, args.get(1).value.asRNode(), args.get(2).value.asRNode()); } break; case "if": - return IfNode.create(source, args.get(0).value, args.get(1).value, args.get(2).value); + return new IfNode(source, lhsLookup, args.get(0).value, args.get(1).value, args.get(2).value); } } switch (symbol) { case "{": - return new BlockNode(source, args.stream().map(n -> n.value.asRNode()).toArray(RNode[]::new)); + return new BlockNode(source, lhsLookup, args.stream().map(n -> n.value.asRNode()).toArray(RNode[]::new)); case "missing": - return new MissingNode(source, lhs, createSignature(args), args.stream().map(a -> a.value).toArray(RSyntaxElement[]::new)); + return new MissingNode(source, lhsLookup, createSignature(args), args.stream().map(a -> a.value).toArray(RSyntaxElement[]::new)); } } - ArgumentsSignature signature = createSignature(args); - RSyntaxNode[] nodes = args.stream().map( - arg -> (arg.value == null && arg.name == null) ? ConstantNode.create(arg.source == null ? RSyntaxNode.SOURCE_UNAVAILABLE : arg.source, REmpty.instance) : arg.value).toArray( - RSyntaxNode[]::new); - - return RCallSpecialNode.createCall(source, lhs.asRNode(), signature, nodes); - } - - private RSyntaxNode createReplacement(SourceSection source, String operator, boolean isSuper, RSyntaxNode replacementLhs, RSyntaxNode replacementRhs) { - if (replacementLhs instanceof RSyntaxCall) { - return createReplacement(source, replacementLhs, replacementRhs, operator, isSuper); - } else { - String name; - if (replacementLhs instanceof RSyntaxLookup) { - name = ((RSyntaxLookup) replacementLhs).getIdentifier(); - } else if (replacementLhs instanceof RSyntaxConstant) { - RSyntaxConstant c = (RSyntaxConstant) replacementLhs; - if (c.getValue() instanceof String) { - name = (String) c.getValue(); - } else { - return new LHSError(source, operator, replacementLhs, replacementRhs); - } - } else { - throw RInternalError.unimplemented("unexpected lhs type: " + replacementLhs.getClass()); - } - return (RSyntaxNode) WriteVariableNode.create(source, name, replacementRhs.asRNode(), isSuper); - } + return RCallSpecialNode.createCall(source, lhs.asRNode(), createSignature(args), createArguments(args)); } private static ArgumentsSignature createSignature(List<Argument<RSyntaxNode>> args) { @@ -183,6 +162,15 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { return signature; } + private static RSyntaxNode[] createArguments(List<Argument<RSyntaxNode>> args) { + RSyntaxNode[] nodes = new RSyntaxNode[args.size()]; + for (int i = 0; i < nodes.length; i++) { + Argument<RSyntaxNode> arg = args.get(i); + nodes[i] = (arg.value == null && arg.name == null) ? ConstantNode.create(arg.source == null ? RSyntaxNode.SOURCE_UNAVAILABLE : arg.source, REmpty.instance) : arg.value; + } + return nodes; + } + private static String getFunctionDescription(SourceSection source, Object assignedTo) { if (assignedTo instanceof String) { return (String) assignedTo; @@ -194,10 +182,6 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { } } - private RSyntaxNode createReplacement(SourceSection source, RSyntaxNode lhs, RSyntaxNode rhs, String operator, boolean isSuper) { - return new ReplacementDispatchNode(source, operator, lhs, rhs, isSuper, this.context.getReplacementVarsStartIndex()); - } - public static FastPathFactory createFunctionFastPath(RSyntaxElement body, ArgumentsSignature signature) { return EvaluatedArgumentsVisitor.process(body, signature); } @@ -293,21 +277,19 @@ public final class RASTBuilder implements RCodeBuilder<RSyntaxNode> { } @Override - public RSyntaxNode lookup(SourceSection sourceIn, String symbol, boolean functionLookup) { + public RSyntaxNode lookup(SourceSection source, String symbol, boolean functionLookup) { + assert source != null; if (constants != null && symbol.startsWith("C")) { Object object = constants.get(symbol); if (object != null) { - return ConstantNode.create(sourceIn, object); + return ConstantNode.create(source, object); } } - /* - * TODO Ideally, sourceIn != null always, however ReplacementNodes can cause this on the - * rewrite nodes. - */ - SourceSection source = sourceIn == null ? RSyntaxNode.INTERNAL : sourceIn; - if (!functionLookup && getVariadicComponentIndex(symbol) != -1) { - int ind = getVariadicComponentIndex(symbol); - return new ReadVariadicComponentNode(source, ind > 0 ? ind - 1 : ind); + if (!functionLookup) { + int index = getVariadicComponentIndex(symbol); + if (index != -1) { + return new ReadVariadicComponentNode(source, index > 0 ? index - 1 : index); + } } return functionLookup ? ReadVariableNode.createForcedFunctionLookup(source, symbol) : ReadVariableNode.create(source, symbol, false); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java index 0c3db22a7de0936412400b21c452fd7a6bd3f299..910e062082ce458937f3f726128fabc346fb5071 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTUtils.java @@ -40,6 +40,7 @@ import com.oracle.truffle.r.nodes.function.WrapArgumentBaseNode; import com.oracle.truffle.r.nodes.function.WrapArgumentNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.RInternalError; +import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.REmpty; @@ -144,7 +145,7 @@ public class RASTUtils { return value; } else if (element instanceof RSyntaxLookup) { String id = ((RSyntaxLookup) element).getIdentifier(); - assert id == id.intern() : element; + assert Utils.isInterned(id); return RDataFactory.createSymbol(id); } else { assert element instanceof RSyntaxCall || element instanceof RSyntaxFunction; @@ -163,7 +164,7 @@ public class RASTUtils { return RDataFactory.createSymbolInterned(rvcn.getPrintForm()); } else { String id = ((ReadVariableNode) readVariableNode).getIdentifier(); - assert id == id.intern(); + assert Utils.isInterned(id); return RDataFactory.createSymbol(id); } } @@ -223,7 +224,7 @@ public class RASTUtils { } else { fnNode = (RNode) unwrap(fn); } - SourceSection sourceSection = sourceUnavailable ? RSyntaxNode.SOURCE_UNAVAILABLE : RSyntaxNode.EAGER_DEPARSE; + SourceSection sourceSection = sourceUnavailable ? RSyntaxNode.SOURCE_UNAVAILABLE : RSyntaxNode.LAZY_DEPARSE; return RCallSpecialNode.createCall(sourceSection, fnNode, signature, arguments); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessSlotNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessSlotNode.java index deb90eb6641880a7f0b5834f9f7ebd219453608d..697ec2da297636dae05c7880176712966b16b2a8 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessSlotNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/AccessSlotNode.java @@ -69,7 +69,7 @@ public abstract class AccessSlotNode extends RNode { private Object getSlotS4Internal(RAttributable object, String name, Object value) { if (value == null) { noSlot.enter(); - assert name == name.intern(); + assert Utils.isInterned(name); if (name == RRuntime.DOT_S3_CLASS) { if (classHierarchy == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -158,7 +158,7 @@ public abstract class AccessSlotNode extends RNode { } protected boolean isDotData(String name) { - assert name == name.intern(); + assert Utils.isInterned(name); return name == RRuntime.DOT_DATA; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/BaseWriteVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/BaseWriteVariableNode.java index 98ed65cc09722ad911098ba83ea80dae38fd6c05..52fa750d0304b0ce0fe55c97cf23214a8cde5e7f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/BaseWriteVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/BaseWriteVariableNode.java @@ -30,7 +30,6 @@ import com.oracle.truffle.api.frame.Frame; import com.oracle.truffle.api.frame.FrameSlot; import com.oracle.truffle.api.frame.FrameSlotKind; import com.oracle.truffle.api.frame.FrameSlotTypeException; -import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.profiles.ValueProfile; @@ -122,17 +121,17 @@ abstract class BaseWriteVariableNode extends WriteVariableNode { } @SuppressWarnings("unused") - protected boolean isLogicalKind(VirtualFrame frame, FrameSlot frameSlot) { + protected boolean isLogicalKind(Frame frame, FrameSlot frameSlot) { return isKind(frameSlot, FrameSlotKind.Boolean); } @SuppressWarnings("unused") - protected boolean isIntegerKind(VirtualFrame frame, FrameSlot frameSlot) { + protected boolean isIntegerKind(Frame frame, FrameSlot frameSlot) { return isKind(frameSlot, FrameSlotKind.Int); } @SuppressWarnings("unused") - protected boolean isDoubleKind(VirtualFrame frame, FrameSlot frameSlot) { + protected boolean isDoubleKind(Frame frame, FrameSlot frameSlot) { return isKind(frameSlot, FrameSlotKind.Double); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateSlotNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateSlotNode.java index 6b0f907f45d7d1a37561e45c411096b9a27ea8e2..a92d821b1865c6c785102e92f72e38eb570aab54 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateSlotNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/UpdateSlotNode.java @@ -56,7 +56,7 @@ public abstract class UpdateSlotNode extends RNode { @Specialization(contains = "updateSlotS4Cached", guards = "!isData(name)") protected Object updateSlotS4(RAttributable object, String name, Object value) { - assert name == name.intern(); + assert Utils.isInterned(name); object.setAttr(name, prepareValue(value)); return object; } @@ -75,7 +75,7 @@ public abstract class UpdateSlotNode extends RNode { } protected boolean isData(String name) { - assert name == name.intern(); + assert Utils.isInterned(name); return name == RRuntime.DOT_DATA; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java index d5243f1b9783647349c0a1625221358189918f74..c3d06849facec7118352a5eab003a85c99aa40af 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperFrameVariableNode.java @@ -27,7 +27,6 @@ import static com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor.find import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.dsl.NodeChild; import com.oracle.truffle.api.dsl.NodeChildren; -import com.oracle.truffle.api.dsl.NodeField; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.frame.FrameSlot; import com.oracle.truffle.api.frame.FrameSlotKind; @@ -37,7 +36,7 @@ import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.access.WriteLocalFrameVariableNodeFactory.UnresolvedWriteLocalFrameVariableNodeGen; -import com.oracle.truffle.r.nodes.access.WriteVariableNode.Mode; +import com.oracle.truffle.r.nodes.access.WriteSuperFrameVariableNodeFactory.ResolvedWriteSuperFrameVariableNodeGen; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.env.REnvironment; @@ -49,59 +48,75 @@ import com.oracle.truffle.r.runtime.nodes.RNode; * * The state starts out a "unresolved" and transforms to "resolved". */ -@SuppressWarnings("unused") -@NodeChildren({@NodeChild(value = "enclosingFrame", type = AccessEnclosingFrameNode.class), @NodeChild(value = "frameSlotNode", type = FrameSlotNode.class)}) -@NodeField(name = "mode", type = Mode.class) -abstract class WriteSuperFrameVariableNode extends WriteSuperFrameVariableNodeHelper { - private final ValueProfile storedObjectProfile = ValueProfile.createClassProfile(); - private final BranchProfile invalidateProfile = BranchProfile.create(); - private final ValueProfile enclosingFrameProfile = ValueProfile.createClassProfile(); - - protected abstract FrameSlotNode getFrameSlotNode(); - - public abstract Mode getMode(); +abstract class WriteSuperFrameVariableNode extends BaseWriteVariableNode { static WriteVariableNode create(String name, RNode rhs, Mode mode) { return new UnresolvedWriteSuperFrameVariableNode(name, rhs, mode); } - @Specialization(guards = "isLogicalKind(frame, frameSlot)") - protected void doLogical(VirtualFrame frame, byte value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { - FrameSlotChangeMonitor.setByteAndInvalidate(enclosingFrameProfile.profile(enclosingFrame), frameSlot, value, true, invalidateProfile); - } + protected abstract void execute(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame); - @Specialization(guards = "isIntegerKind(frame, frameSlot)") - protected void doInteger(VirtualFrame frame, int value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { - FrameSlotChangeMonitor.setIntAndInvalidate(enclosingFrameProfile.profile(enclosingFrame), frameSlot, value, true, invalidateProfile); + @Override + public final Object execute(VirtualFrame frame) { + Object value = getRhs().execute(frame); + execute(frame, value); + return value; } - @Specialization(guards = "isDoubleKind(frame, frameSlot)") - protected void doDouble(VirtualFrame frame, double value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { - FrameSlotChangeMonitor.setDoubleAndInvalidate(enclosingFrameProfile.profile(enclosingFrame), frameSlot, value, true, invalidateProfile); - } + @NodeChildren({@NodeChild(value = "enclosingFrame", type = AccessEnclosingFrameNode.class), @NodeChild(value = "frameSlotNode", type = FrameSlotNode.class)}) + protected abstract static class ResolvedWriteSuperFrameVariableNode extends WriteSuperFrameVariableNode { + + private final ValueProfile storedObjectProfile = ValueProfile.createClassProfile(); + private final BranchProfile invalidateProfile = BranchProfile.create(); + private final ValueProfile enclosingFrameProfile = ValueProfile.createClassProfile(); + + private final Mode mode; + + public ResolvedWriteSuperFrameVariableNode(Mode mode) { + this.mode = mode; + } - @Specialization - protected void doObject(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { - MaterializedFrame profiledFrame = enclosingFrameProfile.profile(enclosingFrame); - Object newValue = shareObjectValue(profiledFrame, frameSlot, storedObjectProfile.profile(value), getMode(), true); - FrameSlotChangeMonitor.setObjectAndInvalidate(profiledFrame, frameSlot, newValue, true, invalidateProfile); + protected abstract FrameSlotNode getFrameSlotNode(); + + @Specialization(guards = "isLogicalKind(enclosingFrame, frameSlot)") + protected void doLogical(byte value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + FrameSlotChangeMonitor.setByteAndInvalidate(enclosingFrameProfile.profile(enclosingFrame), frameSlot, value, true, invalidateProfile); + } + + @Specialization(guards = "isIntegerKind(enclosingFrame, frameSlot)") + protected void doInteger(int value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + FrameSlotChangeMonitor.setIntAndInvalidate(enclosingFrameProfile.profile(enclosingFrame), frameSlot, value, true, invalidateProfile); + } + + @Specialization(guards = "isDoubleKind(enclosingFrame, frameSlot)") + protected void doDouble(double value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + FrameSlotChangeMonitor.setDoubleAndInvalidate(enclosingFrameProfile.profile(enclosingFrame), frameSlot, value, true, invalidateProfile); + } + + @Specialization + protected void doObject(Object value, MaterializedFrame enclosingFrame, FrameSlot frameSlot) { + MaterializedFrame profiledFrame = enclosingFrameProfile.profile(enclosingFrame); + Object newValue = shareObjectValue(profiledFrame, frameSlot, storedObjectProfile.profile(value), mode, true); + FrameSlotChangeMonitor.setObjectAndInvalidate(profiledFrame, frameSlot, newValue, true, invalidateProfile); + } } - private static class UnresolvedWriteSuperFrameVariableNode extends WriteSuperFrameVariableNodeHelper { + private static final class UnresolvedWriteSuperFrameVariableNode extends WriteSuperFrameVariableNode { @Child private RNode rhs; - private final String symbol; - private final BaseWriteVariableNode.Mode mode; - UnresolvedWriteSuperFrameVariableNode(String symbol, RNode rhs, BaseWriteVariableNode.Mode mode) { + private final String name; + private final Mode mode; + + UnresolvedWriteSuperFrameVariableNode(String name, RNode rhs, Mode mode) { this.rhs = rhs; - this.symbol = symbol; + this.name = name; this.mode = mode; } @Override public String getName() { - return symbol; + return name; } @Override @@ -112,21 +127,21 @@ abstract class WriteSuperFrameVariableNode extends WriteSuperFrameVariableNodeHe @Override public void execute(VirtualFrame frame, Object value, MaterializedFrame enclosingFrame) { CompilerDirectives.transferToInterpreterAndInvalidate(); - if (getName().isEmpty()) { + if (name.isEmpty()) { throw RError.error(RError.NO_CALLER, RError.Message.ZERO_LENGTH_VARIABLE); } - final WriteSuperFrameVariableNodeHelper writeNode; + final WriteSuperFrameVariableNode writeNode; if (REnvironment.isGlobalEnvFrame(enclosingFrame)) { /* * we've reached the global scope, do unconditional write. if this is the first node * in the chain, needs the rhs and enclosingFrame nodes */ AccessEnclosingFrameNode enclosingFrameNode = RArguments.getEnclosingFrame(frame) == enclosingFrame ? new AccessEnclosingFrameNode() : null; - writeNode = WriteSuperFrameVariableNodeGen.create(getRhs(), enclosingFrameNode, - FrameSlotNode.create(findOrAddFrameSlot(enclosingFrame.getFrameDescriptor(), symbol, FrameSlotKind.Illegal)), getName(), mode); + writeNode = ResolvedWriteSuperFrameVariableNodeGen.create(mode, rhs, enclosingFrameNode, + FrameSlotNode.create(findOrAddFrameSlot(enclosingFrame.getFrameDescriptor(), name, FrameSlotKind.Illegal)), name); } else { - WriteSuperFrameVariableNode actualWriteNode = WriteSuperFrameVariableNodeGen.create(null, null, FrameSlotNode.create(symbol), this.getName(), mode); - writeNode = new WriteSuperFrameVariableConditionalNode(actualWriteNode, new UnresolvedWriteSuperFrameVariableNode(symbol, null, mode), getRhs()); + ResolvedWriteSuperFrameVariableNode actualWriteNode = ResolvedWriteSuperFrameVariableNodeGen.create(mode, null, null, FrameSlotNode.create(name), name); + writeNode = new WriteSuperFrameVariableConditionalNode(actualWriteNode, new UnresolvedWriteSuperFrameVariableNode(name, null, mode), rhs); } replace(writeNode).execute(frame, value, enclosingFrame); } @@ -139,22 +154,22 @@ abstract class WriteSuperFrameVariableNode extends WriteSuperFrameVariableNodeHe execute(frame, value, enclosingFrame); } else { // we're in global scope, do a local write instead - replace(UnresolvedWriteLocalFrameVariableNodeGen.create(getRhs(), symbol, mode)).execute(frame, value); + replace(UnresolvedWriteLocalFrameVariableNodeGen.create(rhs, name, mode)).execute(frame, value); } } } - public static class WriteSuperFrameVariableConditionalNode extends WriteSuperFrameVariableNodeHelper { + private static final class WriteSuperFrameVariableConditionalNode extends WriteSuperFrameVariableNode { - @Child private WriteSuperFrameVariableNode writeNode; - @Child private WriteSuperFrameVariableNodeHelper nextNode; + @Child private ResolvedWriteSuperFrameVariableNode writeNode; + @Child private WriteSuperFrameVariableNode nextNode; @Child private RNode rhs; private final ValueProfile enclosingFrameProfile = ValueProfile.createClassProfile(); private final ConditionProfile hasValueProfile = ConditionProfile.createBinaryProfile(); private final ConditionProfile nullSuperFrameProfile = ConditionProfile.createBinaryProfile(); - WriteSuperFrameVariableConditionalNode(WriteSuperFrameVariableNode writeNode, WriteSuperFrameVariableNodeHelper nextNode, RNode rhs) { + WriteSuperFrameVariableConditionalNode(ResolvedWriteSuperFrameVariableNode writeNode, WriteSuperFrameVariableNode nextNode, RNode rhs) { this.writeNode = writeNode; this.nextNode = nextNode; this.rhs = rhs; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperVariableNode.java deleted file mode 100644 index a58cbc56730d6dcfe3d9eb82e16ca9e26d8e6ebb..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteSuperVariableNode.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013, 2016, 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.access; - -import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.nodes.NodeCost; -import com.oracle.truffle.api.nodes.NodeInfo; -import com.oracle.truffle.api.source.SourceSection; -import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; -import com.oracle.truffle.r.runtime.ArgumentsSignature; -import com.oracle.truffle.r.runtime.nodes.RNode; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; -import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; -import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; - -/** - * The "syntax" variant corresponding to {@code x <<- y} in the source. - * - * Owing to type hierarchy restrictions (and lack of multiple (state) inheritance) this cannot - * extend {@link RSourceSectionNode}, so we store the field in {@link WriteVariableNodeSyntaxHelper} - * . - */ -@NodeInfo(cost = NodeCost.NONE) -public class WriteSuperVariableNode extends WriteVariableNodeSyntaxHelper implements RSyntaxNode, RSyntaxCall { - - @Child private WriteVariableNode writeSuperFrameVariableNode; - @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - - protected WriteSuperVariableNode(SourceSection src, String name, RNode rhs) { - super(src); - writeSuperFrameVariableNode = WriteSuperFrameVariableNode.create(name, rhs, Mode.REGULAR); - } - - static WriteSuperVariableNode create(SourceSection src, String name, RNode rhs) { - return new WriteSuperVariableNode(src, name, rhs); - } - - @Override - public Object getName() { - return writeSuperFrameVariableNode.getName(); - } - - @Override - public RNode getRhs() { - return writeSuperFrameVariableNode.getRhs(); - } - - @Override - public Object execute(VirtualFrame frame) { - Object result = writeSuperFrameVariableNode.execute(frame); - visibility.execute(frame, false); - return result; - } - - @Override - public void execute(VirtualFrame frame, Object value) { - writeSuperFrameVariableNode.execute(frame, value); - } - - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(null, "<<-", true); - } - - @Override - public RSyntaxElement[] getSyntaxArguments() { - return new RSyntaxElement[]{RSyntaxLookup.createDummyLookup(getSourceSection(), (String) getName(), false), getRhs().asRSyntaxNode()}; - } - - @Override - public ArgumentsSignature getSyntaxSignature() { - return ArgumentsSignature.empty(2); - } -} 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 3f761e23085bfc4627d3b49b91737a7768b18ce8..d8bd5afed82b97de816a820eeb98558be298999c 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 @@ -23,18 +23,21 @@ package com.oracle.truffle.r.nodes.access; import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.runtime.FastROptions; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.nodes.RNode; +import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; /** * The base of the {@code WriteVariableNode} type hierarchy. There are several variants for * different situations and this class provides static methods to create these. + * + * The types in this hierarchy do not implement {@link RSyntaxElement} - use + * {@link WriteVariableSyntaxNode} instead. */ public abstract class WriteVariableNode extends RNode { - public enum Mode { + public enum Mode { REGULAR, COPY, INVISIBLE @@ -46,19 +49,6 @@ public abstract class WriteVariableNode extends RNode { public abstract void execute(VirtualFrame frame, Object value); - /** - * Variant for a variable that appears in the R language source. - * - * @param isSuper {@code true} if the write is {@code <<-}. - */ - public static WriteVariableNode create(SourceSection src, String name, RNode rhs, boolean isSuper) { - if (isSuper) { - return WriteSuperVariableNode.create(src, name, rhs); - } else { - return WriteCurrentVariableNode.create(src, name, rhs); - } - } - /** * Variant for saving function arguments, i.e. from {@link RArguments} into the frame. */ diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteCurrentVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableSyntaxNode.java similarity index 53% rename from com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteCurrentVariableNode.java rename to com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableSyntaxNode.java index 9875a1f006001499396499c88a86c7ae9217b148..a442c0747aaadaea588b038453ad86d93c88f499 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteCurrentVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableSyntaxNode.java @@ -22,66 +22,62 @@ */ package com.oracle.truffle.r.nodes.access; +import static com.oracle.truffle.api.nodes.NodeCost.NONE; + import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.nodes.NodeCost; import com.oracle.truffle.api.nodes.NodeInfo; import com.oracle.truffle.api.source.SourceSection; +import com.oracle.truffle.r.nodes.access.WriteVariableNode.Mode; +import com.oracle.truffle.r.nodes.control.OperatorNode; import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; +import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.nodes.RNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; +import com.oracle.truffle.r.runtime.nodes.RSyntaxConstant; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -/** - * The "syntax" variant corresponding to {@code x <- y} in the source. - */ -@NodeInfo(cost = NodeCost.NONE) -public class WriteCurrentVariableNode extends WriteVariableNodeSyntaxHelper implements RSyntaxNode, RSyntaxCall { +@NodeInfo(cost = NONE) +public final class WriteVariableSyntaxNode extends OperatorNode { - @Child private WriteLocalFrameVariableNode writeLocalFrameVariableNode; + @Child private WriteVariableNode write; @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - protected WriteCurrentVariableNode(SourceSection src, String name, RNode rhs) { - super(src); - writeLocalFrameVariableNode = WriteLocalFrameVariableNode.create(name, rhs, Mode.REGULAR); - } - - static WriteCurrentVariableNode create(SourceSection src, String name, RNode rhs) { - return new WriteCurrentVariableNode(src, name, rhs); - } + private final RSyntaxElement lhs; - @Override - public Object getName() { - return writeLocalFrameVariableNode.getName(); - } - - @Override - public RNode getRhs() { - return writeLocalFrameVariableNode.getRhs(); + public WriteVariableSyntaxNode(SourceSection source, RSyntaxLookup operator, RSyntaxElement lhs, RNode rhs, boolean isSuper) { + super(source, operator); + this.lhs = lhs; + String name; + if (lhs instanceof RSyntaxLookup) { + name = ((RSyntaxLookup) lhs).getIdentifier(); + } else if (lhs instanceof RSyntaxConstant) { + RSyntaxConstant c = (RSyntaxConstant) lhs; + if (c.getValue() instanceof String) { + name = (String) c.getValue(); + } else { + // "this" needs to be initialized for error reporting to work + this.write = WriteVariableNode.createAnonymous("dummy", rhs, Mode.REGULAR, isSuper); + throw RError.error(this, RError.Message.INVALID_LHS, "do_set"); + } + } else { + throw RInternalError.unimplemented("unexpected lhs type in replacement: " + lhs.getClass()); + } + this.write = WriteVariableNode.createAnonymous(name, rhs, Mode.REGULAR, isSuper); + assert write != null; } @Override public Object execute(VirtualFrame frame) { - Object result = writeLocalFrameVariableNode.execute(frame); + Object result = write.execute(frame); visibility.execute(frame, false); return result; } - @Override - public void execute(VirtualFrame frame, Object value) { - writeLocalFrameVariableNode.execute(frame, value); - } - - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(null, "<-", true); - } - @Override public RSyntaxElement[] getSyntaxArguments() { - return new RSyntaxElement[]{RSyntaxLookup.createDummyLookup(getSourceSection(), (String) getName(), false), getRhs().asRSyntaxNode()}; + return new RSyntaxElement[]{lhs, write.getRhs().asRSyntaxNode()}; } @Override diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java index d1c747ca514651f9939a0f758b1ad3785f361fb9..4303107246f94dd43e347f5172269371957a7fe1 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractLoopNode.java @@ -25,15 +25,15 @@ package com.oracle.truffle.r.nodes.control; import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.nodes.RRootNode; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; /** Marker class for loops. */ -public abstract class AbstractLoopNode extends RSourceSectionNode { - protected AbstractLoopNode(SourceSection sourceSection) { - super(sourceSection); +public abstract class AbstractLoopNode extends OperatorNode { + + protected AbstractLoopNode(SourceSection sourceSection, RSyntaxLookup operator) { + super(sourceSection, operator); } @Override diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BlockNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BlockNode.java index 601e051b4b2053f850e111a6965d558d01b0f341..6b94d1cb09259d34657d1f59a872f0919f2b008f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BlockNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BlockNode.java @@ -30,24 +30,21 @@ import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.nodes.RNode; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; -import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; /** * A {@link BlockNode} represents a sequence of statements created by "{ ... }" in source code. */ -public final class BlockNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { +public final class BlockNode extends OperatorNode { public static final RNode[] EMPTY_BLOCK = new RNode[0]; @Children protected final RNode[] sequence; @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - public BlockNode(SourceSection src, RNode[] sequence) { - super(src); + public BlockNode(SourceSection src, RSyntaxLookup operator, RNode[] sequence) { + super(src, operator); this.sequence = sequence; } @@ -59,16 +56,21 @@ public final class BlockNode extends RSourceSectionNode implements RSyntaxNode, @ExplodeLoop public Object execute(VirtualFrame frame) { visibility.execute(frame, true); - Object lastResult = RNull.instance; - for (int i = 0; i < sequence.length; i++) { - lastResult = sequence[i].execute(frame); + if (sequence.length == 0) { + return RNull.instance; + } + for (int i = 0; i < sequence.length - 1; i++) { + sequence[i].voidExecute(frame); } - return lastResult; + return sequence[sequence.length - 1].execute(frame); } @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(getSourceSection(), "{", true); + @ExplodeLoop + public void voidExecute(VirtualFrame frame) { + for (int i = 0; i < sequence.length; i++) { + sequence[i].voidExecute(frame); + } } @Override diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BreakNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BreakNode.java index b67d1e9001cf5411667f9d1888debf22bbb0a30a..c7053bbd4ea54439f18b67503d060929b30a5392 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BreakNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BreakNode.java @@ -26,18 +26,15 @@ import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -public final class BreakNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { +public final class BreakNode extends OperatorNode { @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - public BreakNode(SourceSection src) { - super(src); + public BreakNode(SourceSection src, RSyntaxLookup operator) { + super(src, operator); } @Override @@ -46,11 +43,6 @@ public final class BreakNode extends RSourceSectionNode implements RSyntaxNode, throw BreakException.instance; } - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(getSourceSection(), "break", true); - } - @Override public RSyntaxElement[] getSyntaxArguments() { return new RSyntaxElement[0]; 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 05abe8628f9a81a7951d99649c812789b49708c9..a49df510c76974fc52e10326fd8dee4d8a4af14b 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 @@ -53,8 +53,11 @@ public final class ForNode extends AbstractLoopNode implements RSyntaxNode, RSyn @Child private LoopNode loopNode; @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - private ForNode(SourceSection src, WriteVariableNode cvar, RNode range, RNode body) { - super(src); + private final RSyntaxLookup var; + + public ForNode(SourceSection src, RSyntaxLookup operator, RSyntaxLookup var, RNode range, RNode body) { + super(src, operator); + this.var = var; String indexName = AnonymousFrameVariable.create("FOR_INDEX"); String rangeName = AnonymousFrameVariable.create("FOR_RANGE"); String lengthName = AnonymousFrameVariable.create("FOR_LENGTH"); @@ -62,11 +65,7 @@ public final class ForNode extends AbstractLoopNode implements RSyntaxNode, RSyn this.writeIndexNode = WriteVariableNode.createAnonymous(indexName, null, Mode.REGULAR); this.writeRangeNode = WriteVariableNode.createAnonymous(rangeName, range, Mode.REGULAR); this.writeLengthNode = WriteVariableNode.createAnonymous(lengthName, RLengthNodeGen.create(ReadVariableNode.create(rangeName)), Mode.REGULAR); - this.loopNode = Truffle.getRuntime().createLoopNode(new ForRepeatingNode(this, cvar, body, indexName, lengthName, rangeName)); - } - - public static ForNode create(SourceSection src, WriteVariableNode cvar, RSyntaxNode range, RSyntaxNode body) { - return new ForNode(src, cvar, range.asRNode(), body.asRNode()); + this.loopNode = Truffle.getRuntime().createLoopNode(new ForRepeatingNode(this, var.getIdentifier(), body, indexName, lengthName, rangeName)); } @Override @@ -91,19 +90,17 @@ public final class ForNode extends AbstractLoopNode implements RSyntaxNode, RSyn @Child private ReadVariableNode readIndexNode; @Child private ReadVariableNode readLengthNode; @Child private WriteVariableNode writeIndexNode; - @Child private RNode loadElement; private final ForNode forNode; - ForRepeatingNode(ForNode forNode, WriteVariableNode cvar, RNode body, String indexName, String lengthName, String rangeName) { + ForRepeatingNode(ForNode forNode, String var, RNode body, String indexName, String lengthName, String rangeName) { this.forNode = forNode; - this.writeElementNode = cvar; + this.writeElementNode = WriteVariableNode.createAnonymous(var, createIndexedLoad(indexName, rangeName), Mode.REGULAR, false); this.body = body; this.readIndexNode = ReadVariableNode.create(indexName); this.readLengthNode = ReadVariableNode.create(lengthName); this.writeIndexNode = WriteVariableNode.createAnonymous(indexName, null, Mode.REGULAR); - this.loadElement = createIndexedLoad(indexName, rangeName); // pre-initialize the profile so that loop exits to not deoptimize conditionProfile.profile(false); } @@ -128,7 +125,7 @@ public final class ForNode extends AbstractLoopNode implements RSyntaxNode, RSyn } try { if (conditionProfile.profile(index <= length)) { - writeElementNode.execute(frame, loadElement.execute(frame)); + writeElementNode.execute(frame); body.execute(frame); return true; } else { @@ -151,16 +148,10 @@ public final class ForNode extends AbstractLoopNode implements RSyntaxNode, RSyn } } - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(getSourceSection(), "for", true); - } - @Override public RSyntaxElement[] getSyntaxArguments() { ForRepeatingNode repeatingNode = (ForRepeatingNode) loopNode.getRepeatingNode(); - return new RSyntaxElement[]{RSyntaxLookup.createDummyLookup(null, (String) repeatingNode.writeElementNode.getName(), false), writeRangeNode.getRhs().asRSyntaxNode(), - repeatingNode.body.asRSyntaxNode()}; + return new RSyntaxElement[]{var, writeRangeNode.getRhs().asRSyntaxNode(), repeatingNode.body.asRSyntaxNode()}; } @Override diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/IfNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/IfNode.java index a5d40486f43afdf2c4d364d4754ce7303185411b..fd5b395b0c86e0fb1294dc8e1eb97ee1b91fcff6 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/IfNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/IfNode.java @@ -33,13 +33,11 @@ import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.nodes.RNode; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -public final class IfNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { +public final class IfNode extends OperatorNode { @Child private ConvertBooleanNode condition; @Child private RNode thenPart; @@ -48,18 +46,13 @@ public final class IfNode extends RSourceSectionNode implements RSyntaxNode, RSy private final ConditionProfile conditionProfile = ConditionProfile.createCountingProfile(); - private IfNode(SourceSection src, RSyntaxNode condition, RSyntaxNode thenPart, RSyntaxNode elsePart) { - super(src); + public IfNode(SourceSection src, RSyntaxLookup operator, RSyntaxNode condition, RSyntaxNode thenPart, RSyntaxNode elsePart) { + super(src, operator); this.condition = ConvertBooleanNode.create(condition); this.thenPart = thenPart.asRNode(); this.elsePart = elsePart == null ? null : elsePart.asRNode(); } - public static IfNode create(SourceSection src, RSyntaxNode condition, RSyntaxNode thenPart, RSyntaxNode elsePart) { - IfNode ifNode = new IfNode(src, condition, thenPart, elsePart == null ? null : elsePart); - return ifNode; - } - /** * Result visibility of an {@code if} expression is not only a property of the {@code if} * builtin; it also depends on whether there is an else branch or not, and on the condition. For @@ -104,11 +97,6 @@ public final class IfNode extends RSourceSectionNode implements RSyntaxNode, RSy return elsePart; } - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(getSourceSection(), "if", true); - } - @Override public RSyntaxElement[] getSyntaxArguments() { if (elsePart == null) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/NextNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/NextNode.java index d4fb2410e75e0820607a984d10c7e7b449fd1335..23872a96c246e60327d74176d8ffd06ec7d85b7f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/NextNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/NextNode.java @@ -26,18 +26,15 @@ import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -public final class NextNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { +public final class NextNode extends OperatorNode { @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - public NextNode(SourceSection src) { - super(src); + public NextNode(SourceSection src, RSyntaxLookup operator) { + super(src, operator); } @Override @@ -46,11 +43,6 @@ public final class NextNode extends RSourceSectionNode implements RSyntaxNode, R throw NextException.instance; } - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(getSourceSection(), "next", true); - } - @Override public RSyntaxElement[] getSyntaxArguments() { return new RSyntaxElement[0]; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableNodeSyntaxHelper.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/OperatorNode.java similarity index 65% rename from com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableNodeSyntaxHelper.java rename to com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/OperatorNode.java index c4f971adbcda4916979281c244805db4f243a535..9a85a3d6f4c391e35186e9bc7be639f3f75ea92c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/WriteVariableNodeSyntaxHelper.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/OperatorNode.java @@ -20,25 +20,25 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package com.oracle.truffle.r.nodes.access; +package com.oracle.truffle.r.nodes.control; -import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.source.SourceSection; +import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; +import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; +import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; +import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -abstract class WriteVariableNodeSyntaxHelper extends WriteVariableNode { - @CompilationFinal private SourceSection sourceSectionR; +public abstract class OperatorNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { - protected WriteVariableNodeSyntaxHelper(SourceSection sourceSection) { - assert sourceSection != null; - this.sourceSectionR = sourceSection; - } + protected final RSyntaxLookup operator; - public void setSourceSection(SourceSection sourceSection) { - this.sourceSectionR = sourceSection; + public OperatorNode(SourceSection src, RSyntaxLookup operator) { + super(src); + this.operator = operator; } @Override - public SourceSection getSourceSection() { - return sourceSectionR; + public final RSyntaxLookup getSyntaxLHS() { + return operator; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/RepeatNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/RepeatNode.java index f6b12ee59f61eee0051a23b02e2986072e0bde8d..92ce06b4c24e3db3584d91b6b47bce1c02d58301 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/RepeatNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/RepeatNode.java @@ -43,15 +43,11 @@ public final class RepeatNode extends AbstractLoopNode implements RSyntaxNode, R @Child private LoopNode loop; @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - private RepeatNode(SourceSection src, RSyntaxNode body) { - super(src); + public RepeatNode(SourceSection src, RSyntaxLookup operator, RSyntaxNode body) { + super(src, operator); this.loop = Truffle.getRuntime().createLoopNode(new WhileRepeatingNode(this, body.asRNode())); } - public static RepeatNode create(SourceSection src, RSyntaxNode body) { - return new RepeatNode(src, body); - } - @Override public Object execute(VirtualFrame frame) { loop.executeLoop(frame); @@ -95,11 +91,6 @@ public final class RepeatNode extends AbstractLoopNode implements RSyntaxNode, R } } - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(getSourceSection(), "repeat", true); - } - @Override public RSyntaxElement[] getSyntaxArguments() { return new RSyntaxElement[]{((WhileRepeatingNode) loop.getRepeatingNode()).body.asRSyntaxNode()}; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java index 24a8116b92f459a8bbdb39b0b06d458b28795f4e..656bb60251dcb3dce02e777cbf5a03097e58f4ad 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementDispatchNode.java @@ -32,15 +32,14 @@ import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.nodes.RASTUtils; -import com.oracle.truffle.r.nodes.access.RemoveAndAnswerNode; import com.oracle.truffle.r.nodes.access.WriteVariableNode; +import com.oracle.truffle.r.nodes.access.WriteVariableSyntaxNode; import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode; -import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.data.RLanguage; import com.oracle.truffle.r.runtime.data.RNull; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; +import com.oracle.truffle.r.runtime.nodes.RNode; import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; import com.oracle.truffle.r.runtime.nodes.RSyntaxConstant; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; @@ -53,59 +52,44 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; * created lazily. Moreover, we use 'special' fast-path version of replacement where possible with * fallback to generic implementation. */ -public final class ReplacementDispatchNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { +public final class ReplacementDispatchNode extends OperatorNode { - @Child private ReplacementNode replacementNode; + // these are only @Child to make instrumentation work + @Child private RNode lhs; + @Child private RNode rhs; - @Child private WriteVariableNode storeRhs; - @Child private RemoveAndAnswerNode removeRhs; - @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - - private final String operator; - private final RSyntaxNode lhs; private final boolean isSuper; - private final String rhsName; private final int tempNamesStartIndex; - public ReplacementDispatchNode(SourceSection src, String operator, RSyntaxNode lhs, RSyntaxNode rhs, boolean isSuper, int tempNamesStartIndex) { - super(src); - assert "<-".equals(operator) || "<<-".equals(operator) || "=".equals(operator); + public ReplacementDispatchNode(SourceSection src, RSyntaxLookup operator, RSyntaxNode lhs, RSyntaxNode rhs, boolean isSuper, int tempNamesStartIndex) { + super(src, operator); assert lhs != null && rhs != null; - rhsName = "*rhs*" + tempNamesStartIndex; - storeRhs = WriteVariableNode.createAnonymous(rhsName, rhs.asRNode(), WriteVariableNode.Mode.INVISIBLE); - removeRhs = RemoveAndAnswerNode.create(rhsName); - this.operator = operator; - this.lhs = lhs; + this.lhs = lhs.asRNode(); + this.rhs = rhs.asRNode(); this.isSuper = isSuper; this.tempNamesStartIndex = tempNamesStartIndex; } @Override public Object execute(VirtualFrame frame) { - storeRhs.execute(frame); - getReplacementNode().execute(frame); - Object result = removeRhs.execute(frame); - visibility.execute(frame, false); - return result; - } - - /** - * Support for syntax tree visitor. - */ - public RSyntaxNode getLhs() { - return lhs; + CompilerDirectives.transferToInterpreterAndInvalidate(); + return create(false).execute(frame); } - /** - * Support for syntax tree visitor. - */ - public RSyntaxNode getRhs() { - return storeRhs.getRhs().asRSyntaxNode(); + @Override + public void voidExecute(VirtualFrame frame) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + create(true).voidExecute(frame); } - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(null, operator, true); + public RNode create(boolean isVoid) { + RNode replacement; + if (lhs instanceof RSyntaxCall) { + replacement = createReplacementNode(isVoid); + } else { + replacement = new WriteVariableSyntaxNode(getLazySourceSection(), operator, lhs.asRSyntaxNode(), rhs, isSuper); + } + return replace(replacement); } @Override @@ -115,18 +99,10 @@ public final class ReplacementDispatchNode extends RSourceSectionNode implements @Override public RSyntaxElement[] getSyntaxArguments() { - return new RSyntaxElement[]{lhs, storeRhs.getRhs().asRSyntaxNode()}; - } - - private ReplacementNode getReplacementNode() { - if (replacementNode == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - replacementNode = insert(createReplacementNode()); - } - return replacementNode; + return new RSyntaxElement[]{lhs.asRSyntaxNode(), rhs.asRSyntaxNode()}; } - private ReplacementNode createReplacementNode() { + private ReplacementNode createReplacementNode(boolean isVoid) { CompilerAsserts.neverPartOfCompilation(); /* @@ -134,7 +110,7 @@ public final class ReplacementDispatchNode extends RSourceSectionNode implements * "a(...)" and "b(...)". */ List<RSyntaxCall> calls = new ArrayList<>(); - RSyntaxElement current = lhs; + RSyntaxElement current = lhs.asRSyntaxNode(); while (!(current instanceof RSyntaxLookup)) { if (!(current instanceof RSyntaxCall)) { if (current instanceof RSyntaxConstant && ((RSyntaxConstant) current).getValue() == RNull.instance) { @@ -154,14 +130,14 @@ public final class ReplacementDispatchNode extends RSourceSectionNode implements } RSyntaxLookup variable = (RSyntaxLookup) current; ReadVariableNode varRead = createReplacementForVariableUsing(variable, isSuper); - return ReplacementNodeGen.create(getSourceSection(), calls, rhsName, variable.getIdentifier(), isSuper, tempNamesStartIndex, varRead); + return ReplacementNode.create(getLazySourceSection(), operator, varRead, lhs.asRSyntaxNode(), rhs, calls, variable.getIdentifier(), isSuper, tempNamesStartIndex, isVoid); } private static ReadVariableNode createReplacementForVariableUsing(RSyntaxLookup var, boolean isSuper) { if (isSuper) { - return ReadVariableNode.createSuperLookup(var.getSourceSection(), var.getIdentifier()); + return ReadVariableNode.createSuperLookup(var.getLazySourceSection(), var.getIdentifier()); } else { - return ReadVariableNode.create(var.getSourceSection(), var.getIdentifier(), true); + return ReadVariableNode.create(var.getLazySourceSection(), var.getIdentifier(), true); } } @@ -173,10 +149,10 @@ public final class ReplacementDispatchNode extends RSourceSectionNode implements RSyntaxCall call = (RSyntaxCall) e; // check for syntax nodes as this will be required to recreate a call during // replacement form construction in createFunctionUpdate - if (call.getSyntaxLHS() instanceof RSyntaxLookup && call.getSyntaxLHS() instanceof RSyntaxNode) { + if (call.getSyntaxLHS() instanceof RSyntaxLookup) { if (((RSyntaxLookup) call.getSyntaxLHS()).getIdentifier().equals("::")) { RSyntaxElement[] args = call.getSyntaxArguments(); - if (args.length == 2 && args[0] instanceof RSyntaxLookup && args[0] instanceof RSyntaxNode && args[1] instanceof RSyntaxLookup && args[1] instanceof RSyntaxNode) { + if (args.length == 2 && args[0] instanceof RSyntaxLookup && args[1] instanceof RSyntaxLookup) { return true; } } @@ -198,43 +174,4 @@ public final class ReplacementDispatchNode extends RSourceSectionNode implements } return null; } - - /** - * Used by the parser for assignments that miss a left hand side. This node will raise an error - * once executed. - */ - public static final class LHSError extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { - - private final String operator; - private final RSyntaxElement lhs; - private final RSyntaxElement rhs; - - public LHSError(SourceSection sourceSection, String operator, RSyntaxElement lhs, RSyntaxElement rhs) { - super(sourceSection); - this.operator = operator; - this.lhs = lhs; - this.rhs = rhs; - } - - @Override - public Object execute(VirtualFrame frame) { - CompilerDirectives.transferToInterpreter(); - throw RError.error(this, RError.Message.INVALID_LHS, "do_set"); - } - - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(null, operator, true); - } - - @Override - public RSyntaxElement[] getSyntaxArguments() { - return new RSyntaxElement[]{lhs, rhs}; - } - - @Override - public ArgumentsSignature getSyntaxSignature() { - return ArgumentsSignature.empty(2); - } - } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java index d4c2e4381e467e8aa18fb638aa443c1a178f957d..1e0d45dfc2e5aa3d9ca3f66eb0c9cb9367680a62 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java @@ -27,9 +27,7 @@ import java.util.ArrayList; import java.util.List; import com.oracle.truffle.api.CompilerAsserts; -import com.oracle.truffle.api.dsl.Cached; -import com.oracle.truffle.api.dsl.NodeChild; -import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.dsl.TypeSystemReference; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.ExplodeLoop; @@ -41,12 +39,14 @@ import com.oracle.truffle.r.nodes.access.WriteVariableNode; import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode; import com.oracle.truffle.r.nodes.function.RCallSpecialNode; import com.oracle.truffle.r.nodes.function.RCallSpecialNode.RecursiveSpecialBailout; +import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.nodes.unary.GetNonSharedNodeGen; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.builtins.RSpecialFactory.FullCallNeededException; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RLanguage; +import com.oracle.truffle.r.runtime.nodes.RCodeBuilder; import com.oracle.truffle.r.runtime.nodes.RCodeBuilder.CodeBuilderContext; import com.oracle.truffle.r.runtime.nodes.RNode; import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; @@ -54,70 +54,37 @@ import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -@NodeChild(value = "target") @TypeSystemReference(EmptyTypeSystemFlatLayout.class) -abstract class ReplacementNode extends RNode { - - private final int tempNamesStartIndex; - private final SourceSection source; - private final List<RSyntaxCall> calls; - private final String targetVarName; - private final String rhsVarName; - private final boolean isSuper; - - ReplacementNode(SourceSection source, List<RSyntaxCall> calls, String rhsVarName, String targetVarName, boolean isSuper, int tempNamesStartIndex) { - this.source = source; - this.calls = calls; - this.rhsVarName = rhsVarName; - this.targetVarName = targetVarName; - this.isSuper = isSuper; - this.tempNamesStartIndex = tempNamesStartIndex; - } - - @Specialization - protected Object doRObject(VirtualFrame frame, Object target, - @Cached("createTargetTmpWrite()") WriteVariableNode targetTmpWrite, - @Cached("createTargetTmpRemove()") RemoveAndAnswerNode targetTmpRemove, - @Cached("createTargetWrite()") WriteVariableNode targetWrite, - @Cached("createReplacementNode()") ReplacementBase replacement) { - targetTmpWrite.execute(frame, target); - replacement.execute(frame); - targetWrite.execute(frame, targetTmpRemove.execute(frame)); - return null; - } - - protected final WriteVariableNode createTargetTmpWrite() { - return WriteVariableNode.createAnonymous(getTargetTmpName(), null, WriteVariableNode.Mode.INVISIBLE); - } +abstract class ReplacementNode extends OperatorNode { - protected final WriteVariableNode createTargetWrite() { - return WriteVariableNode.createAnonymous(targetVarName, null, WriteVariableNode.Mode.INVISIBLE, isSuper); - } - - protected final RemoveAndAnswerNode createTargetTmpRemove() { - return RemoveAndAnswerNode.create(getTargetTmpName()); - } + protected final RSyntaxElement lhs; - protected final ReplacementBase createReplacementNode() { - return createReplacementNode(true); + ReplacementNode(SourceSection source, RSyntaxLookup operator, RSyntaxElement lhs) { + super(source, operator); + this.lhs = lhs; } - private RNode createReplacementNodeWithoutSpecials() { - return createReplacementNode(false); - } - - private ReplacementBase createReplacementNode(boolean useSpecials) { + public static ReplacementNode create(SourceSection source, RSyntaxLookup operator, RNode target, RSyntaxElement lhs, RNode rhs, List<RSyntaxCall> calls, + String targetVarName, boolean isSuper, int tempNamesStartIndex, boolean isVoid) { CompilerAsserts.neverPartOfCompilation(); // Note: if specials are turned off in FastR, onlySpecials will never be true - boolean createSpecial = hasOnlySpecialCalls() && useSpecials; - return createSpecial ? createSpecialReplacement(source, calls) : createGenericReplacement(source, calls); + boolean createSpecial = hasOnlySpecialCalls(calls); + if (createSpecial) { + if (isVoid) { + return new SpecialVoidReplacementNode(source, operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex); + } else { + return new SpecialReplacementNode(source, operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex); + } + } else { + return new GenericReplacementNode(source, operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex); + } } - private String getTargetTmpName() { + private static String getTargetTmpName(int tempNamesStartIndex) { return "*tmp*" + tempNamesStartIndex; } - private boolean hasOnlySpecialCalls() { + private static boolean hasOnlySpecialCalls(List<RSyntaxCall> calls) { for (int i = 0; i < calls.size(); i++) { if (!(calls.get(i) instanceof RCallSpecialNode)) { return false; @@ -126,72 +93,20 @@ abstract class ReplacementNode extends RNode { return true; } - /** - * Creates a replacement that consists only of {@link RCallSpecialNode} calls. - */ - private SpecialReplacementNode createSpecialReplacement(SourceSection source, List<RSyntaxCall> calls) { - CodeBuilderContext codeBuilderContext = new CodeBuilderContext(tempNamesStartIndex + 2); - RNode extractFunc = ReadVariableNode.create(getTargetTmpName()); - for (int i = calls.size() - 1; i >= 1; i--) { - extractFunc = createSpecialFunctionQuery(extractFunc.asRSyntaxNode(), calls.get(i), codeBuilderContext); - } - RNode updateFunc = createFunctionUpdate(source, extractFunc.asRSyntaxNode(), ReadVariableNode.create(rhsVarName), calls.get(0), codeBuilderContext); - assert updateFunc instanceof RCallSpecialNode : "should be only specials"; - return new SpecialReplacementNode((RCallSpecialNode) updateFunc); - } - - /** - * When there are more than two function calls in LHS, then we save some function calls by - * saving the intermediate results into temporary variables and reusing them. - */ - private GenericReplacementNode createGenericReplacement(SourceSection source, List<RSyntaxCall> calls) { - List<RNode> instructions = new ArrayList<>(); - CodeBuilderContext codeBuilderContext = new CodeBuilderContext(tempNamesStartIndex + calls.size() + 1); - - /* - * Create the calls that extract inner components - only needed for complex replacements - * like "a(b(x)) <- z" (where we would extract "b(x)"). The extracted values are saved into - * temporary variables *tmp*{index} indexed from tempNamesIndex to (tempNamesIndex + - * calls.size()-1), the first such temporary variable holds the "target" of the replacement, - * 'x' in our example (the assignment from 'x' is not done in this loop). - */ - for (int i = calls.size() - 1, tmpIndex = 0; i >= 1; i--, tmpIndex++) { - ReadVariableNode newLhs = ReadVariableNode.create("*tmp*" + (tempNamesStartIndex + tmpIndex)); - RNode update = createSpecialFunctionQuery(newLhs, calls.get(i), codeBuilderContext); - instructions.add(WriteVariableNode.createAnonymous("*tmp*" + (tempNamesStartIndex + tmpIndex + 1), update, WriteVariableNode.Mode.INVISIBLE)); - } - /* - * Create the update calls, for "a(b(x)) <- z", this would be `a<-` and `b<-`, the - * intermediate results are stored to temporary variables *tmpr*{index}. - */ - for (int i = 0; i < calls.size(); i++) { - int tmpIndex = tempNamesStartIndex + calls.size() - i - 1; - String tmprName = i == 0 ? rhsVarName : "*tmpr*" + (tempNamesStartIndex + i - 1); - RNode update = createFunctionUpdate(source, ReadVariableNode.create("*tmp*" + tmpIndex), ReadVariableNode.create(tmprName), calls.get(i), codeBuilderContext); - if (i < calls.size() - 1) { - instructions.add(WriteVariableNode.createAnonymous("*tmpr*" + (tempNamesStartIndex + i), update, WriteVariableNode.Mode.INVISIBLE)); - } else { - instructions.add(WriteVariableNode.createAnonymous(getTargetTmpName(), update, WriteVariableNode.Mode.REGULAR)); - } - } - - GenericReplacementNode newReplacementNode = new GenericReplacementNode(instructions); - return newReplacementNode; - } - /** * Creates a call that looks like {@code fun} but has the first argument replaced with * {@code newLhs}. */ - private static RNode createSpecialFunctionQuery(RSyntaxNode newLhs, RSyntaxCall fun, CodeBuilderContext codeBuilderContext) { + private static RNode createSpecialFunctionQuery(RSyntaxCall fun, RSyntaxNode newFirstArg, CodeBuilderContext codeBuilderContext) { + RCodeBuilder<RSyntaxNode> builder = RContext.getASTBuilder(); RSyntaxElement[] arguments = fun.getSyntaxArguments(); RSyntaxNode[] argNodes = new RSyntaxNode[arguments.length]; for (int i = 0; i < arguments.length; i++) { - argNodes[i] = i == 0 ? newLhs : process(arguments[i], codeBuilderContext); + argNodes[i] = i == 0 ? newFirstArg : builder.process(arguments[i], codeBuilderContext); } - return RCallSpecialNode.createCallInReplace(fun.getSourceSection(), process(fun.getSyntaxLHS(), codeBuilderContext).asRNode(), fun.getSyntaxSignature(), argNodes).asRNode(); + return RCallSpecialNode.createCallInReplace(fun.getLazySourceSection(), builder.process(fun.getSyntaxLHS(), codeBuilderContext).asRNode(), fun.getSyntaxSignature(), argNodes, 0).asRNode(); } /** @@ -200,6 +115,7 @@ abstract class ReplacementNode extends RNode { * added to the arguments list. */ private static RNode createFunctionUpdate(SourceSection source, RSyntaxNode newLhs, RSyntaxNode rhs, RSyntaxCall fun, CodeBuilderContext codeBuilderContext) { + RCodeBuilder<RSyntaxNode> builder = RContext.getASTBuilder(); RSyntaxElement[] arguments = fun.getSyntaxArguments(); ArgumentsSignature signature = fun.getSyntaxSignature(); @@ -207,7 +123,7 @@ abstract class ReplacementNode extends RNode { String[] names = new String[argNodes.length]; for (int i = 0; i < arguments.length; i++) { names[i] = signature.getName(i); - argNodes[i] = i == 0 ? newLhs : process(arguments[i], codeBuilderContext); + argNodes[i] = i == 0 ? newLhs : builder.process(arguments[i], codeBuilderContext); } argNodes[argNodes.length - 1] = rhs; names[argNodes.length - 1] = "value"; @@ -222,67 +138,178 @@ abstract class ReplacementNode extends RNode { // to work properly argNodes[0] = GetNonSharedNodeGen.create(argNodes[0].asRNode()); } - newSyntaxLHS = lookup(lookupLHS.getSourceSection(), symbol + "<-", true); + newSyntaxLHS = builder.lookup(lookupLHS.getLazySourceSection(), symbol + "<-", true); } else { // data types (and lengths) are verified in isNamespaceLookupCall RSyntaxCall callLHS = (RSyntaxCall) syntaxLHS; RSyntaxElement[] oldArgs = callLHS.getSyntaxArguments(); RSyntaxNode[] newArgs = new RSyntaxNode[2]; newArgs[0] = (RSyntaxNode) oldArgs[0]; - newArgs[1] = lookup(oldArgs[1].getSourceSection(), ((RSyntaxLookup) oldArgs[1]).getIdentifier() + "<-", true); - newSyntaxLHS = RCallSpecialNode.createCall(callLHS.getSourceSection(), ((RSyntaxNode) callLHS.getSyntaxLHS()).asRNode(), callLHS.getSyntaxSignature(), newArgs); + newArgs[1] = builder.lookup(oldArgs[1].getLazySourceSection(), ((RSyntaxLookup) oldArgs[1]).getIdentifier() + "<-", true); + newSyntaxLHS = RCallSpecialNode.createCall(callLHS.getLazySourceSection(), ((RSyntaxNode) callLHS.getSyntaxLHS()).asRNode(), callLHS.getSyntaxSignature(), newArgs); } - return RCallSpecialNode.createCall(source, newSyntaxLHS.asRNode(), ArgumentsSignature.get(names), argNodes).asRNode(); - } - - private static RSyntaxNode process(RSyntaxElement original, CodeBuilderContext codeBuilderContext) { - return RContext.getASTBuilder().process(original, codeBuilderContext); - } - - private static RSyntaxNode lookup(SourceSection source, String symbol, boolean functionLookup) { - return RContext.getASTBuilder().lookup(source, symbol, functionLookup); + return RCallSpecialNode.createCallInReplace(source, newSyntaxLHS.asRNode(), ArgumentsSignature.get(names), argNodes, 0, argNodes.length - 1).asRNode(); } static RLanguage getLanguage(WriteVariableNode wvn) { Node parent = wvn.getParent(); - if (parent instanceof ReplacementBase) { - Node replacementBlock = ((ReplacementBase) parent).getReplacementNodeParent().getParent(); - assert replacementBlock instanceof ReplacementDispatchNode; - return RDataFactory.createLanguage((RNode) replacementBlock); + if (parent instanceof ReplacementNode) { + return RDataFactory.createLanguage((ReplacementNode) parent); } return null; } + private abstract static class ReplacementWithRhsNode extends ReplacementNode { + + @Child private WriteVariableNode storeRhs; + @Child private RemoveAndAnswerNode removeRhs; + @Child private SetVisibilityNode visibility; + + protected final RNode rhs; + + ReplacementWithRhsNode(SourceSection source, RSyntaxLookup operator, RSyntaxElement lhs, RNode rhs, int tempNamesStartIndex) { + super(source, operator, lhs); + this.rhs = rhs; + + this.storeRhs = WriteVariableNode.createAnonymous("*rhs*" + tempNamesStartIndex, rhs, WriteVariableNode.Mode.INVISIBLE); + this.removeRhs = RemoveAndAnswerNode.create("*rhs*" + tempNamesStartIndex); + } + + @Override + public final Object execute(VirtualFrame frame) { + storeRhs.execute(frame); + executeReplacement(frame); + try { + return removeRhs.execute(frame); + } finally { + if (visibility == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + visibility = insert(SetVisibilityNode.create()); + } + visibility.execute(frame, false); + } + } + + @Override + public final void voidExecute(VirtualFrame frame) { + storeRhs.execute(frame); + executeReplacement(frame); + removeRhs.execute(frame); + } + + protected final void voidExecuteWithRhs(VirtualFrame frame, Object rhsValue) { + storeRhs.execute(frame, rhsValue); + executeReplacement(frame); + removeRhs.execute(frame); + } + + protected abstract void executeReplacement(VirtualFrame frame); + + @Override + public final RSyntaxElement[] getSyntaxArguments() { + return new RSyntaxElement[]{lhs, rhs.asRSyntaxNode()}; + } + } + /** - * Base class for nodes implementing the actual replacement. + * Replacement that is made of only special calls, if one of the special calls falls back to + * full version, the replacement also falls back to {@link ReplacementNode}. */ - protected abstract static class ReplacementBase extends RNode { - protected final ReplacementNode getReplacementNodeParent() { - // Note: new DSL puts another node in between ReplacementBase instance and - // ReplacementNode, to be flexible we traverse the parents until we reach it - Node current = this; - do { - current = current.getParent(); - } while (!(current instanceof ReplacementNode)); - return (ReplacementNode) current; + private static final class SpecialReplacementNode extends ReplacementWithRhsNode { + + @Child private RCallSpecialNode replaceCall; + + private final List<RSyntaxCall> calls; + private final int tempNamesStartIndex; + private final boolean isSuper; + private final String targetVarName; + private final RNode target; + + SpecialReplacementNode(SourceSection source, RSyntaxLookup operator, RNode target, RSyntaxElement lhs, RNode rhs, List<RSyntaxCall> calls, String targetVarName, + boolean isSuper, int tempNamesStartIndex) { + super(source, operator, lhs, rhs, tempNamesStartIndex); + this.target = target; + this.calls = calls; + this.targetVarName = targetVarName; + this.isSuper = isSuper; + this.tempNamesStartIndex = tempNamesStartIndex; + + /* + * Creates a replacement that consists only of {@link RCallSpecialNode} calls. + */ + CodeBuilderContext codeBuilderContext = new CodeBuilderContext(tempNamesStartIndex + 2); + RNode extractFunc = target; + for (int i = calls.size() - 1; i >= 1; i--) { + extractFunc = createSpecialFunctionQuery(calls.get(i), extractFunc.asRSyntaxNode(), codeBuilderContext); + ((RCallSpecialNode) extractFunc).setPropagateFullCallNeededException(true); + } + this.replaceCall = (RCallSpecialNode) createFunctionUpdate(source, extractFunc.asRSyntaxNode(), ReadVariableNode.create("*rhs*" + tempNamesStartIndex), calls.get(0), codeBuilderContext); + this.replaceCall.setPropagateFullCallNeededException(true); + } + + @Override + protected void executeReplacement(VirtualFrame frame) { + try { + // Note: the very last call is the actual assignment, e.g. [[<-, if this call's + // argument is shared, it bails out. Moreover, if that call's argument is not + // shared, it could not be extracted from a shared container (list), so we should be + // OK with not calling any other update function and just update the value directly. + replaceCall.execute(frame); + } catch (FullCallNeededException | RecursiveSpecialBailout e) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + replace(new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex)).executeReplacement(frame); + } } } /** * Replacement that is made of only special calls, if one of the special calls falls back to - * full version, the replacement also falls back to {@link ReplacementNode}. + * full version, the replacement also falls back to {@link ReplacementNode}. Additionally, this + * type only works if the result of the call (the rhs) is not needed. */ - private static final class SpecialReplacementNode extends ReplacementBase { + private static final class SpecialVoidReplacementNode extends ReplacementNode { @Child private RCallSpecialNode replaceCall; - SpecialReplacementNode(RCallSpecialNode replaceCall) { - this.replaceCall = replaceCall; + private final RNode rhs; + private final List<RSyntaxCall> calls; + private final int tempNamesStartIndex; + private final boolean isSuper; + private final String targetVarName; + private final RNode target; + + SpecialVoidReplacementNode(SourceSection source, RSyntaxLookup operator, RNode target, RSyntaxElement lhs, RNode rhs, List<RSyntaxCall> calls, String targetVarName, + boolean isSuper, int tempNamesStartIndex) { + super(source, operator, lhs); + this.target = target; + this.rhs = rhs; + this.calls = calls; + this.targetVarName = targetVarName; + this.isSuper = isSuper; + this.tempNamesStartIndex = tempNamesStartIndex; + + /* + * Creates a replacement that consists only of {@link RCallSpecialNode} calls. + */ + CodeBuilderContext codeBuilderContext = new CodeBuilderContext(tempNamesStartIndex + 2); + RNode extractFunc = target; + for (int i = calls.size() - 1; i >= 1; i--) { + extractFunc = createSpecialFunctionQuery(calls.get(i), extractFunc.asRSyntaxNode(), codeBuilderContext); + ((RCallSpecialNode) extractFunc).setPropagateFullCallNeededException(true); + } + this.replaceCall = (RCallSpecialNode) createFunctionUpdate(source, extractFunc.asRSyntaxNode(), rhs.asRSyntaxNode(), calls.get(0), codeBuilderContext); this.replaceCall.setPropagateFullCallNeededException(true); } @Override public Object execute(VirtualFrame frame) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + GenericReplacementNode replacement = new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex); + return replace(replacement).execute(frame); + } + + @Override + public void voidExecute(VirtualFrame frame) { try { // Note: the very last call is the actual assignment, e.g. [[<-, if this call's // argument is shared, it bails out. Moreover, if that call's argument is not @@ -290,30 +317,90 @@ abstract class ReplacementNode extends RNode { // OK with not calling any other update function and just update the value directly. replaceCall.execute(frame); } catch (FullCallNeededException | RecursiveSpecialBailout e) { - RNode newReplacement = getReplacementNodeParent().createReplacementNodeWithoutSpecials(); - return replace(newReplacement).execute(frame); + CompilerDirectives.transferToInterpreterAndInvalidate(); + GenericReplacementNode replacement = replace(new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex)); + + Object rhsValue = e instanceof FullCallNeededException ? ((FullCallNeededException) e).rhsValue : ((RecursiveSpecialBailout) e).rhsValue; + if (rhsValue == null) { + // we haven't queried the rhs value yet + replacement.voidExecute(frame); + } else { + // rhs was already queried, so pass it along + replacement.voidExecuteWithRhs(frame, rhsValue); + } } - return null; + } + + @Override + public RSyntaxElement[] getSyntaxArguments() { + return new RSyntaxElement[]{lhs, rhs.asRSyntaxNode()}; } } /** * Holds the sequence of nodes created for R's replacement assignment. */ - private static final class GenericReplacementNode extends ReplacementBase { + private static final class GenericReplacementNode extends ReplacementWithRhsNode { + + @Child private WriteVariableNode targetTmpWrite; + @Child private RemoveAndAnswerNode targetTmpRemove; + @Children private final RNode[] updates; - GenericReplacementNode(List<RNode> updates) { - this.updates = updates.toArray(new RNode[updates.size()]); + GenericReplacementNode(SourceSection source, RSyntaxLookup operator, RNode target, RSyntaxElement lhs, RNode rhs, List<RSyntaxCall> calls, String targetVarName, boolean isSuper, + int tempNamesStartIndex) { + super(source, operator, lhs, rhs, tempNamesStartIndex); + /* + * When there are more than two function calls in LHS, then we save some function calls + * by saving the intermediate results into temporary variables and reusing them. + */ + List<RNode> instructions = new ArrayList<>(); + CodeBuilderContext codeBuilderContext = new CodeBuilderContext(tempNamesStartIndex + calls.size() + 1); + /* + * Create the calls that extract inner components - only needed for complex replacements + * like "a(b(x)) <- z" (where we would extract "b(x)"). The extracted values are saved + * into temporary variables *tmp*{index} indexed from tempNamesIndex to (tempNamesIndex + * + calls.size()-1), the first such temporary variable holds the "target" of the + * replacement, 'x' in our example (the assignment from 'x' is not done in this loop). + */ + for (int i = calls.size() - 1, tmpIndex = 0; i >= 1; i--, tmpIndex++) { + ReadVariableNode newFirstArg = ReadVariableNode.create("*tmp*" + (tempNamesStartIndex + tmpIndex)); + RNode update = createSpecialFunctionQuery(calls.get(i), newFirstArg, codeBuilderContext); + instructions.add(WriteVariableNode.createAnonymous("*tmp*" + (tempNamesStartIndex + tmpIndex + 1), update, WriteVariableNode.Mode.INVISIBLE)); + } + /* + * Create the update calls, for "a(b(x)) <- z", this would be `a<-` and `b<-`, the + * intermediate results are stored to temporary variables *tmpr*{index}. + */ + for (int i = 0; i < calls.size(); i++) { + int tmpIndex = tempNamesStartIndex + calls.size() - i - 1; + String tmprName = i == 0 ? ("*rhs*" + tempNamesStartIndex) : ("*tmpr*" + (tempNamesStartIndex + i - 1)); + RNode update = createFunctionUpdate(source, ReadVariableNode.create("*tmp*" + tmpIndex), ReadVariableNode.create(tmprName), calls.get(i), codeBuilderContext); + if (i < calls.size() - 1) { + instructions.add(WriteVariableNode.createAnonymous("*tmpr*" + (tempNamesStartIndex + i), update, WriteVariableNode.Mode.INVISIBLE)); + } else { + instructions.add(WriteVariableNode.createAnonymous(targetVarName, update, WriteVariableNode.Mode.REGULAR, isSuper)); + } + } + + this.updates = instructions.toArray(new RNode[instructions.size()]); + this.targetTmpWrite = WriteVariableNode.createAnonymous(getTargetTmpName(tempNamesStartIndex), target, WriteVariableNode.Mode.INVISIBLE); + this.targetTmpRemove = RemoveAndAnswerNode.create(getTargetTmpName(tempNamesStartIndex)); } @Override @ExplodeLoop - public Object execute(VirtualFrame frame) { + protected void executeReplacement(VirtualFrame frame) { + targetTmpWrite.execute(frame); for (RNode update : updates) { update.execute(frame); } - return null; + targetTmpRemove.execute(frame); } } + + @Override + public ArgumentsSignature getSyntaxSignature() { + return ArgumentsSignature.empty(2); + } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/WhileNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/WhileNode.java index 5677b4ac19f7f648c2e8c62a7fa9816e1a5f7251..81d1ab9c109262aae5a90c71522e23b423586835 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/WhileNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/WhileNode.java @@ -46,15 +46,11 @@ public final class WhileNode extends AbstractLoopNode implements RSyntaxNode, RS @Child private LoopNode loop; @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); - private WhileNode(SourceSection src, RSyntaxNode condition, RSyntaxNode body) { - super(src); + public WhileNode(SourceSection src, RSyntaxLookup operator, RSyntaxNode condition, RSyntaxNode body) { + super(src, operator); this.loop = Truffle.getRuntime().createLoopNode(new WhileRepeatingNode(this, ConvertBooleanNode.create(condition), body.asRNode())); } - public static WhileNode create(SourceSection src, RSyntaxNode condition, RSyntaxNode body) { - return new WhileNode(src, condition, body); - } - @Override public Object execute(VirtualFrame frame) { loop.executeLoop(frame); @@ -107,11 +103,6 @@ public final class WhileNode extends AbstractLoopNode implements RSyntaxNode, RS } } - @Override - public RSyntaxElement getSyntaxLHS() { - return RSyntaxLookup.createDummyLookup(getSourceSection(), "while", true); - } - @Override public RSyntaxElement[] getSyntaxArguments() { WhileRepeatingNode repeatingNode = (WhileRepeatingNode) loop.getRepeatingNode(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java index d78c49331b1e5e2f89f4e1376d71b45735c030e1..4a2c89ad48a62fc5debd7c6be8f4bb3ca2864f8e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionDefinitionNode.java @@ -55,6 +55,7 @@ import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RArguments.DispatchArgs; import com.oracle.truffle.r.runtime.RArguments.S3Args; import com.oracle.truffle.r.runtime.RArguments.S4Args; +import com.oracle.truffle.r.runtime.RDeparse; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RErrorHandling; import com.oracle.truffle.r.runtime.RInternalError; @@ -406,8 +407,14 @@ public final class FunctionDefinitionNode extends RRootNode implements RSyntaxNo this.sourceSectionR = sourceSection; } + @Override + public SourceSection getLazySourceSection() { + return sourceSectionR; + } + @Override public SourceSection getSourceSection() { + RDeparse.ensureSourceSection(this); return sourceSectionR; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java index f1985a8ee73a826c69650208581b73f3270f3377..c46789e565ff14114ae83507b1e84a267fab3d1d 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseNode.java @@ -317,6 +317,11 @@ public abstract class PromiseNode extends RNode { throw RInternalError.shouldNotReachHere(); } + @Override + public SourceSection getLazySourceSection() { + return RSyntaxNode.INTERNAL; + } + @Override public SourceSection getSourceSection() { /* diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java index b048eb9a5cb1bd50263f4d4e655e3b612a9510fb..d202fe1015cfe2a332ff77da078972284f3fecf1 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java @@ -120,8 +120,14 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS this.sourceSectionR = sourceSection; } + @Override + public final SourceSection getLazySourceSection() { + return sourceSectionR; + } + @Override public final SourceSection getSourceSection() { + RDeparse.ensureSourceSection(this); return sourceSectionR; } @@ -610,7 +616,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS for (int i = 0; i < args.length; i++) { args[i] = i < replacementArgs.length ? replacementArgs[i] : call.arguments[i]; } - return RCallNodeGen.create(call.getSourceSection(), args, call.signature, RASTUtils.cloneNode(call.getFunction())); + return RCallNodeGen.create(call.getLazySourceSection(), args, call.signature, RASTUtils.cloneNode(call.getFunction())); } /** @@ -618,11 +624,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS * {@code src == RSyntaxNode.EAGER_DEPARSE} we force a deparse. */ public static RCallNode createCall(SourceSection src, RNode function, ArgumentsSignature signature, RSyntaxNode... arguments) { - RCallNode call = RCallNodeGen.create(src, arguments, signature, new ForcePromiseNode(function)); - if (src == RSyntaxNode.EAGER_DEPARSE) { - RDeparse.ensureSourceSection(call); - } - return call; + return RCallNodeGen.create(src, arguments, signature, new ForcePromiseNode(function)); } public static RCallNode createExplicitCall(Object explicitArgsIdentifier) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java index ebdf2442aca958996f449690d8aefef563ca74f2..8259598aa45b9f78292eed86efc0d6672be9283c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallSpecialNode.java @@ -89,6 +89,11 @@ final class PeekLocalVariableNode extends RNode implements RSyntaxLookup { public boolean isFunctionLookup() { return false; } + + @Override + public SourceSection getLazySourceSection() { + return null; + } } public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode, RSyntaxCall { @@ -105,8 +110,14 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode this.sourceSectionR = sourceSection; } + @Override + public SourceSection getLazySourceSection() { + return sourceSectionR; + } + @Override public SourceSection getSourceSection() { + RDeparse.ensureSourceSection(this); return sourceSectionR; } @@ -133,37 +144,42 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode this.signature = signature; } - public static RSyntaxNode createCallInReplace(SourceSection sourceSection, RNode functionNode, ArgumentsSignature signature, RSyntaxNode[] arguments) { - return createCall(sourceSection, functionNode, signature, arguments, true); + /** + * This passes {@code true} for the isReplacement parameter and ignores the specified arguments, + * i.e., does not modify them in any way before passing it to + * {@link RSpecialFactory#create(ArgumentsSignature, RNode[], boolean)}. + */ + public static RSyntaxNode createCallInReplace(SourceSection sourceSection, RNode functionNode, ArgumentsSignature signature, RSyntaxNode[] arguments, int... ignoredArguments) { + return createCall(sourceSection, functionNode, signature, arguments, true, ignoredArguments); } public static RSyntaxNode createCall(SourceSection sourceSection, RNode functionNode, ArgumentsSignature signature, RSyntaxNode[] arguments) { return createCall(sourceSection, functionNode, signature, arguments, false); } - private static RSyntaxNode createCall(SourceSection sourceSection, RNode functionNode, ArgumentsSignature signature, RSyntaxNode[] arguments, boolean inReplace) { + private static RSyntaxNode createCall(SourceSection sourceSection, RNode functionNode, ArgumentsSignature signature, RSyntaxNode[] arguments, boolean inReplace, int... ignoredArguments) { RCallSpecialNode special = null; if (useSpecials) { - special = tryCreate(sourceSection, functionNode, signature, arguments, inReplace); + special = tryCreate(sourceSection, functionNode, signature, arguments, inReplace, ignoredArguments); } if (special != null) { - if (sourceSection == RSyntaxNode.EAGER_DEPARSE) { - RDeparse.ensureSourceSection(special); - } return special; } else { return RCallNode.createCall(sourceSection, functionNode, signature, arguments); } } - private static RCallSpecialNode tryCreate(SourceSection sourceSection, RNode functionNode, ArgumentsSignature signature, RSyntaxNode[] arguments, boolean inReplace) { + private static RCallSpecialNode tryCreate(SourceSection sourceSection, RNode functionNode, ArgumentsSignature signature, RSyntaxNode[] arguments, boolean inReplace, int[] ignoredArguments) { RSyntaxNode syntaxFunction = functionNode.asRSyntaxNode(); if (!(syntaxFunction instanceof RSyntaxLookup)) { // LHS is not a simple lookup -> bail out return null; } - for (RSyntaxNode argument : arguments) { - if (!(argument instanceof RSyntaxLookup || argument instanceof RSyntaxConstant || argument instanceof RCallSpecialNode)) { + for (int i = 0; i < arguments.length; i++) { + if (contains(ignoredArguments, i)) { + continue; + } + if (!(arguments[i] instanceof RSyntaxLookup || arguments[i] instanceof RSyntaxConstant || arguments[i] instanceof RCallSpecialNode)) { // argument is not a simple lookup or constant value or another special -> bail out return null; } @@ -181,14 +197,18 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode } RNode[] localArguments = new RNode[arguments.length]; for (int i = 0; i < arguments.length; i++) { - if (arguments[i] instanceof RSyntaxLookup) { - localArguments[i] = new PeekLocalVariableNode(((RSyntaxLookup) arguments[i]).getIdentifier()); - } else if (arguments[i] instanceof RSyntaxConstant) { - localArguments[i] = RContext.getASTBuilder().process(arguments[i]).asRNode(); - } else { - assert arguments[i] instanceof RCallSpecialNode; - ((RCallSpecialNode) arguments[i]).setArgumentIndex(i); + if (inReplace && contains(ignoredArguments, i)) { localArguments[i] = arguments[i].asRNode(); + } else { + if (arguments[i] instanceof RSyntaxLookup) { + localArguments[i] = new PeekLocalVariableNode(((RSyntaxLookup) arguments[i]).getIdentifier()); + } else if (arguments[i] instanceof RSyntaxConstant) { + localArguments[i] = RContext.getASTBuilder().process(arguments[i]).asRNode(); + } else { + assert arguments[i] instanceof RCallSpecialNode; + ((RCallSpecialNode) arguments[i]).setArgumentIndex(i); + localArguments[i] = arguments[i].asRNode(); + } } } RNode special = specialCall.create(signature, localArguments, inReplace); @@ -202,6 +222,15 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode return new RCallSpecialNode(sourceSection, functionNode, expectedFunction, arguments, signature, special); } + private static boolean contains(int[] ignoredArguments, int index) { + for (int i = 0; i < ignoredArguments.length; i++) { + if (ignoredArguments[i] == index) { + return true; + } + } + return false; + } + @Override public Object execute(VirtualFrame frame, Object function) { try { @@ -212,18 +241,18 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode return special.execute(frame); } catch (RecursiveSpecialBailout bailout) { CompilerDirectives.transferToInterpreterAndInvalidate(); - throwOnRecursiveSpecial(); + throwOnRecursiveSpecial(bailout.rhsValue); return replace(getRCallNode(rewriteSpecialArgument(bailout))).execute(frame, function); } catch (RSpecialFactory.FullCallNeededException e) { CompilerDirectives.transferToInterpreterAndInvalidate(); - throwOnRecursiveSpecial(); + throwOnRecursiveSpecial(e.rhsValue); return replace(getRCallNode()).execute(frame, function); } } - private void throwOnRecursiveSpecial() { + private void throwOnRecursiveSpecial(Object rhsValue) { if (isRecursiveSpecial()) { - throw new RecursiveSpecialBailout(argumentIndex); + throw new RecursiveSpecialBailout(argumentIndex, rhsValue); } } @@ -293,9 +322,11 @@ public final class RCallSpecialNode extends RCallBaseNode implements RSyntaxNode @SuppressWarnings("serial") public static final class RecursiveSpecialBailout extends RuntimeException { public final int argumentIndex; + public final Object rhsValue; - RecursiveSpecialBailout(int argumentIndex) { + RecursiveSpecialBailout(int argumentIndex, Object rhsValue) { this.argumentIndex = argumentIndex; + this.rhsValue = rhsValue; } @Override diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallerHelper.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallerHelper.java index d16b817a367f6b68725a7aefcb16ba29ef59aa49..e1902ab85e28fbf91f66c6036849514b7c6c7ddf 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallerHelper.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallerHelper.java @@ -101,7 +101,7 @@ public final class RCallerHelper { index++; } } - Object replacedFunction = function instanceof String ? ReadVariableNode.createFunctionLookup(RSyntaxNode.EAGER_DEPARSE, (String) function) : function; + Object replacedFunction = function instanceof String ? ReadVariableNode.createFunctionLookup(RSyntaxNode.LAZY_DEPARSE, (String) function) : function; syntaxNode = RASTUtils.createCall(replacedFunction, true, ArgumentsSignature.get(signature), syntaxArguments); } return syntaxNode; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/MissingNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/MissingNode.java index 34041c8e2888a2162e278d4475a8e01e3635b37f..750c38d7dd648f1acdf5f45de9d2b76cf0d0bceb 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/MissingNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/signature/MissingNode.java @@ -33,6 +33,7 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.nodes.access.variables.LocalReadVariableNode; +import com.oracle.truffle.r.nodes.control.OperatorNode; import com.oracle.truffle.r.nodes.function.GetMissingValueNode; import com.oracle.truffle.r.nodes.function.PromiseHelperNode; import com.oracle.truffle.r.nodes.function.RMissingHelper; @@ -45,13 +46,10 @@ import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames; import com.oracle.truffle.r.runtime.data.RPromise; import com.oracle.truffle.r.runtime.data.RPromise.PromiseState; -import com.oracle.truffle.r.runtime.nodes.RSourceSectionNode; -import com.oracle.truffle.r.runtime.nodes.RSyntaxCall; import com.oracle.truffle.r.runtime.nodes.RSyntaxElement; import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; -import com.oracle.truffle.r.runtime.nodes.RSyntaxNode; -public final class MissingNode extends RSourceSectionNode implements RSyntaxNode, RSyntaxCall { +public final class MissingNode extends OperatorNode { public abstract static class MissingCheckCache extends Node { @@ -178,12 +176,10 @@ public final class MissingNode extends RSourceSectionNode implements RSyntaxNode @Child private LocalReadVariableNode readVarArgs; private final ArgumentsSignature signature; - private final RSyntaxElement lhs; private final RSyntaxElement[] args; - public MissingNode(SourceSection source, RSyntaxElement lhs, ArgumentsSignature signature, RSyntaxElement[] args) { - super(source); - this.lhs = lhs; + public MissingNode(SourceSection source, RSyntaxLookup operator, ArgumentsSignature signature, RSyntaxElement[] args) { + super(source, operator); this.signature = signature; this.args = args; } @@ -220,11 +216,6 @@ public final class MissingNode extends RSourceSectionNode implements RSyntaxNode throw RInternalError.shouldNotReachHere(); } - @Override - public RSyntaxElement getSyntaxLHS() { - return lhs; - } - @Override public ArgumentsSignature getSyntaxSignature() { return signature; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/CollectGenericArgumentsNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/CollectGenericArgumentsNode.java index bb5239193c73069347742ef0da9b75e9563bcf80..9c9ffffb388f84c5819887d65e8721dc07ed7048 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/CollectGenericArgumentsNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/CollectGenericArgumentsNode.java @@ -37,6 +37,7 @@ import com.oracle.truffle.r.nodes.function.ClassHierarchyScalarNode; import com.oracle.truffle.r.nodes.function.ClassHierarchyScalarNodeGen; import com.oracle.truffle.r.nodes.function.PromiseHelperNode; import com.oracle.truffle.r.nodes.function.PromiseHelperNode.PromiseCheckHelperNode; +import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RPromise; @@ -82,7 +83,7 @@ public abstract class CollectGenericArgumentsNode extends RBaseNode { for (int i = 0; i < argReads.length; i++) { Object cachedId = argReads[i].getIdentifier(); String id = ((RSymbol) (arguments.getDataAt(i))).getName(); - assert cachedId instanceof String && cachedId == ((String) cachedId).intern() && id == id.intern(); + assert cachedId instanceof String && Utils.isInterned((String) cachedId) && Utils.isInterned(id); if (cachedId != id) { throw new SlowPathException(); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/GetNonSharedNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/GetNonSharedNode.java index b15d5556ee76210cfdb87d4af6be208289ea8fcb..9505d3897be12a924c419e3002310f3456922879 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/GetNonSharedNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/GetNonSharedNode.java @@ -64,6 +64,11 @@ public abstract class GetNonSharedNode extends RNode implements RSyntaxNode { throw RInternalError.shouldNotReachHere(); } + @Override + public SourceSection getLazySourceSection() { + return RSyntaxNode.INTERNAL; + } + @Override public SourceSection getSourceSection() { return RSyntaxNode.INTERNAL; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java index 1b5a016fd901447bcb8553800534dc14ed213a6b..aeec6146425d173a9004ff1e1e5de3a3d74edde7 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java @@ -124,7 +124,7 @@ public final class RArguments { public S3Args(String generic, Object clazz, Object method, MaterializedFrame callEnv, MaterializedFrame defEnv, String group) { super(generic, method); assert generic != null && callEnv != null : generic + " " + callEnv; - assert generic.intern() == generic; + assert Utils.isInterned(generic); this.clazz = clazz; this.callEnv = callEnv; this.defEnv = defEnv; 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 f5c923ca8423010c449c4e1b1947730c178d737c..81bedb07ca94d3596a40f79a3ad038db89f924f2 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 @@ -11,8 +11,6 @@ */ package com.oracle.truffle.r.runtime; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -229,8 +227,8 @@ public class RDeparse { * Ensure that {@code node} has a {@link SourceSection} by deparsing if necessary. */ public static void ensureSourceSection(RSyntaxElement node) { - SourceSection ss = node.getSourceSection(); - if (ss == RSyntaxNode.EAGER_DEPARSE) { + SourceSection ss = node.getLazySourceSection(); + if (ss == RSyntaxNode.LAZY_DEPARSE) { new DeparseVisitor(true, RDeparse.MAX_Cutoff, false, -1, 0, null).append(node).fixupSources(); } } @@ -523,20 +521,15 @@ public class RDeparse { } switch (info.kind) { case CURLY: - boolean braces = args.length != 1 || hasBraces(call); - if (braces) { - append("{", lhs); - try (C i = indent(); C c = inCurly()) { - for (RSyntaxElement statement : args) { - printline(); - append(statement); - } + append("{", lhs); + try (C i = indent(); C c = inCurly()) { + for (RSyntaxElement statement : args) { + printline(); + append(statement); } - printline(); - append('}'); - } else { - append(args[0]); } + printline(); + append('}'); return null; case SUBSET: if (args.length > 0) { @@ -570,16 +563,6 @@ public class RDeparse { return null; } - public boolean hasBraces(RSyntaxElement node) { - SourceSection ss = node.getSourceSection(); - if (ss == null || ss == RSyntaxNode.SOURCE_UNAVAILABLE) { - // this is statistical guess - return true; - } else { - return ss.getCode().startsWith("{"); - } - } - @Override @SuppressWarnings("try") protected Void visit(RSyntaxConstant constant) { @@ -671,7 +654,7 @@ public class RDeparse { if (c.getSyntaxLHS() instanceof RSyntaxLookup) { RSyntaxLookup l = (RSyntaxLookup) c.getSyntaxLHS(); if ("{".equals(l.getIdentifier())) { - newline = c.getSyntaxArguments().length == 1 && !hasBraces(c); + newline = false; } } } @@ -787,7 +770,7 @@ public class RDeparse { private static RSyntaxElement wrap(Object v, boolean isCallLHS) { Object value = RRuntime.asAbstractVector(v); if (value instanceof RSymbol) { - return RSyntaxLookup.createDummyLookup(null, ((RSymbol) value).getName(), isCallLHS); + return RSyntaxLookup.createDummyLookup(RSyntaxNode.INTERNAL, ((RSymbol) value).getName(), isCallLHS); } else if (value instanceof RLanguage) { return ((RLanguage) value).getRep().asRSyntaxNode(); } else if (value instanceof RPairList) { @@ -932,7 +915,7 @@ public class RDeparse { break; case REALSXP: double d = (double) element; - append(RRuntime.isNA(d) ? (singleElement ? "NA_real_" : "NA") : encodeReal(d)); + append(RRuntime.isNA(d) ? (singleElement ? "NA_real_" : "NA") : RContext.getRRuntimeASTAccess().encodeDouble(d)); break; case INTSXP: int i = (int) element; @@ -947,11 +930,7 @@ public class RDeparse { if (RRuntime.isNA(c)) { append((singleElement ? "NA_complex_" : "NA")); } else { - append(encodeReal(c.getRealPart())); - if (c.getImaginaryPart() >= 0) { - append('+'); - } - append(encodeReal(c.getImaginaryPart())).append('i'); + append(RContext.getRRuntimeASTAccess().encodeComplex(c)); } break; default: @@ -1086,39 +1065,6 @@ public class RDeparse { return new DeparseVisitor(false, cutoff, backtick, opts, nlines, null).process(expr).getContents(); } - // TODO: this should use the DoubleVectorPrinter - - private static final DecimalFormatSymbols decimalFormatSymbols; - private static final DecimalFormat decimalFormat; - private static final DecimalFormat simpleDecimalFormat; - - static { - decimalFormatSymbols = new DecimalFormatSymbols(); - decimalFormatSymbols.setExponentSeparator("e"); - decimalFormatSymbols.setNaN("NaN"); - decimalFormatSymbols.setInfinity("Inf"); - decimalFormat = new DecimalFormat("#.##################E0", decimalFormatSymbols); - simpleDecimalFormat = new DecimalFormat("#.##################", decimalFormatSymbols); - } - - private static String encodeReal(double x) { - double d = RRuntime.normalizeZero(x); - if (d == 0 || withinSimpleRealRange(d)) { - return simpleDecimalFormat.format(d); - } else { - String str = decimalFormat.format(d); - if (!str.contains("e-") && str.contains("e")) { - return str.replace("e", "e+"); - } else { - return str; - } - } - } - - private static boolean withinSimpleRealRange(double d) { - return (d > 0.0001 || d < -0.0001) && d < 100000 && d > -100000; - } - private static String quotify(String name, char qc) { if (isValidName(name) || name.length() == 0) { return name; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java index 8b082d88f35f86ed2c9f88c0631680d4b96c5cdc..db3d5c223ea2a3d048d1c06c8e9f4e46487d0262 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntimeASTAccess.java @@ -143,12 +143,6 @@ public interface RRuntimeASTAccess { Engine createEngine(RContext context); - /** - * Returns {@code null} if {@code node} is not an instance of {@code ReplacementNode}, else the - * lhs,rhs pair. - */ - RSyntaxNode[] isReplacementNode(Node node); - /** * Returns {@code true} iff {@code node} is an instance of {@code FunctionDefinitionNode}, which * is not visible from {@code runtime}, or {@code false} otherwise. diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSubstitute.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSubstitute.java index 2311952c672034262afba9cc3be67c3675ad88bd..21a0d9b77a7c50ebbcb146afdc853e096509ce1f 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSubstitute.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RSubstitute.java @@ -172,10 +172,6 @@ public class RSubstitute { @TruffleBoundary public static RSyntaxNode substitute(REnvironment env, RBaseNode node) { - RSyntaxNode substituted = substitute(RContext.getASTBuilder(), node.asRSyntaxNode(), env); - // create source for entire tree, this may be done lazily in the future - substituted.setSourceSection(RSyntaxNode.EAGER_DEPARSE); - RDeparse.ensureSourceSection(substituted); - return substituted; + return substitute(RContext.getASTBuilder(), node.asRSyntaxNode(), env); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java index 3e693cfc72fe03074163ea8e5beb33411a420228..d1a1a0b2098d1800ee8f43c0addb5f547be981d9 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java @@ -897,6 +897,10 @@ public final class Utils { return s.intern(); } + public static boolean isInterned(String s) { + return s == s.intern(); + } + @TruffleBoundary public static String toString(Object obj) { return obj.toString(); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/builtins/RSpecialFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/builtins/RSpecialFactory.java index d078aab5d1c6f57154a261b42cea87132f4bfbc9..f5646bc4ac1ea98599197cadd1458164d6bd4934 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/builtins/RSpecialFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/builtins/RSpecialFactory.java @@ -33,9 +33,26 @@ import com.oracle.truffle.r.runtime.nodes.RNode; * {@link #throwFullCallNeeded()} and the it will be replaced with call to the full blown built-in. */ public interface RSpecialFactory { + + /** + * Signals that the current special call cannot fulfill the requested action because of some + * restriction, and that the call should be rewritten to the generic call. This function must + * not be used if the rhs value of an update call was already computed - in this case, use the + * {@link #throwFullCallNeeded(Object)} function instead. + */ static FullCallNeededException throwFullCallNeeded() { CompilerDirectives.transferToInterpreterAndInvalidate(); - throw FullCallNeededException.INSTANCE; + throw new FullCallNeededException(null); + } + + /** + * Signals that the current special call cannot fulfill the requested action because of some + * restriction, and that the call should be rewritten to the generic call. This function must be + * used when a rhs value of an update call was already computed and must not be recomputed. + */ + static FullCallNeededException throwFullCallNeeded(Object rhsValue) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + throw new FullCallNeededException(rhsValue); } /** @@ -51,10 +68,11 @@ public interface RSpecialFactory { @SuppressWarnings("serial") final class FullCallNeededException extends RuntimeException { - private static RuntimeException INSTANCE = new FullCallNeededException(); - private FullCallNeededException() { - // singleton + public Object rhsValue; + + private FullCallNeededException(Object rhsValue) { + this.rhsValue = rhsValue; } @Override 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 b2c771cdee0e2be25ba77abd9b978c62d04e9d00..29c07ef768144d3c229eaf7d2fab6277a1b3f240 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 @@ -33,6 +33,7 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.CompilerDirectives.ValueType; import com.oracle.truffle.api.utilities.CyclicAssumption; +import com.oracle.truffle.r.runtime.Utils; /** * Provides the generic mechanism for associating attributes with a R object. It does no special @@ -161,7 +162,7 @@ public final class RAttributes implements Iterable<RAttributes.RAttribute> { @TruffleBoundary private static boolean isInterned(String name) { - assert name == name.intern() : name; + assert Utils.isInterned(name) : name; return true; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFactory.java index 1e913660559bcba80f69f54adfa20024f8881234..4530068e0a7e9e532dc892b7799500e9b2751c78 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFactory.java @@ -37,6 +37,7 @@ import com.oracle.truffle.r.runtime.FastROptions; import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RRuntime; +import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.builtins.RBuiltinDescriptor; import com.oracle.truffle.r.runtime.data.RPromise.Closure; import com.oracle.truffle.r.runtime.data.RPromise.EagerFeedback; @@ -393,7 +394,7 @@ public final class RDataFactory { } public static RSymbol createSymbol(String name) { - assert name == name.intern(); + assert Utils.isInterned(name); return traceDataCreated(new RSymbol(name)); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java index 68a6831e22872a16a63fddd7ee51a3f1b8df4d63..45eb98dceacf4427936a8021a8802062e44c5a97 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java @@ -132,31 +132,31 @@ public interface RCodeBuilder<T> { @Override protected T visit(RSyntaxCall element) { ArrayList<Argument<T>> args = createArguments(element.getSyntaxSignature(), element.getSyntaxArguments()); - return call(element.getSourceSection(), accept(element.getSyntaxLHS()), args); + return call(element.getLazySourceSection(), accept(element.getSyntaxLHS()), args); } private ArrayList<Argument<T>> createArguments(ArgumentsSignature signature, RSyntaxElement[] arguments) { ArrayList<Argument<T>> args = new ArrayList<>(arguments.length); for (int i = 0; i < arguments.length; i++) { - args.add(RCodeBuilder.argument(arguments[i] == null ? null : arguments[i].getSourceSection(), signature.getName(i), arguments[i] == null ? null : accept(arguments[i]))); + args.add(RCodeBuilder.argument(arguments[i] == null ? null : arguments[i].getLazySourceSection(), signature.getName(i), arguments[i] == null ? null : accept(arguments[i]))); } return args; } @Override protected T visit(RSyntaxConstant element) { - return constant(element.getSourceSection(), element.getValue()); + return constant(element.getLazySourceSection(), element.getValue()); } @Override protected T visit(RSyntaxLookup element) { - return lookup(element.getSourceSection(), element.getIdentifier(), element.isFunctionLookup()); + return lookup(element.getLazySourceSection(), element.getIdentifier(), element.isFunctionLookup()); } @Override protected T visit(RSyntaxFunction element) { ArrayList<Argument<T>> params = createArguments(element.getSyntaxSignature(), element.getSyntaxArgumentDefaults()); - return function(element.getSourceSection(), params, accept(element.getSyntaxBody()), element.getSyntaxDebugName()); + return function(element.getLazySourceSection(), params, accept(element.getSyntaxBody()), element.getSyntaxDebugName()); } }.accept(original); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java index f5ba98ae711c1c7666c33867a32e731d850ea38a..3150d973f414b378247a3e21ff430bdb95d87c4f 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RNode.java @@ -65,6 +65,15 @@ public abstract class RNode extends RBaseNode implements RInstrumentableNode { public abstract Object execute(VirtualFrame frame); + /** + * This function can be called when the result is not needed, and normally just dispatches to + * {@link #execute(VirtualFrame)}. Its name does not start with "execute" so that the DSL does + * not treat it like an execute function. + */ + public void voidExecute(VirtualFrame frame) { + execute(frame); + } + public int executeInteger(VirtualFrame frame) throws UnexpectedResultException { Object value = execute(frame); assert value != null; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSourceSectionNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSourceSectionNode.java index 0ae0193bf72daad9e99ba374b6e6f554492184a7..7290f797500c2bc0477406d7668649f24d4d60d0 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSourceSectionNode.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSourceSectionNode.java @@ -24,6 +24,7 @@ package com.oracle.truffle.r.runtime.nodes; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.source.SourceSection; +import com.oracle.truffle.r.runtime.RDeparse; /** * A subclass of {@link RNode} that carries {@link SourceSection}. Wherever possible, a node that @@ -35,21 +36,27 @@ public abstract class RSourceSectionNode extends RNode implements RSyntaxNode { /** * temp disambiguate for debugging until sourceSection removed from Node. */ - @CompilationFinal private SourceSection sourceSectionR; + @CompilationFinal private SourceSection sourceSection; protected RSourceSectionNode(SourceSection sourceSection) { assert sourceSection != null; - this.sourceSectionR = sourceSection; + this.sourceSection = sourceSection; } @Override public final void setSourceSection(SourceSection sourceSection) { assert sourceSection != null; - this.sourceSectionR = sourceSection; + this.sourceSection = sourceSection; + } + + @Override + public final SourceSection getLazySourceSection() { + return sourceSection; } @Override public final SourceSection getSourceSection() { - return sourceSectionR; + RDeparse.ensureSourceSection(this); + return sourceSection; } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxCall.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxCall.java index b035d784ae99196ca439daea6d425c4131c7c2e8..a4354d8371fedd5724f0cc11c85326069129ac68 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxCall.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxCall.java @@ -42,6 +42,11 @@ public interface RSyntaxCall extends RSyntaxElement { */ static RSyntaxCall createDummyCall(SourceSection originalSource, RSyntaxElement lhs, ArgumentsSignature signature, RSyntaxElement[] arguments) { return new RSyntaxCall() { + @Override + public SourceSection getLazySourceSection() { + return originalSource; + } + @Override public SourceSection getSourceSection() { return originalSource; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxConstant.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxConstant.java index 40a233293549515696f76dcbe0af3ac8c319486c..e3359606bf4a9ce18dcde1127301b7806d8dcf3c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxConstant.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxConstant.java @@ -37,6 +37,11 @@ public interface RSyntaxConstant extends RSyntaxElement { */ static RSyntaxConstant createDummyConstant(SourceSection originalSource, Object value) { return new RSyntaxConstant() { + @Override + public SourceSection getLazySourceSection() { + return originalSource; + } + @Override public SourceSection getSourceSection() { return originalSource; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxElement.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxElement.java index d6b65fa1eeceea5bbcc0dbc996c140d039d35143..685eb5f0975e71f2cf5aa99f82dcee122977c009 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxElement.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxElement.java @@ -23,6 +23,7 @@ package com.oracle.truffle.r.runtime.nodes; import com.oracle.truffle.api.source.SourceSection; +import com.oracle.truffle.r.runtime.RDeparse; /** * This is the base interface for all nodes in the tree of elements that make up an R closure. @@ -34,6 +35,13 @@ public interface RSyntaxElement { SourceSection getSourceSection(); + /** + * This is a special version of {@link #getSourceSection} that does not try to + * {@link RDeparse#ensureSourceSection(RSyntaxElement) deparse} {@link SourceSection}s that are + * {@link RSyntaxNode#INTERNAL internal}. + */ + SourceSection getLazySourceSection(); + void setSourceSection(SourceSection source); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java index 1b37f6154e5feb59ee5fe3fad70cf4ff24d527bc..0539766d5a960249d716461c4a4d59062ae389e7 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java @@ -44,6 +44,11 @@ public interface RSyntaxFunction extends RSyntaxElement { */ static RSyntaxFunction createDummyFunction(SourceSection originalSource, ArgumentsSignature signature, RSyntaxElement[] arguments, RSyntaxElement body, String debugName) { return new RSyntaxFunction() { + @Override + public SourceSection getLazySourceSection() { + return originalSource; + } + @Override public SourceSection getSourceSection() { return originalSource; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java index da9dde697b56976f26279fb8967153867df90f99..eb5d2c888e7a407358daeba35a65e647cd6d8008 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxLookup.java @@ -41,9 +41,13 @@ public interface RSyntaxLookup extends RSyntaxElement { * characters of the original source section (if non-null) will be used as the new source * section. */ - static RSyntaxLookup createDummyLookup(SourceSection originalSource, String identifier, boolean isFunctionLookup) { - SourceSection source = originalSource == null || originalSource.getCharEndIndex() == 0 ? null : originalSource.getSource().createSection(originalSource.getCharIndex(), 1); + static RSyntaxLookup createDummyLookup(SourceSection source, String identifier, boolean isFunctionLookup) { return new RSyntaxLookup() { + @Override + public SourceSection getLazySourceSection() { + return source; + } + @Override public SourceSection getSourceSection() { return source; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxNode.java index 6c98f726f1053574032828c8f8eaa7e476bc33db..2ed8a7f99907b25107218a805757e5d66879a10e 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxNode.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxNode.java @@ -25,7 +25,6 @@ package com.oracle.truffle.r.runtime.nodes; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.source.SourceSection; import com.oracle.truffle.r.runtime.RSource; -import com.oracle.truffle.r.runtime.context.RContext; /** * An interface that identifies an AST node as being part of the syntactic structure of the @@ -98,57 +97,4 @@ public interface RSyntaxNode extends RSyntaxElement { */ SourceSection LAZY_DEPARSE = RSource.createUnknown("lazy deparse"); - /** - * Indicates that, after creating the node, which requires a non-null {@link SourceSection} it - * should be created and updated by deparsing. This is generally used in specific situations, - * e.g., the {@code substitute} builtin. - */ - SourceSection EAGER_DEPARSE = RSource.createUnknown("eager deparse"); - - /* - * Every implementor of this interface must either inherit or directly implement the following - * methods. - */ - - @Override - SourceSection getSourceSection(); - - @Override - void setSourceSection(SourceSection sourceSection); - - /** - * Traverses the entire tree but only invokes the {@code visit} method for nodes that return - * {@code true} to {@code instanceof RSyntaxNode} and {@link #isSyntax()}. Similar therefore to - * {@code Node#accept}. Note that AST transformations can change the shape of the tree in - * drastic ways; in particular one cannot truncate the walk on encountering a non-syntax node, - * as the related {@link RSyntaxNode} may be have been transformed into a child of a non-syntax - * node. - * - * N.B. A {@code ReplacementNode} is a very special case as we don't want to visit the - * transformation denoted by the child nodes (which include syntax nodes), so we use the special - * lhs/rhs accessors and visit those. In some cases we don't want to visit the children at all, - * which is controlled by {@code visitReplacement}. - */ - static void accept(Node node, int depth, RSyntaxNodeVisitor nodeVisitor, boolean visitReplacement) { - boolean visitChildren = true; - int incDepth = 0; - if (RBaseNode.isRSyntaxNode(node)) { - RSyntaxNode syntaxNode = (RSyntaxNode) node; - visitChildren = nodeVisitor.visit(syntaxNode, depth); - incDepth = 1; - } - if (visitChildren) { - RSyntaxNode[] rnChildren = RContext.getRRuntimeASTAccess().isReplacementNode(node); - if (rnChildren == null) { - for (Node child : node.getChildren()) { - if (child != null) { - accept(child, depth + incDepth, nodeVisitor, visitReplacement); - } - } - } else if (visitReplacement) { - accept(rnChildren[0].asNode(), depth + incDepth, nodeVisitor, visitReplacement); - accept(rnChildren[1].asNode(), depth + incDepth, nodeVisitor, visitReplacement); - } - } - } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxNodeVisitor.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxNodeVisitor.java deleted file mode 100644 index adebfd053c25f011e3faf81053337ecd399cf8dd..0000000000000000000000000000000000000000 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxNodeVisitor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.truffle.r.runtime.nodes; - -import com.oracle.truffle.api.nodes.Node.Child; - -/** - * Visitor for the syntax nodes in the tree. This interface is intended for the Truffle - * instrumentation layer. - */ -public interface RSyntaxNodeVisitor { - /** - * This visitor method is called for every node in the tree that is considered part of the - * syntactic backbone. Its return value determines if the children of this node should be - * excluded in the iteration. - * - * N.B. The visit order for "child" nodes, e.g. annotated with {@link Child}, is - * non-deterministic. The only guarantee is that every "syntactic" child will be visited. - * - * @param node the node that is currently visited - * @param depth the current depth in the tree - * @return {@code true} if the children should be visited too, {@code false} otherwise - */ - boolean visit(RSyntaxNode node, int depth); - -} diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java index 35020edb31dad1de0b7614a60251a3451c5ffa53..d79719b63ea8d8b382b74ae6d3ef9baabcf49aac 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/instrumentation/RNodeWrapperFactory.java @@ -68,6 +68,18 @@ public final class RNodeWrapperFactory implements InstrumentableFactory<RNode> { } } + @Override + public void voidExecute(VirtualFrame frame) { + try { + probeNode.onEnter(frame); + delegate.voidExecute(frame); + probeNode.onReturnValue(frame, null); + } catch (Throwable t) { + probeNode.onReturnExceptional(frame, t); + throw t; + } + } + @Override public RSyntaxNode getRSyntaxNode() { return delegate.asRSyntaxNode(); 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 36e5685ffa2d0250d873c5685b2050f584cbc6af..ad7bb4866368061de942da405c079d5a6e2ab34c 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 @@ -675,7 +675,7 @@ Error in `Encoding<-`(`*tmp*`, value = "UTF-8") : #Im(NaN) [1] 0 -##com.oracle.truffle.r.test.builtins.TestBuiltin_Im.testIm#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_Im.testIm# #Im(c(NaN, 1+1i)) [1] 0 1 @@ -1226,7 +1226,7 @@ NAs introduced by coercion #Re(NaN) [1] NaN -##com.oracle.truffle.r.test.builtins.TestBuiltin_Re.testRe#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_Re.testRe# #Re(c(NaN, 1+1i)) [1] NaN 1 @@ -1585,7 +1585,7 @@ character(0) #{ abs(NULL) } Error in abs(NULL) : non-numeric argument to mathematical function -##com.oracle.truffle.r.test.builtins.TestBuiltin_abs.testAbs#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_abs.testAbs# #{ abs(c(0/0,1i)) } [1] NaN 1 @@ -1822,7 +1822,7 @@ Frequency = 1 [1,] 3.560925e-15 6.898148e-17 [2,] 3.383349e-16 1.774548e-17 -##com.oracle.truffle.r.test.builtins.TestBuiltin_abs.testabs8#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_abs.testabs8# #argv <- list(1e+07);abs(argv[[1]]); [1] 1e+07 @@ -5430,7 +5430,7 @@ character(0) [1] "list(\"x\")" [2] "list(\"an R object representing a hierarchical clustering.\\n\", \" For the default method, an object of class \", list(\"'\", list(\"hclust\"), \"'\"), \" or\\n\", \" with a method for \", list(list(\"as.hclust\"), \"()\"), \" such as\\n\", \" \", list(\"'\", list(\"agnes\"), \"'\"), \" in package \", c(\"\\\\href{http://CRAN.R-project.org/package=#1}{\\\\pkg{#1}}\", \"cluster\"), list(list(\"http://CRAN.R-project.org/package=cluster\"), list(list(\"cluster\"))), \".\")" -##com.oracle.truffle.r.test.builtins.TestBuiltin_ascharacter.testascharacter18#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_ascharacter.testascharacter18# #argv <- list(list(epsilon = 1e-08, maxit = 25, trace = FALSE));as.character(argv[[1]]); [1] "1e-08" "25" "FALSE" @@ -6807,7 +6807,7 @@ In matrix(c(1, 2, 3, 4), 3, 2) : [9,] 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i 0+1i [10,] NA NA NA NA NA NA NA NA NA NA -##com.oracle.truffle.r.test.builtins.TestBuiltin_asmatrix.testMatrix#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_asmatrix.testMatrix# #{ matrix(c(NaN,4+5i,2+0i,5+10i)) } [,1] [1,] NaN+ 0i @@ -7042,7 +7042,7 @@ name #as.vector(as.symbol('asdf'), 'symbol') asdf -##com.oracle.truffle.r.test.builtins.TestBuiltin_asvector.testAsVector#Ignored.Unimplemented# +##com.oracle.truffle.r.test.builtins.TestBuiltin_asvector.testAsVector# #as.vector(file('')) [1] 3 @@ -7650,7 +7650,7 @@ letters[1:3] [1] NA -##com.oracle.truffle.r.test.builtins.TestBuiltin_asvector.testasvector69#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_asvector.testasvector69# #argv <- list(c(200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 1e+05, 2e+05, 5e+05), 'any'); .Internal(as.vector(argv[[1]], argv[[2]])) [1] 2e+02 5e+02 1e+03 2e+03 5e+03 1e+04 2e+04 5e+04 1e+05 2e+05 5e+05 @@ -10356,7 +10356,7 @@ expression(1) #{ x<-expression(1); c(x,2) } expression(1, 2) -##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testCombineBroken#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testCombineBroken# #{ c(1i,0/0) } [1] 0+1i NaN+0i @@ -10575,7 +10575,7 @@ $condition #argv <- list(1944, 1944.75, 4);c(argv[[1]],argv[[2]],argv[[3]]); [1] 1944.00 1944.75 4.00 -##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testc3#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testc3# #argv <- list(0.1, 1e+60);c(argv[[1]],argv[[2]]); [1] 1e-01 1e+60 @@ -11263,7 +11263,7 @@ $perm.cond [1] 1 -##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testc73#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_c.testc73# #argv <- list(structure(list(coefficients = structure(c(-0.0529307911108286, -0.200175675120066), .Names = c('(Intercept)', 'xTRUE')), residuals = structure(c(0.196977726701894, -0.102864715594501, -1.21764591766838, -0.425219263997792, 0.671048026430597, 1.41161034263987, 0.150318738887899, 0.440602402670198, 0.19930142564799, -1.32412876571778), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')), effects = structure(c(0.483887391035467, -0.316505532770654, -1.29088865053614, -0.430233412486575, 0.597805293562832, 1.40659619415109, 0.0770760060201344, 0.435588254181415, 0.126058692780225, -1.32914291420656), .Names = c('(Intercept)', 'xTRUE', '', '', '', '', '', '', '', '')), rank = 2L), .Names = c('coefficients', 'residuals', 'effects', 'rank')), structure(list(fitted.values = structure(c(-0.253106466230895, -0.0529307911108286, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')), assign = 0:1, qr = structure(list(qr = structure(c(-3.16227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, -1.58113883008419, 1.58113883008419, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634), .Dim = c(10L, 2L), .Dimnames = list(c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'), c('(Intercept)', 'xTRUE')), assign = 0:1, contrasts = structure(list(x = 'contr.treatment'), .Names = 'x')), qraux = c(1.31622776601684, 1.39220245868163), pivot = 1:2, tol = 1e-07, rank = 2L), .Names = c('qr', 'qraux', 'pivot', 'tol', 'rank'), class = 'qr'), df.residual = 8L), .Names = c('fitted.values', 'assign', 'qr', 'df.residual')));c(argv[[1]],argv[[2]]); $coefficients (Intercept) xTRUE @@ -12357,7 +12357,7 @@ c 2 #argv <- list(structure(numeric(0), .Dim = c(0L, 0L)));ceiling(argv[[1]]); <0 x 0 matrix> -##com.oracle.truffle.r.test.builtins.TestBuiltin_ceiling.testceiling7#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_ceiling.testceiling7# #argv <- list(1e+05);ceiling(argv[[1]]); [1] 1e+05 @@ -13170,7 +13170,7 @@ attr(,"class") attr(,"class")attr(,"package") [1] ".GlobalEnv" -##com.oracle.truffle.r.test.builtins.TestBuiltin_clearPushBack.testclearPushBack1#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_clearPushBack.testclearPushBack1# #argv <- list(FALSE); .Internal(clearPushBack(argv[[1]])) ##com.oracle.truffle.r.test.builtins.TestBuiltin_cnoquote.testcnoquote1#Ignored.Unknown# @@ -13287,7 +13287,7 @@ Error in col(c(1, 2, 3)) : #{colMeans(matrix(c(NA,NaN,NaN,NA),ncol=2,nrow=2))} [1] NA NaN -##com.oracle.truffle.r.test.builtins.TestBuiltin_colMeans.testColMeans#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_colMeans.testColMeans# #{colMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = TRUE)} [1] 4.0+2.5i 3.5+5.0i @@ -15198,7 +15198,7 @@ integer overflow in 'cumsum'; use 'cumsum(as.numeric(.))' #{ cumsum(c(1+1i,2-3i,4+5i)) } [1] 1+1i 3-2i 7+3i -##com.oracle.truffle.r.test.builtins.TestBuiltin_cumsum.testCumulativeSum#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_cumsum.testCumulativeSum# #{ cumsum(c(1,0/0,5+1i)) } [1] 1+0i NaN+0i NaN+1i @@ -15210,7 +15210,7 @@ integer overflow in 'cumsum'; use 'cumsum(as.numeric(.))' #{ cumsum(c(1,2,3,0/0,5)) } [1] 1 3 6 NA NA -##com.oracle.truffle.r.test.builtins.TestBuiltin_cumsum.testCumulativeSum#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_cumsum.testCumulativeSum# #{ cumsum(c(1e308, 1e308, NA, 1, 2)) } [1] 1e+308 Inf NA NA NA @@ -15232,7 +15232,7 @@ integer overflow in 'cumsum'; use 'cumsum(as.numeric(.))' #{ cumsum(c(TRUE,FALSE,TRUE)) } [1] 1 1 2 -##com.oracle.truffle.r.test.builtins.TestBuiltin_cumsum.testCumulativeSum#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_cumsum.testCumulativeSum# #{ cumsum(rep(1e308, 3) ) } [1] 1e+308 Inf Inf @@ -15569,117 +15569,441 @@ Error in print(x, y) : [1] 2 ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#unserialize(serialize(quote(!(a <- TRUE)), NULL)) -!(a <- TRUE) +#deparse(-0) +[1] "0" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#unserialize(serialize(quote(a[a <- TRUE]), NULL)) -a[a <- TRUE] +#deparse(-0.0000000000000001) +[1] "-1e-16" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(-0) } -[1] "0" +#deparse(-0.0000000001) +[1] "-1e-10" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-0.00123) +[1] "-0.00123" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-0.1) +[1] "-0.1" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(-0L) } +#deparse(-0.123) +[1] "-0.123" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-0L) [1] "0L" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(-16L) } +#deparse(-1) +[1] "-1" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-1.545234523452345252523452345) +[1] "-1.54523452345235" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-1000) +[1] "-1000" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-10000) +[1] "-10000" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-100000000) +[1] "-1e+08" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-10000000000000) +[1] "-1e+13" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-16L) [1] "-16L" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(-17) } +#deparse(-17) [1] "-17" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(-199.1234+5.77i) } -[1] "-199.1234+5.77i" +#deparse(-199.1234-5i) +[1] "-199.1234-5i" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(-5i) } +#deparse(-5i) [1] "0-5i" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(0) } +#deparse(-99999) +[1] "-99999" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(-Inf) +[1] "-Inf" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(0) [1] "0" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(0L) } +#deparse(0.0000000000000001) +[1] "1e-16" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(0.0000000001) +[1] "1e-10" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(0.00123) +[1] "0.00123" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(0.1) +[1] "0.1" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(0.123) +[1] "0.123" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(0L) [1] "0L" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(16L) } +#deparse(1) +[1] "1" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse#Ignored.OutputFormatting# +#deparse(1.53160350210786e-322) +[1] "1.53160350210786e-322" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(1.545234523452345252523452345) +[1] "1.54523452345235" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(1000) +[1] "1000" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(10000) +[1] "10000" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(100000000) +[1] "1e+08" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(10000000000000) +[1] "1e+13" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(16L) [1] "16L" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(17) } +#deparse(17) [1] "17" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(199.1234-5i) } +#deparse(199.1234-5i) [1] "199.1234-5i" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(1:2) } +#deparse(1:2) [1] "1:2" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(1:6) } +#deparse(1:6) [1] "1:6" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(5i) } +#deparse(5i) [1] "0+5i" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(NA_character_) } +#deparse(99999) +[1] "99999" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(Inf) +[1] "Inf" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(NA_character_) [1] "NA_character_" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(NA_complex_) } +#deparse(NA_complex_) [1] "NA_complex_" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(NA_integer_) } +#deparse(NA_integer_) [1] "NA_integer_" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(NA_real_) } +#deparse(NA_real_) [1] "NA_real_" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(TRUE) } +#deparse(NaN) +[1] "NaN" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(TRUE) [1] "TRUE" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(c(-2L,-1L,0L,1L)) } +#deparse(c(-2L,-1L,0L,1L)) [1] "-2:1" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(c(1,2,3)) } +#deparse(c(1,2,3)) [1] "c(1, 2, 3)" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(c(1L,2L,3L)) } +#deparse(c(1L,2L,3L)) [1] "1:3" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(c(1L,2L,3L, NA_integer_)) } +#deparse(c(1L,2L,3L, NA_integer_)) [1] "c(1L, 2L, 3L, NA)" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(c(3L,2L,1L)) } +#deparse(c(3L,2L,1L)) [1] "c(3L, 2L, 1L)" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(c(NA_integer_, 1L,2L,3L)) } +#deparse(c(NA_integer_, 1L,2L,3L)) [1] "c(NA, 1L, 2L, 3L)" ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# -#{ deparse(c(T, F)) } +#deparse(c(T, F)) [1] "c(TRUE, FALSE)" +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-0))) +[1] "cat(-0)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-0.0000000000000001))) +[1] "cat(-1e-16)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-0.0000000001))) +[1] "cat(-1e-10)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-0.00123))) +[1] "cat(-0.00123)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-0.1))) +[1] "cat(-0.1)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-0.123))) +[1] "cat(-0.123)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-0L))) +[1] "cat(-0L)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-1))) +[1] "cat(-1)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-1.545234523452345252523452345))) +[1] "cat(-1.54523452345235)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-1000))) +[1] "cat(-1000)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-10000))) +[1] "cat(-10000)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-100000000))) +[1] "cat(-1e+08)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-10000000000000))) +[1] "cat(-1e+13)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-16L))) +[1] "cat(-16L)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-17))) +[1] "cat(-17)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse#Ignored.OutputFormatting# +#deparse(quote(cat(-199.1234-5i))) +[1] "cat(-199.1234 - (0+5i))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse#Ignored.OutputFormatting# +#deparse(quote(cat(-5i))) +[1] "cat(-(0+5i))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-99999))) +[1] "cat(-99999)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(-Inf))) +[1] "cat(-Inf)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(0))) +[1] "cat(0)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(0.0000000000000001))) +[1] "cat(1e-16)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(0.0000000001))) +[1] "cat(1e-10)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(0.00123))) +[1] "cat(0.00123)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(0.1))) +[1] "cat(0.1)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(0.123))) +[1] "cat(0.123)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(0L))) +[1] "cat(0L)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(1))) +[1] "cat(1)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(1.545234523452345252523452345))) +[1] "cat(1.54523452345235)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(1000))) +[1] "cat(1000)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(10000))) +[1] "cat(10000)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(100000000))) +[1] "cat(1e+08)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(10000000000000))) +[1] "cat(1e+13)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(16L))) +[1] "cat(16L)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(17))) +[1] "cat(17)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse#Ignored.OutputFormatting# +#deparse(quote(cat(199.1234-5i))) +[1] "cat(199.1234 - (0+5i))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(1:2))) +[1] "cat(1:2)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(1:6))) +[1] "cat(1:6)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(5i))) +[1] "cat(0+5i)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(99999))) +[1] "cat(99999)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(Inf))) +[1] "cat(Inf)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(NA_character_))) +[1] "cat(NA_character_)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(NA_complex_))) +[1] "cat(NA_complex_)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(NA_integer_))) +[1] "cat(NA_integer_)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(NA_real_))) +[1] "cat(NA_real_)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(NaN))) +[1] "cat(NaN)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(TRUE))) +[1] "cat(TRUE)" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(c(-2L,-1L,0L,1L)))) +[1] "cat(c(-2L, -1L, 0L, 1L))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(c(1,2,3)))) +[1] "cat(c(1, 2, 3))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(c(1L,2L,3L)))) +[1] "cat(c(1L, 2L, 3L))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(c(1L,2L,3L, NA_integer_)))) +[1] "cat(c(1L, 2L, 3L, NA_integer_))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(c(3L,2L,1L)))) +[1] "cat(c(3L, 2L, 1L))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(c(NA_integer_, 1L,2L,3L)))) +[1] "cat(c(NA_integer_, 1L, 2L, 3L))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#deparse(quote(cat(c(T, F)))) +[1] "cat(c(T, F))" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#unserialize(serialize(quote(!(a <- TRUE)), NULL)) +!(a <- TRUE) + +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# +#unserialize(serialize(quote(a[a <- TRUE]), NULL)) +a[a <- TRUE] + ##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testDeparse# #{ deparse(expression(a+b, c+d)) } [1] "expression(a + b, c + d)" @@ -15768,7 +16092,7 @@ a[a <- TRUE] #argv <- list(quote(`[.data.frame`(dd, , 'x')), 60L, TRUE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]])) [1] "`[.data.frame`(dd, , \"x\")" -##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testdeparse15#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testdeparse15# #argv <- list(1e-07, 60L, FALSE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]])) [1] "1e-07" @@ -15825,7 +16149,7 @@ a[a <- TRUE] [10] "13.8, 10.3, 10.3, 8, 12.6, 9.2, 10.3, 10.3, 16.6, 6.9, 13.2, " [11] "14.3, 8, 11.5)" -##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testdeparse25#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_deparse.testdeparse25# #argv <- list(1e+05, 60L, FALSE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]])) [1] "1e+05" @@ -20352,7 +20676,7 @@ null.deviance deviance [1,] "axx" " c" " e" " g" [2,] " b" " d" " f" " h" -##com.oracle.truffle.r.test.builtins.TestBuiltin_format.testformat40#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_format.testformat40# #argv <- list(1e-07, TRUE, NULL, 0L, NULL, 3L, TRUE, NA, "."); .Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]], argv[[9]])) [1] "1e-07" @@ -20423,7 +20747,7 @@ null.deviance deviance [1] NA NA NA NA [5] NA "Ripley" "Venables & Smith" -##com.oracle.truffle.r.test.builtins.TestBuiltin_format.testformat55#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_format.testformat55# #argv <- list(1e-11, FALSE, NULL, 0L, NULL, 3L, TRUE, NA, "."); .Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]], argv[[9]])) [1] "1e-11" @@ -22523,7 +22847,7 @@ Error in intToBits(list(c(5, 5, 7, 8), 88, 6L)) : Error in intToBits(new.env()) : environments cannot be coerced to other types -##com.oracle.truffle.r.test.builtins.TestBuiltin_intToBits.testintToBits#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_intToBits.testintToBits# #intToBits(stdout()) [1] 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [26] 00 00 00 00 00 00 00 @@ -22848,7 +23172,7 @@ Levels: a.b.c a.b.b.c a.c #argv <- list(structure(2L, class = c('terminal', 'connection')), 0L); .Internal(isOpen(argv[[1]], argv[[2]])) [1] TRUE -##com.oracle.truffle.r.test.builtins.TestBuiltin_isOpen.testisOpen3#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_isOpen.testisOpen3# #argv <- list(FALSE, 2L); .Internal(isOpen(argv[[1]], argv[[2]])) [1] FALSE @@ -25086,8 +25410,8 @@ logical(0) [1] FALSE ##com.oracle.truffle.r.test.builtins.TestBuiltin_isnull.testisnull16#Ignored.Unknown# -#argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { initPSandPDFfonts() new <- list() if (!missing(width)) new$width <- width if (!missing(height)) new$height <- height if (!missing(onefile)) new$onefile <- onefile if (!missing(title)) new$title <- title if (!missing(fonts)) new$fonts <- fonts if (!missing(version)) new$version <- version if (!missing(paper)) new$paper <- paper if (!missing(encoding)) new$encoding <- encoding if (!missing(bg)) new$bg <- bg if (!missing(fg)) new$fg <- fg if (!missing(pointsize)) new$pointsize <- pointsize if (!missing(pagecentre)) new$pagecentre <- pagecentre if (!missing(colormodel)) new$colormodel <- colormodel if (!missing(useDingbats)) new$useDingbats <- useDingbats if (!missing(useKerning)) new$useKerning <- useKerning if (!missing(fillOddEven)) new$fillOddEven <- fillOddEven if (!missing(compress)) new$compress <- compress old <- check.options(new, name.opt = '.PDF.Options', envir = .PSenv) if (!missing(family) && (inherits(family, 'Type1Font') || inherits(family, 'CIDFont'))) { enc <- family$encoding if (inherits(family, 'Type1Font') && !is.null(enc) && enc != 'default' && (is.null(old$encoding) || old$encoding == 'default')) old$encoding <- enc family <- family$metrics } if (is.null(old$encoding) || old$encoding == 'default') old$encoding <- guessEncoding() if (!missing(family)) { if (length(family) == 4L) { family <- c(family, 'Symbol.afm') } else if (length(family) == 5L) { } else if (length(family) == 1L) { pf <- pdfFonts(family)[[1L]] if (is.null(pf)) stop(gettextf('unknown family '%s'', family), domain = NA) matchFont(pf, old$encoding) } else stop('invalid 'family' argument') old$family <- family } version <- old$version versions <- c('1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '2.0') if (version %in% versions) version <- as.integer(strsplit(version, '[.]')[[1L]]) else stop('invalid PDF version') onefile <- old$onefile if (!checkIntFormat(file)) stop(gettextf('invalid 'file' argument '%s'', file), domain = NA) .External(C_PDF, file, old$paper, old$family, old$encoding, old$bg, old$fg, old$width, old$height, old$pointsize, onefile, old$pagecentre, old$title, old$fonts, version[1L], version[2L], old$colormodel, old$useDingbats, old$useKerning, old$fillOddEven, old$compress) invisible()});do.call('is.null', argv) -Error: unexpected symbol in " ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, use" +#argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { invisible() });do.call('is.null', argv) +[1] FALSE ##com.oracle.truffle.r.test.builtins.TestBuiltin_isnull.testisnull2# #argv <- list(structure(c(NA, NA, 159.125, 204, 221.25, 245.125, 319.75, 451.5, 561.125, 619.25, 615.625, 548, 462.125, 381.125, 316.625, 264, 228.375, 210.75, 188.375, 199, 207.125, 191, 166.875, 72, -9.25, -33.125, -36.75, 36.25, 103, 131.625, NA, NA), .Tsp = c(1951, 1958.75, 4), class = 'ts'));is.null(argv[[1]]); @@ -26270,9 +26594,9 @@ NULL #argv <- list(list(structure(list(srcfile = c('/home/lzhao/tmp/RtmpYl9n1I/R.INSTALL2aa24b6697e5/MASS/R/rlm.R', '/home/lzhao/tmp/RtmpYl9n1I/R.INSTALL2aa24b6697e5/MASS/R/rlm.R'), frow = 122:123, lrow = 122:123), .Names = c('srcfile', 'frow', 'lrow'), row.names = 1:2, class = 'data.frame'), structure(list(srcfile = '/home/lzhao/tmp/RtmpYl9n1I/R.INSTALL2aa24b6697e5/MASS/R/rlm.R', frow = 124L, lrow = 124L), .Names = c('srcfile', 'frow', 'lrow'), row.names = c(NA, -1L), class = 'data.frame')));length(argv[[1]]); [1] 2 -##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength3#Ignored.Unknown# -#argv <- list(structure(' \'Le français, c'est façile: Règles, Liberté, Egalité, Fraternité...\')\n', Rd_tag = 'RCODE'));length(argv[[1]]); -Error: unexpected symbol in "argv <- list(structure(' \'Le français, c'est" +##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength3# +#argv <- list(structure(' \'Le français, cest façile: Règles, Liberté, Egalité, Fraternité...\')\n', Rd_tag = 'RCODE'));length(argv[[1]]); +[1] 1 ##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength30# #argv <- list(structure(list(Df = c(NA, 1, 1, 1), `Sum of Sq` = c(NA, 820.907401534698, 26.7893827563485, 9.93175377572661), RSS = c(47.9727294003871, 868.880130935086, 74.7621121567356, 57.9044831761137), AIC = c(24.9738836085411, 60.6293256496563, 28.7417044039189, 25.4199908988691)), .Names = c('Df', 'Sum of Sq', 'RSS', 'AIC'), row.names = c('<none>', '- x1', '- x2', '- x4'), class = c('anova', 'data.frame')));length(argv[[1]]); @@ -26298,9 +26622,9 @@ Error: unexpected symbol in "argv <- list(structure(' \'Le français, c'est" #argv <- list(structure(c(-1, 0, 1, 2, 3), .Tsp = c(-1, 3, 1)));length(argv[[1]]); [1] 5 -##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength37#Ignored.Unknown# -#argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { initPSandPDFfonts() new <- list() if (!missing(width)) new$width <- width if (!missing(height)) new$height <- height if (!missing(onefile)) new$onefile <- onefile if (!missing(title)) new$title <- title if (!missing(fonts)) new$fonts <- fonts if (!missing(version)) new$version <- version if (!missing(paper)) new$paper <- paper if (!missing(encoding)) new$encoding <- encoding if (!missing(bg)) new$bg <- bg if (!missing(fg)) new$fg <- fg if (!missing(pointsize)) new$pointsize <- pointsize if (!missing(pagecentre)) new$pagecentre <- pagecentre if (!missing(colormodel)) new$colormodel <- colormodel if (!missing(useDingbats)) new$useDingbats <- useDingbats if (!missing(useKerning)) new$useKerning <- useKerning if (!missing(fillOddEven)) new$fillOddEven <- fillOddEven if (!missing(compress)) new$compress <- compress old <- check.options(new, name.opt = '.PDF.Options', envir = .PSenv) if (!missing(family) && (inherits(family, 'Type1Font') || inherits(family, 'CIDFont'))) { enc <- family$encoding if (inherits(family, 'Type1Font') && !is.null(enc) && enc != 'default' && (is.null(old$encoding) || old$encoding == 'default')) old$encoding <- enc family <- family$metrics } if (is.null(old$encoding) || old$encoding == 'default') old$encoding <- guessEncoding() if (!missing(family)) { if (length(family) == 4L) { family <- c(family, 'Symbol.afm') } else if (length(family) == 5L) { } else if (length(family) == 1L) { pf <- pdfFonts(family)[[1L]] if (is.null(pf)) stop(gettextf('unknown family '%s'', family), domain = NA) matchFont(pf, old$encoding) } else stop('invalid 'family' argument') old$family <- family } version <- old$version versions <- c('1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '2.0') if (version %in% versions) version <- as.integer(strsplit(version, '[.]')[[1L]]) else stop('invalid PDF version') onefile <- old$onefile if (!checkIntFormat(file)) stop(gettextf('invalid 'file' argument '%s'', file), domain = NA) .External(C_PDF, file, old$paper, old$family, old$encoding, old$bg, old$fg, old$width, old$height, old$pointsize, onefile, old$pagecentre, old$title, old$fonts, version[1L], version[2L], old$colormodel, old$useDingbats, old$useKerning, old$fillOddEven, old$compress) invisible()});do.call('length', argv) -Error: unexpected symbol in " ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, use" +##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength37# +#argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { invisible()}); do.call('length', argv) +[1] 1 ##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength4# #argv <- list(structure(list(a = 6:10), .Names = 'a', row.names = 6:10, class = 'data.frame'));length(argv[[1]]); @@ -26310,9 +26634,9 @@ Error: unexpected symbol in " ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), #argv <- list(structure(list(`log(x)` = c(0, 0.693147180559945, 1.09861228866811, 1.38629436111989, 1.6094379124341, 1.79175946922805, 1.94591014905531, 2.07944154167984, 2.19722457733622, 2.30258509299405, 2.39789527279837, 2.484906649788, 2.56494935746154, 2.63905732961526, 2.70805020110221, 2.77258872223978, 2.83321334405622, 2.89037175789616, 2.94443897916644, 2.99573227355399, 3.04452243772342, 3.09104245335832, 3.13549421592915, 3.17805383034795, 3.2188758248682, 3.25809653802148, 3.29583686600433, 3.3322045101752, 3.36729582998647, 3.40119738166216, 3.43398720448515, 3.46573590279973, 3.49650756146648, 3.52636052461616, 3.55534806148941, 3.58351893845611, 3.61091791264422, 3.63758615972639, 3.66356164612965, 3.68887945411394, 3.71357206670431, 3.73766961828337, 3.76120011569356, 3.78418963391826, 3.80666248977032, 3.8286413964891, 3.85014760171006, 3.87120101090789, 3.89182029811063, 3.91202300542815, 3.93182563272433, 3.95124371858143, 3.97029191355212, 3.98898404656427, 4.00733318523247, 4.02535169073515, 4.04305126783455, 4.06044301054642, 4.07753744390572, 4.0943445622221, 4.11087386417331, 4.12713438504509, 4.14313472639153, 4.15888308335967, 4.17438726989564, 4.18965474202643, 4.20469261939097, 4.21950770517611, 4.23410650459726, 4.24849524204936, 4.26267987704132, 4.27666611901606, 4.29045944114839, 4.30406509320417, 4.31748811353631, 4.33073334028633, 4.34380542185368, 4.35670882668959, 4.36944785246702, 4.38202663467388, 4.39444915467244, 4.40671924726425, 4.4188406077966, 4.43081679884331, 4.44265125649032, 4.45434729625351, 4.46590811865458, 4.47733681447821, 4.48863636973214, 4.49980967033027, 4.51085950651685, 4.52178857704904, 4.53259949315326, 4.54329478227, 4.55387689160054, 4.56434819146784, 4.57471097850338, 4.58496747867057, 4.59511985013459, 4.60517018598809), `log(z)` = c(2.39789527279837, 2.484906649788, 2.56494935746154, 2.63905732961526, 2.70805020110221, 2.77258872223978, 2.83321334405622, 2.89037175789616, 2.94443897916644, 2.99573227355399, 3.04452243772342, 3.09104245335832, 3.13549421592915, 3.17805383034795, 3.2188758248682, 3.25809653802148, 3.29583686600433, 3.3322045101752, 3.36729582998647, 3.40119738166216, 3.43398720448515, 3.46573590279973, 3.49650756146648, 3.52636052461616, 3.55534806148941, 3.58351893845611, 3.61091791264422, 3.63758615972639, 3.66356164612965, 3.68887945411394, 3.71357206670431, 3.73766961828337, 3.76120011569356, 3.78418963391826, 3.80666248977032, 3.8286413964891, 3.85014760171006, 3.87120101090789, 3.89182029811063, 3.91202300542815, 3.93182563272433, 3.95124371858143, 3.97029191355212, 3.98898404656427, 4.00733318523247, 4.02535169073515, 4.04305126783455, 4.06044301054642, 4.07753744390572, 4.0943445622221, 4.11087386417331, 4.12713438504509, 4.14313472639153, 4.15888308335967, 4.17438726989564, 4.18965474202643, 4.20469261939097, 4.21950770517611, 4.23410650459726, 4.24849524204936, 4.26267987704132, 4.27666611901606, 4.29045944114839, 4.30406509320417, 4.31748811353631, 4.33073334028633, 4.34380542185368, 4.35670882668959, 4.36944785246702, 4.38202663467388, 4.39444915467244, 4.40671924726425, 4.4188406077966, 4.43081679884331, 4.44265125649032, 4.45434729625351, 4.46590811865458, 4.47733681447821, 4.48863636973214, 4.49980967033027, 4.51085950651685, 4.52178857704904, 4.53259949315326, 4.54329478227, 4.55387689160054, 4.56434819146784, 4.57471097850338, 4.58496747867057, 4.59511985013459, 4.60517018598809, 4.61512051684126, 4.62497281328427, 4.63472898822964, 4.64439089914137, 4.65396035015752, 4.66343909411207, 4.67282883446191, 4.68213122712422, 4.69134788222914, 4.70048036579242)), .Names = c('log(x)', 'log(z)'), class = 'data.frame', row.names = c(NA, 100L), terms = quote(~log(x) + log(z))));length(argv[[1]]); [1] 2 -##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength6#Ignored.Unknown# -#argv <- list(list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cook's distance', 'Residuals vs Leverage', expression('Cook's dist vs Leverage ' * h[ii]/(1 - h[ii]))));length(argv[[1]]); -Error: unexpected symbol in "argv <- list(list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cook's" +##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength6# +#argv <- list(list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cooks distance', 'Residuals vs Leverage', expression('Cooks dist vs Leverage ' * h[ii]/(1 - h[ii]))));length(argv[[1]]); +[1] 6 ##com.oracle.truffle.r.test.builtins.TestBuiltin_length.testlength7# #argv <- list(structure(list(sec = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), min = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), hour = c(20L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L, 19L, 19L, 19L, 20L, 20L, 20L, 19L, 20L, 19L, 19L, 19L, 20L), mday = c(30L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 30L, 30L, 30L, 30L, 31L, 31L, 31L, 30L, 30L, 30L, 31L, 30L, 31L, 31L, 31L, 30L), mon = c(5L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 5L, 5L, 5L, 5L, 11L, 11L, 11L, 5L, 5L, 5L, 11L, 5L, 11L, 11L, 11L, 5L), year = c(72L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 81L, 82L, 83L, 85L, 87L, 89L, 90L, 92L, 93L, 94L, 95L, 97L, 98L, 105L, 108L, 112L), wday = c(5L, 0L, 1L, 2L, 3L, 5L, 6L, 0L, 1L, 2L, 3L, 4L, 0L, 4L, 0L, 1L, 2L, 3L, 4L, 0L, 1L, 4L, 6L, 3L, 6L), yday = c(181L, 365L, 364L, 364L, 364L, 365L, 364L, 364L, 364L, 180L, 180L, 180L, 180L, 364L, 364L, 364L, 181L, 180L, 180L, 364L, 180L, 364L, 364L, 365L, 181L), isdst = c(1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 1L)), .Names = c('sec', 'min', 'hour', 'mday', 'mon', 'year', 'wday', 'yday', 'isdst'), class = c('POSIXlt', 'POSIXt'), tzone = c('', 'EST', 'EDT')));length(argv[[1]]); @@ -26525,7 +26849,7 @@ Error in lengths(quote(a)) : 'x' must be a list or atomic vector #{ x <- 1 ; levels(x)<-4.5; levels(x);} [1] 4.5 -##com.oracle.truffle.r.test.builtins.TestBuiltin_levels.testLevels#Output.IgnoreErrorContext# +##com.oracle.truffle.r.test.builtins.TestBuiltin_levels.testLevels# #{ x <- 1 ; levels(x)<-NULL; levels(notx)} Error in levels(notx) : object 'notx' not found @@ -26557,7 +26881,7 @@ NULL #{ x <- 5 ; levels(x)<-c(1,2,3); levels(x);} [1] 1 2 3 -##com.oracle.truffle.r.test.builtins.TestBuiltin_levels.testLevels#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_levels.testLevels# #{ x <- NULL; levels(x)<-"dog"; levels(x)} Error in levels(x) <- "dog" : attempt to set an attribute on NULL @@ -26767,7 +27091,7 @@ Levels: A B attr(,"levels") [1] FALSE -##com.oracle.truffle.r.test.builtins.TestBuiltin_levelsassign.testlevelsassign6#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_levelsassign.testlevelsassign6# #argv <- list(NULL, NULL);`levels<-`(argv[[1]],argv[[2]]); NULL @@ -27120,7 +27444,7 @@ $z [5] NA "Ripley" "Venables & Smith" -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist10#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist10#Output.IgnoreWhitespace# #argv <- list(linkfun = function (mu) .Call(C_logit_link, mu), linkinv = function (eta) .Call(C_logit_linkinv, eta), mu.eta = function (eta) .Call(C_logit_mu_eta, eta), valideta = function (eta) TRUE, name = 'logit');list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]]); [[1]] function (mu) @@ -27142,7 +27466,7 @@ TRUE [1] "logit" -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist11#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist11#Output.IgnoreWhitespace# #argv <- list(linkfun = function (mu) log(mu), linkinv = function (eta) pmax(exp(eta), .Machine$double.eps), mu.eta = function (eta) pmax(exp(eta), .Machine$double.eps), valideta = function (eta) TRUE, name = 'log');list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]]); [[1]] function (mu) @@ -27182,14 +27506,14 @@ TRUE <simpleError in `[.data.frame`(dd, , "x"): undefined columns selected> -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist14#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist14#Output.IgnoreWhitespace# #argv <- list(error = function (e) -1);list(argv[[1]]); [[1]] function (e) -1 -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist15#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist15#Ignored.OutputFormatting# #argv <- list(error = function (e) warning(gettextf('%s namespace cannot be unloaded:\n ', sQuote(pkgname)), conditionMessage(e), call. = FALSE, domain = NA));list(argv[[1]]); [[1]] function (e) @@ -27243,7 +27567,7 @@ TRUE [1] "2003-10-09 04:00:00 GMT" -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist19#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist19#Ignored.ImplementationError# #argv <- list(arguments = structure('object', simpleOnly = TRUE), generic = structure(function (object) standardGeneric('show'), generic = structure('show', package = 'methods'), package = 'methods', group = list(), valueClass = character(0), signature = structure('object', simpleOnly = TRUE), default = structure(function (object) showDefault(object, FALSE), target = structure('ANY', class = structure('signature', package = 'methods'), .Names = 'object', package = 'methods'), defined = structure('ANY', class = structure('signature', package = 'methods'), .Names = 'object', package = 'methods'), generic = structure('show', package = 'methods'), class = structure('derivedDefaultMethod', package = 'methods')), skeleton = quote((function (object) showDefault(object, FALSE))(object)), class = structure('standardGeneric', package = 'methods')));list(argv[[1]],argv[[2]]); [[1]] [1] "object" @@ -27311,9 +27635,26 @@ attr(,"class")attr(,"package") "survival" -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist20#Ignored.Unknown# -#argv <- list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cook's distance', 'Residuals vs Leverage', expression('Cook's dist vs Leverage ' * h[ii]/(1 - h[ii])));list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]]); -Error: unexpected symbol in "argv <- list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cook's" +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist20#Output.IgnoreWhitespace# +#argv <- list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cooks distance', 'Residuals vs Leverage', expression('Cooks dist vs Leverage ' * h[ii]/(1 - h[ii])));list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]]); +[[1]] +[1] "Residuals vs Fitted" + +[[2]] +[1] "Normal Q-Q" + +[[3]] +[1] "Scale-Location" + +[[4]] +[1] "Cooks distance" + +[[5]] +[1] "Residuals vs Leverage" + +[[6]] +expression("Cooks dist vs Leverage " * h[ii]/(1 - h[ii])) + ##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist21# #argv <- list(Df = structure(c(NA, 2, 1), .Names = c('<none>', 'Soft', 'M.user:Temp')), Deviance = structure(c(8.44399377410362, 8.2279889309135, 5.65604443125997), .Names = c('<none>', 'Soft', 'M.user:Temp')), AIC = structure(c(72.1419514890413, 75.9259466458512, 71.3540021461976), .Names = c('<none>', 'Soft', 'M.user:Temp')));list(argv[[1]],argv[[2]],argv[[3]]); @@ -27442,7 +27783,7 @@ Levels: foo [1] NA -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist29#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist29# #argv <- list(assign = c(0L, 1L, 1L, 1L), qr = structure(list(qr = structure(c(-28.8270706107991, 0.273146306828071, 0.312206540911182, 0.247733407426682, 0.216636580341913, 0.0849718577324175, 0.298411357268471, 0.294351149612123, 0.247733407426682, 0.308328048219576, 0.125075187976724, 0.138758462627192, 0.190002850064127, 0.1835601922086, 0.232705016165824, 0.069379231313596, 0.120168353625222, 0.222121918799273, 0.190002850064127, 0.247733407426682, 0.0917800961043001, -10.2334366187554, 13.7940847818881, 0.190374922931528, 0.151060987411652, 0.132099001405849, -0.125761881229701, -0.441661211981173, -0.435651935890569, -0.366655739827817, -0.45633832676795, -0.185116476853374, 0.084611076858457, 0.115858488525451, 0.111929933764425, 0.141897089628727, 0.0423055384292285, 0.0732753420009814, 0.13544380924692, 0.115858488525451, 0.151060987411652, 0.0559649668822123, -4.26682272578616, -3.16543363464969, 9.7352069177467, 0.118607830555703, 0.10371953900067, 0.00616533725634264, 0.0216519528674631, 0.0213573547475655, 0.0179748924786157, 0.0223714822011986, 0.00907513071804667, -0.344446140042991, -0.471652301867824, -0.45565941330494, -0.577653737792655, -0.172223070021495, 0.0575332486360618, 0.106345765721762, 0.0909680534393656, 0.118607830555703, 0.0439417444752447, -4.89123580760852, -3.62866782508622, -3.32364207119197, 9.63649238427318, 0.135617489972887, 0.00806142768852949, 0.0283108036266689, 0.0279256046761512, 0.0235028985277947, 0.0292516173165799, 0.0118661002643811, 0.0254562434016423, 0.0348573968510539, 0.0336754446773372, 0.0426914180233895, 0.0127281217008212, -0.284250391934964, -0.525414891452651, -0.449439332155022, -0.585997195035538, -0.217099822893807), assign = c(0L, 1L, 1L, 1L), contrasts = structure(list(trt = 'contr.treatment'), .Names = 'trt'), .Dim = c(21L, 4L), .Dimnames = list(c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'), c('(Intercept)', 'trt2', 'trt3', 'trt4'))), qraux = c(1.21663658034191, 1.16655707135303, 1.14947576464323, 1.15508453302121), pivot = 1:4, tol = 1e-07, rank = 4L), .Names = c('qr', 'qraux', 'pivot', 'tol', 'rank'), class = 'qr'), df.residual = 17L);list(argv[[1]],argv[[2]],argv[[3]]); [[1]] [1] 0 1 1 1 @@ -27497,7 +27838,7 @@ attr(,"class") [1] 17 -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist3#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist3#Ignored.OutputFormatting# #argv <- list(x = c(9.5367431640625e-07, 1.9073486328125e-06, 3.814697265625e-06, 7.62939453125e-06, 1.52587890625e-05, 3.0517578125e-05, 6.103515625e-05, 0.0001220703125, 0.000244140625, 0.00048828125, 0.0009765625, 0.001953125, 0.00390625, 0.0078125, 0.015625, 0.03125, 0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024), y = c(3.69420518444359e+25, 2.30887824027777e+24, 1.44304890017492e+23, 9.01905562612606e+21, 5.63690976641081e+20, 35230686042118275072, 2201917878145066496, 137619867512235136, 8601241751556820, 537577617482832, 33598603095309.8, 2099913194115.17, 131244699796.888, 8202825028.58974, 512684387.219832, 32044730.0464007, 2003284.70114408, 125327.674230857, 7863.68742857025, 499.272560819512, 33.2784230289721, 2.7659432263306, 0.488936768533843, -0.282943224311172, 7.32218543045282e-05, -0.00636442868227041, -0.0483709204009262, -0.0704795507649514, 0.0349437746169591, -0.0264830837608839, 0.0200901469411759), xlab = NULL, ylab = NULL);list(argv[[1]],argv[[2]],argv[[3]],argv[[4]]); [[1]] [1] 9.536743e-07 1.907349e-06 3.814697e-06 7.629395e-06 1.525879e-05 @@ -27524,7 +27865,7 @@ NULL NULL -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist30#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist30#Output.IgnoreWhitespace# #argv <- list(function (x, i, j, ...) x@aa[[i]]);list(argv[[1]]); [[1]] function (x, i, j, ...) @@ -27574,11 +27915,45 @@ x@aa[[i]] [1] TRUE -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist32#Ignored.Unknown# -#argv <- list(structure(function (e1, e2) standardGeneric('Ops'), generic = structure('Ops', package = 'base'), package = 'base', group = list(), valueClass = character(0), signature = c('e1', 'e2'), default = quote(`\001NULL\001`), skeleton = quote((function (e1, e2) stop('invalid call in method dispatch to 'Ops' (no default method)', domain = NA))(e1, e2)), groupMembers = list('Arith', 'Compare', 'Logic'), class = structure('groupGenericFunction', package = 'methods')));list(argv[[1]]); -Error: unexpected symbol in "Ops'), generic = structure('Ops', package = 'base'), package = 'base', group = list(), valueClass = character(0), signature = c('e1', 'e2'), default = quote(`\001NULL\001`), skeleton = quote((" +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist32#Ignored.ImplementationError# +#argv <- list(structure(function (e1, e2) standardGeneric('Ops'), generic = structure('Ops', package = 'base'), package = 'base', group = list(), valueClass = character(0), signature = c('e1', 'e2'), default = quote(`\001NULL\001`), skeleton = quote((function (e1, e2) stop('invalid call in method dispatch to Ops (no default method)', domain = NA))(e1, e2)), groupMembers = list('Arith', 'Compare', 'Logic'), class = structure('groupGenericFunction', package = 'methods')));list(argv[[1]]); +[[1]] +function (e1, e2) +standardGeneric("Ops") +attr(,"generic") +[1] "Ops" +attr(,"generic")attr(,"package") +[1] "base" +attr(,"package") +[1] "base" +attr(,"group") +list() +attr(,"valueClass") +character(0) +attr(,"signature") +[1] "e1" "e2" +attr(,"default") +`\001NULL\001` +attr(,"skeleton") +(function(e1, e2) stop("invalid call in method dispatch to Ops (no default method)", + domain = NA))(e1, e2) +attr(,"groupMembers") +attr(,"groupMembers")[[1]] +[1] "Arith" + +attr(,"groupMembers")[[2]] +[1] "Compare" + +attr(,"groupMembers")[[3]] +[1] "Logic" -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist33#Ignored.Unknown# +attr(,"class") +[1] "groupGenericFunction" +attr(,"class")attr(,"package") +[1] "methods" + + +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist33#Ignored.OutputFormatting# #argv <- list(tables = structure(list(`Grand mean` = 103.87323943662, N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('Grand mean', 'N', 'V:N')), n = structure(list(N = structure(c(17, 18, 18, 18), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N')), `V:N` = structure(c(6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')))), .Names = c('N', 'V:N')));list(argv[[1]],argv[[2]]); [[1]] [[1]]$`Grand mean` @@ -27835,7 +28210,7 @@ attr(,"class") NULL -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist44#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist44# #argv <- list(trace = 0, fnscale = 1, parscale = 1, ndeps = 0.001, maxit = 100L, abstol = -Inf, reltol = 1.49011611938477e-08, alpha = 1, beta = 0.5, gamma = 2, REPORT = 10, type = 1, lmm = 5, factr = 1e+07, pgtol = 0, tmax = 10, temp = 10);list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]],argv[[7]],argv[[8]],argv[[9]],argv[[10]],argv[[11]],argv[[12]],argv[[13]],argv[[14]],argv[[15]],argv[[16]],argv[[17]]); [[1]] [1] 0 @@ -27889,7 +28264,7 @@ NULL [1] 10 -##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist45#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_list.testlist45#Output.IgnoreWhitespace# #argv <- list(error = function (...) {});list(argv[[1]]); [[1]] function (...) @@ -36107,7 +36482,7 @@ logical(0) [71,] 1294 [72,] 1341 -##com.oracle.truffle.r.test.builtins.TestBuiltin_operators.testoperators322#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_operators.testoperators322# #argv <- list(c(-1, 1), structure(c(1e-05, 1e-04, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000, 1e+05), .Dim = c(1L, 11L)));`%*%`(argv[[1]],argv[[2]]); [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [1,] -1e-05 -1e-04 -0.001 -0.01 -0.1 -1 -10 -100 -1000 -10000 -1e+05 @@ -37710,7 +38085,7 @@ $str$vec.len -##com.oracle.truffle.r.test.builtins.TestBuiltin_options.testoptions4#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_options.testoptions4# #argv <- list('ts.eps'); .Internal(options(argv[[1]])) $ts.eps [1] 1e-05 @@ -39717,7 +40092,7 @@ frailty(id, dist = 't', c 20.33 13.9 0.12000 #argv <- list(numeric(0));prod(argv[[1]]); [1] 1 -##com.oracle.truffle.r.test.builtins.TestBuiltin_prod.testprod2#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_prod.testprod2# #argv <- list(c(1000L, 1000L));prod(argv[[1]]); [1] 1e+06 @@ -39966,7 +40341,7 @@ NaNs produced #argv <- list(c(-Inf, -Inf, Inf, Inf), 1:4); .Internal(psort(argv[[1]], argv[[2]])) [1] -Inf -Inf Inf Inf -##com.oracle.truffle.r.test.builtins.TestBuiltin_pushBackLength.testpushBackLength1#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_pushBackLength.testpushBackLength1# #argv <- list(FALSE); .Internal(pushBackLength(argv[[1]])) [1] 0 @@ -42120,7 +42495,7 @@ Error: could not find function "rep_int" [1] A B C D A B C D Levels: A B C D -##com.oracle.truffle.r.test.builtins.TestBuiltin_repint.testrepint14#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_repint.testrepint14# #argv <- list(2e-08, 9); .Internal(rep.int(argv[[1]], argv[[2]])) [1] 2e-08 2e-08 2e-08 2e-08 2e-08 2e-08 2e-08 2e-08 2e-08 @@ -48910,13 +49285,13 @@ x + y #{ substitute(a[x], list(a = quote(x + y), x = 1)) } (x + y)[1] -##com.oracle.truffle.r.test.builtins.TestBuiltin_substitute.testSubstitute#Ignored.Unknown# +##com.oracle.truffle.r.test.builtins.TestBuiltin_substitute.testSubstitute#Output.IgnoreWhitespace# #{ substitute(function(x, a) { x + a }, list(a = quote(x + y), x = 1)) } function(x, a) { 1 + (x + y) } -##com.oracle.truffle.r.test.builtins.TestBuiltin_substitute.testSubstitute#Ignored.ReferenceError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_substitute.testSubstitute# #{ substitute(if(a) { x } else { x * a }, list(a = quote(x + y), x = 1)) } if (x + y) { 1 @@ -50867,7 +51242,7 @@ Time differences in mins #tolower(c('NA', 'na')) [1] "na" "na" -##com.oracle.truffle.r.test.builtins.TestBuiltin_tolower.testCharUtils#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_tolower.testCharUtils# #{ tolower(1E100) } [1] "1e+100" @@ -50992,7 +51367,7 @@ character(0) [,1] [1,] "HI" -##com.oracle.truffle.r.test.builtins.TestBuiltin_toupper.testCharUtils#Ignored.OutputFormatting# +##com.oracle.truffle.r.test.builtins.TestBuiltin_toupper.testCharUtils# #{ toupper(1E100) } [1] "1E+100" @@ -51498,9 +51873,9 @@ Error in typeof(...) : unused arguments (2, 3, 4) #argv <- structure(list(x = c(NA_integer_, NA_integer_, NA_integer_)), .Names = 'x');do.call('typeof', argv) [1] "integer" -##com.oracle.truffle.r.test.builtins.TestBuiltin_typeof.testtypeof35#Ignored.Unknown# -#argv <- structure(list(x = function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { initPSandPDFfonts() new <- list() if (!missing(width)) new$width <- width if (!missing(height)) new$height <- height if (!missing(onefile)) new$onefile <- onefile if (!missing(title)) new$title <- title if (!missing(fonts)) new$fonts <- fonts if (!missing(version)) new$version <- version if (!missing(paper)) new$paper <- paper if (!missing(encoding)) new$encoding <- encoding if (!missing(bg)) new$bg <- bg if (!missing(fg)) new$fg <- fg if (!missing(pointsize)) new$pointsize <- pointsize if (!missing(pagecentre)) new$pagecentre <- pagecentre if (!missing(colormodel)) new$colormodel <- colormodel if (!missing(useDingbats)) new$useDingbats <- useDingbats if (!missing(useKerning)) new$useKerning <- useKerning if (!missing(fillOddEven)) new$fillOddEven <- fillOddEven if (!missing(compress)) new$compress <- compress old <- check.options(new, name.opt = '.PDF.Options', envir = .PSenv) if (!missing(family) && (inherits(family, 'Type1Font') || inherits(family, 'CIDFont'))) { enc <- family$encoding if (inherits(family, 'Type1Font') && !is.null(enc) && enc != 'default' && (is.null(old$encoding) || old$encoding == 'default')) old$encoding <- enc family <- family$metrics } if (is.null(old$encoding) || old$encoding == 'default') old$encoding <- guessEncoding() if (!missing(family)) { if (length(family) == 4L) { family <- c(family, 'Symbol.afm') } else if (length(family) == 5L) { } else if (length(family) == 1L) { pf <- pdfFonts(family)[[1L]] if (is.null(pf)) stop(gettextf('unknown family '%s'', family), domain = NA) matchFont(pf, old$encoding) } else stop('invalid 'family' argument') old$family <- family } version <- old$version versions <- c('1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '2.0') if (version %in% versions) version <- as.integer(strsplit(version, '[.]')[[1L]]) else stop('invalid PDF version') onefile <- old$onefile if (!checkIntFormat(file)) stop(gettextf('invalid 'file' argument '%s'', file), domain = NA) .External(C_PDF, file, old$paper, old$family, old$encoding, old$bg, old$fg, old$width, old$height, old$pointsize, onefile, old$pagecentre, old$title, old$fonts, version[1L], version[2L], old$colormodel, old$useDingbats, old$useKerning, old$fillOddEven, old$compress) invisible()}), .Names = 'x');do.call('typeof', argv) -Error: unexpected symbol in " ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, use" +##com.oracle.truffle.r.test.builtins.TestBuiltin_typeof.testtypeof35# +#argv <- structure(list(x = function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { invisible() }), .Names = 'x'); do.call('typeof', argv) +[1] "closure" ##com.oracle.truffle.r.test.builtins.TestBuiltin_typeof.testtypeof4# #argv <- list(structure(function (x, y = NULL) standardGeneric('tcrossprod'), target = structure('ANY', class = structure('signature', package = 'methods'), .Names = 'x', package = 'methods'), defined = structure('ANY', class = structure('signature', package = 'methods'), .Names = 'x', package = 'methods'), generic = character(0), class = structure('MethodDefinition', package = 'methods'))); .Internal(typeof(argv[[1]])) @@ -53680,11 +54055,20 @@ NULL #argv <- list('raw', 0L); .Internal(vector(argv[[1]], argv[[2]])) raw(0) -##com.oracle.truffle.r.test.builtins.TestBuiltin_warning.testwarning1#Ignored.Unknown# -#argv <- list('OGXAGDISZSNLYDBXLBQMQHECNODETNWRASXQCXRDTYKHGFOTROVTAJBUYOWPRNTXVBABWOIYPNJIVBJWSRJODUXFUPYENWWAZMKKCEKIKHOEYBJZQBKLNLQDXOODTMUBVHHQYAJKLSXQXTDDELCFOKOVQKSCHPEWWMUHBLMIENAUOQMHLUPKVIPLGOGOLDQODOLLVSLNGBKAWZSVXOOHRGHSSEHJCSODZOUWWUQQHAKJKEIKTHDAUMUCCDTTZQHFUSFTWNPYYRBVMKHGKYGOFFSIDBYODOOVSOSTJHNGVKBYFKQQIDXPTXNJBWNFJFLGDBRHDZKKQXFOSKCQAFRWUDKUSPDOLTAFWCZKWXMSMZBEUOKZGNCVJUFYINCXYBMFWNAHIPGBCSYICIQLUHOBESVNOADWCGZPGPADSBQYCZASLOWOTQIKFWPTOHTOINVNFWJHUTVOAMOVSOBDRCFJWGSCUGOAUIXJZJMMAQNIPQLESTVNHLJGRYHQNPAADACMFVGMQEVLGHEPDEIEKPRVJYAPMJWBWEFWBGZRLJLURMBGGFBMGTOYCYSXPEESPIUIWPKYMCMZYLWHUUKJQWRNDPBMTTBLNHPTSDOUGSVDYTVEAWXDMMSBTKLSMZVVTCVVZBTKPVAAZTIVZFQLYZLFSOPLLPLYVFKKAJKESATLTABKQFVSXKKGJGYMBUIORHBLPZZCMKKIRHKZUIVFNEDXCWHAUJATALGMQCECVQQKLJUXQPIBPETHQDGVUBWDPMOSMZZKPILFAABTMWPEPXUNKRXXEGCUCVUYMYUWKCHSJJANDXBUWAHQUKYKLHPOBTFRNQQHFOZIIANPTYMCGWWVYQMESCLYVSDPZQHBBWJYONYCVJOICUFRLFZLAYWPHVYWDZOADAVUYJZVUQZMXKLYRAEMLZXISXRQDPHLFGQMEHSPDBZJRVGAPVJIQYPNEVFRQBYPWNGPURMMQLPAZKDWOWAWSUWNYFAIRIYUIMKUMAQGTHXWMBPPZIRYORCWNFKXMRHVGJGYKDXJWDJGBUFKIPOZGTZOKVCNLHEWOOPSQPBOPQQCCRVDUMZMOJNBOYNLAABEMUHTNHARBVDRVGDTFGNMJUOEZGDFJJHBYOFWMOUQDIYETLDFRDKLQGMEWECXHTKLEDDNMQLBAFWGPPZETGIAZLZFCGRPKSOPPFCTPYYTLELTXXVFBMPCYEXDRUTRDWQVEAIHVYDXPKRTNKZBDSSCMQKZRIDHCAITYKNBQJLZRSEFWVSHFMNFTASVYRHFWAWNLYEJDDROMVZNSEJBDCHKQSIZSEJHLVGKZDQSPZBZTLDLELVBIVBUZRAMSAVTGTRERYWURPKDVSUAEPCSOHKRECNCCQOHGQVBZAEIWEUWMQIMYGAZGRBZXWLUHHZZMTIGQIBZRWMDRAEXDGGIFAXYYLLBJXJNNEOCPOFXFKWGHWQWMXEQSEORXIOAJQPVDRFPSNJSMGLCGOAFQSUBCYYXQEXXEBOJLMUVHSMBAGFKOSGXMGIRSOWKFMJGYMAYJAZJZDOUFSOAGMYZFOQXTPFXUIFRTMWREAWCILQIPVIJPMCVLTUKATBNDRBURGEBAVGBJPUIDUWZRGQLFPZFLIACKBAEJPIMTEVIGIUGXDFQGSTGOXSVXHQDWRTIRMQUXNEHDGSQLQNIUQUEKZJCNYWORNYCMUWXVDSTRXKYLFPENKVOLFMGIWLLMVAICVMNKLCAACJTTCZDMOYVNJOUQCEVMUVHFQJXDEQERNTICKOTEPMYXDHSTNFEIBRTGMBCXPQLHYAEZUZGPBUWXAGPJSBRFHTEKRKOLDAEUDBAKWILKJYYHSFYBZFIDPRZFVQZLSBQFXVWVKZMMIBXFHROZCOXWXUEDDLUXLVMRTRWIECAXUCCENTDCOHLDXTLRHRJRKSHTOAJLKOWTBDIITDZWPXAUXCMRMWKOQHXDOGBTPIXPYXKSVXDBZKSNKSWDJUFQJPOSVLJVNTWLKWSPSTGHFYHMAUKLYKTUFBIRTQYAJQCADTWIGGYMSXPGXSBQWDYBEAKSRMCZOSHUQXKITSLUHXQUSRSFPTGRCTYRRKDMCTJOJFNKWCBEYLRAMBQWFHWAULCXETLREWBFGTKHCNLZDVAUFDEFYZIDRPIVHVDWBLRFYJQERTMWVZRQBEAWLVDKSBIUVWYJYSKKFTLLCJXOAKCHSJQMUPEYBCVKSTZYDRAMUJYRLVULIOWPQTSWCPGMHXKOCYTMESPBBLEMZFSDNVDVGCERRDZDYSOGIVXNXSLHZDRVFPEKGNRXIGIFDGYBNUVOGPDMCHRFKUFBURNFEPBFVHAZCTVAWOIIQDIPTORJXZTANUFKOTIILHQBPKBZQVKYJVAWBVPRSHRHOBJMNVNWPNQHOZXUVXPJTMARKYDJXUNAGHRCZWHLIJHXHWVEFRMCDIPYKYCWGHEACDFVAKXAILOXNTQFNBUFWNGVBAPWLNFSNBVGNICWQWDRPYPHYVLMTGVVKXBVMHQIQXOQKUWJMXMFRTQFYAXCVOPVGBDCEYFIRSHHLJXNPNNLFIGAFZLZGDOLWXQVHXDDPZNDEUQOTIKJQEGYZNBPSPNJCDJPGAICGDJDOOEYQBERXVLEEMKUUKQKJQYMQHKLHZWVSEBCWJUXQPBGKVJLODARVYBRKODGISEDOBLMMMTZVCWORUKWEMDFXMOZZRUASXLSVMVMALMPLHRPZEZPTWQSZWTDCNFTMDVYHDSOCOPOKKXRYDOCQGMMVXOYHQQQGKENPCSPRHJQYJFGMKIJRWMPMRRCCYKOYFFQVVDCUYQLRWNNUJYAIDIMTUKAYXPXQDDRXDXLBVZUHFFJFECQUBCADYEZSIIUMMGYRSHPYANWHJXCNKELEWRDDHYYEXBWBYEPSHASIWMZCAOPATBMYBYUWFZSHVYXDBVWBFSCAXBWDKFUOFLLXMYKUTIYNILMVYMJFASSAENEGXJZSDPWTMNOFXEPMFZIBTOAHWGBSNKLXXFOBOCTCFTKOWSTPCVTWCVHIXEASAVXEFUXGLKRHUIGAJPIEZGODRLJKKVXTJRNAQQIAZZBNZCJMXOAWVWVACVFAOTWBFKKPYZDHVZRCDIGGUEPRXRHABEWBHXOUYRKZYNDQVDPZFKCHNIPZPDSRILHVPUHDXAOZGZAGGYZTHKFTTMRTUPKRWLDQMYGUTROPWMZBOEHVFPKHMTZEDPDFIGSSUHEMOQMDWZWWJQNATVBXJSSRHHMBMPGZEOKDJZUJYSMVRJMPSJPNPXWVEIYYQUOBHMLYQAAHHVSRJEFSGFPDBAVUAPHPFYCDDHPFLLJZAWCELSEDFEWTOWDJIAKSGQEUMBUWPPKBQNUOLVRBDVKNIQPFQJLKFGELPKXHFOJYQLHAOIMVFCUEUAWVXJHXIYPPTKJLISGWYMAYLVNMDBQJABVTBSAPFQONGJHEQADNMNRZYYRTYFRCMTAECUJQTGJISODHKNPIJYOPGKQJMEMYAJGPBQBHILLZPIWIRXVCHNJVWRNUBGFVVVHAQTNJIJJOQKPSXYKQECOVTOZZIEJOVSXSGITFHXEDTOOSQTHZZATJJATECSLAXULDVSKEAIEOPHYSHSPKEAEPFBXWVPSUWSIMUKPHDHFFNXPGJOERAARFJESPBKCKLQCIAIUTVBDQKEDDQNMWETFEDXRLSSQXFLAESTLJMAWQEOWFIUGBKFQQKDELKBAWHZRWLYTHRXTRTCBJNYYQINRWOCSVKFGANPPXLGNBRTFEWHZSYTIJAXNIVUUNCXDVOOTKVWUKESCBAQSEUUQYDBYWJKZCSOWTQEMLEVHQMOPCMELROGHAHSBZUXNIMCFJKRDMDOAUVFOPDSWYTAUIKAIILVRJUJYUHGEXOXZOIRWZKTILGSKRYBQTRWUWZOUPBMDOBTACXZIQQPWUHBLLQTPMFLTGSUKICMTNYAXPVLIKHDHHIATLPCAEAYMUOCALFUNOYBAOCGDDOBQTJSBPGEHPKQYNGTNDGDCQTLDVZANUNGMHZSTAKLDGDKFNXNLHFBUYXHGIIPQCMBRYYXMJKYRKMTTMKKRRBLNEHFDWIBQTNNTXVNUFJKCAKEWPLNBTRDPQIROHXBXVIKNOBIGCZIYVKUGUCFZBORHMWMDITBYRKDYGTAGZSQGCHOUHIYMZVZCIYQZZSKRGIVRUIQPFGWUATXXDZXGXVLBWIGVZFCQWENJVMGHVAKPNRNOVIAVUWBAPWLAKJMDMGMXNSBRUAAPUTGULEPVUCBYCFLUWQKDWWINMUXPVUHNHWSJZSGQIUIGBOAHHVDGLYIUDMNXJMLSBSRRMHJCGBMIFTGKSCDZZTAZTXFHPITBXUWYIEDCMVWBTZISPBLQUOWALMUHPEUPHUPYEAJUOECWDQLYPBNRMQMWGKUWOIPIENADEIJWJYMWIIEQEOFCIPRFKDFTMGULEEZNNRUSWDGXJYIQNOMNJPGQROITWJLWKMNBKLORRXRNIADNNCGEHDLFCWFFIITOEVXGTFVHTDVVWAAHIBSAVNTYOYIHZGUHSTHAKPLINFHANKZBQMAEQNXRNHKDJHYGTBJFWLIKEQUXPQRYZGHXJSVDVRACLVIHXKOGDFNYKVCTGNBUXTCYEURKTKPIQJWKLXQARGZLRCFYOKPDMEGVRZDLMOLESXHTYANGMKVDWKQDWQNQZUYRLYRJJALNBTDIJXQWKSFNXHHLXRLVGJDGRZVSNEZVZNTUNNSMHNPRYHGGLLKOJJHQEDCBRZURRIQKDUWKQOXKKICSXODXKDXLLKIDUVFLGCTHNDMWAZUGTMAPKZLAAHDCLKHKOGBZEPYZPUCCDFIPFHCQWTPRTLFGLCAQNVRMWUJZFZLIWSOGNTMMNPMFNXBMWIPMTNZYODGZKFJOAAIGATUSBRTIKAMDUKYTLUJJRLSLRNXYYGLKENYCREGPCRQWFIKYBFSBZANWHQOLYJIYCXHECCGWKSYHTRHAJGNRHMJCEVMWVESLPTYUYHAETQNABEZUNBHCSKXJLBLSVDOLSKLTGMFLXYPQYTYRGSMXYMLPSZMHVXPHLYNGKFNWAVGSRPQPRZVBNELCCVYKJLLZTHMZOCBXVQFJDLUXVYJBHZLZSHXMVGYMDUDORONYFAHIXODFCWBINIWWXUXLKJNBSGVZCMRVTLYSIMZXFHJBZVRKGYJONYNQGJXTUICYLOEAFIPBGAFNITYFZCTHHBFTISFBSGIWALDNZRWTNXMUNCOJNQGLCACFDVKOPBUPULQTSZHBLHLLQAGMXHHZMABYMVVTPONGQWTEJTCRSWFHVHWQGQBXXRYOUUGHFWSDWQOBHPYBLKNBWGLFYSKHSFHXMYUWOBNXACQMZTUKZLZOTRVRABYLQPYSFJRGPCYGHLMGFSKQQBMQISXKKMBIEJLEBRKCMHCENENJVINGIKQBSOITGCJCFZDPRNKKNRZNMHEIHJMJLFBWONQFNSAQTLURPETKCEUDMJMOYEKLWAAIIWODBDVKZSGXQZCUZTUZIJEKKPKCRAEZNHAIWEJOMSVKFNHVGMCHVMLFGOSEEXDAHRNIEZTKCRPQTPCSAZYVGPIZWSUTIXBOITQKWOWNQGHZZHPJZXNMKWXHWMQKCEAJSGKUUKTMFFBPZBSAZZSULTRANTASWMGULWQLNZRVKXAJRLFERRKPKNWGRKOZPEWIWCBCWKWJJGMFVKTWWJOCDDEAGBBFEEPDSZSYXZGUSLRDADRIJXMTQVNLMBPQEKHJUZNVZKXARKHVOQJPXWZLWJBKMTGKKUNCMCXOYUQIUHGAKQVEZRVYPIUTWLVQJDORBXEZCDLSJHSSTLFKHTOUNPRRDQGPSNTVLTYUYWGSULVDNIOEZJVHNKSDJGVQTPZIJVJBARWYMIDQFHMMIUGECHFSNREUFXCUCDFORINMIVXPHORLQRWDWIVYFTOEHCBEQSQRCHYJEVVJRMDQVLLGCIFDORIXGPRULGOLOLYBINRRATGXMBJTMTHKTSFCNPCAEQSYMYKAASYJJMYACQFHWQJLMDOQKSYNLSGIDXZJNHEWKWQTAPBYLEOWBYWNVSZSNWEFBVSBXZVHLJBPICAKINJJAZOANLNWBFBLDZDAMFLCHTHFCRGGDLRUYORAXHITCZVDDKCMUGKCEZRYPCVAVKDRQLUWZKJDZYYKUKAKYNRANTLTOTSISOWBJQAFQXMETAQODBBEGUEZMKNVBCYYKMKFTRNFTNEOJWWHHJMOMVEZQYNVZAEVQUTGGHBCOMHNNBLBKODDHJFVIIRODTKDVXYVLXIISBNSSTYZJYPICEDTHZJDDFXYEZGPDBLHKWSZAMJGHQWOEEESYXLNUTLPYRKKCWZPXHRTKVPMEAYYNFWJMYOAXDHFECOWAXWRRIDIOHLHLRAVCIRQVAXNIEQWRWCAFVIHDLWVOTUFHQFIEXUBQUMXLAUTLJHOHKITBVXSDLHIELTKQPRFVSFEOBJPERMWHTYPZTZEUDGCTNUTWVUYNQELWGVPEMUJGGIEJEYYLPLIRBCOCIBMPKSUNMTLSZPWXOPGOWLEFMIUBIKJRREOKKPKBPHRJXWIYXABSGECTQJRSCCNYEORABQUZMYDYMEKVJZBRHHLUBWQGXUUGFXGRIRSPMBEVBZSKDNRMNKTGWXCSWRTUJJMBRYTEBNYXCKAZVABMKVCSAOIVTRQOGAMVLSMLIAQPDJQQJJJXTDIGEZCBTDAWIMOCCWNMTEAPEFYEGPEQFNIOOHGXPMTBQQUKFQLOTDNDPFNWORMYDKOQIVYXHOOVAOGRFEXMLPOQQDHTQQYPTETUFKOMPHGUOEZMEFSCDKQADGSLCJNNXEKKLAXTZXZJJUDNTFRLXHOAOOYROETHRDMCHDJMALXFBIHMJRXKNIVEJRYFRCSYVEBOMVPRFINYGHPBATPTGUVEAINZKKVVBLHITASDQBPDBSUTPMAGLRVETLGKVYIVQFVTQFGKUSYAEQLHVGFABOIEWYCPKEVRNNSWYXVDSQREDOUVSXRDNHCAOTXTHTAPZQHIWFTJYZMPJJYQZIQXOUUAGHRBENJMUUFDUCRKYBZUHIQCYJPTGXEXXQZRDSOZBDNRJJMXZYCARBZHHMFFNJXGJZDFNKALBXWHRCAWTXABIKQLBMXIXEGWWJPMTFTVCHAPZVPIQADNWCZYYTALDLOTTXHOFUPOEXZZADSCAAIPYGWWCABPNREBRAEPBBIDCHWSJCMEXBZJMFQYXOLZDJVUBLKHIYHXAHHCXOIYGWGAEAOOSWYLBHQYLZPODKNPDJTEEBNIATQZWMUTWTCRLNMNTRLKKDYGWWBIJKEYZSIGWXNPOQRULMUMSQBJHIHVHTWNYVEBSBDLHKQVLIGBCPJENVSBEASLDGHZREGLFQMUNIVYKEBUGRGDEMQYZGUGLWSIYLJUTOSILYNITUMTJIHZPKMBJLOQFVFTXHEZQYEHKBQFESSGPUJEPCNTFOCJOLEJMABCETPTWZOBEJIMWSSDUPVFQNWBEEQFJRPWXESEGMJJENMHIIUHILTNTTIPYRNEGMNOECTFEIXNAADXJQGSXRMPQATNOMVARUTBBJDBAHKWYMEJQXRXPJKFGRGRNWXDFMLROFUCKATMBMTINMDBAUJOTHQIJUNJOZFVNFODGTPMQTSETNRMQVMPRJCJTOHGZPHCAIXVHMSXPNWVEQDHWUEVBEUPMYZOQTJXGPYBCLTUSEHJYIFAMUQEZCTGYHGPBBVDBHCNSWMHUQYWVAQKSUOLYUNLUUEONJANOIBXLXKRVJGHGEAGTKWQKZYUIGEWPCTEBDBMNARXATBWQMVWJQXVHGLGXRMDNZEPNTGQAYEIKLOOWLNNLIWVZLMMWNREMRAJEPHNDQDRIQVUEGOIKRUENWLKHMVEWWNQZQMIZGLGBYCMEZYNYSRFQWHJGSGCETHRGASFUDYVASRFJKKUBBMNFPQRDDZGFRKOCUJVZOJZSOEQYRRDGOPJJPSMFIRDYEXAQPQLRTVPQGSHTCPFTZNTVCIAOHNRDPXGDGXPDSEZUKMKARYGAVGCBOHANSJKHYLDPCFXAOEBATTFZRDWEMESUYNHREUTPORPDRMPGSCCDRVZCMIIVSQXTMQSLIAGHICXJYZDOOGRVCRPMIKALTMHTBOZGUUWGOXAEGUBXIXPLSTNABRSLFSAOCXULPTFLATSCSSLJFQCEHSJZEYDVWGHQQLPARKIJSMOHXTOZGWYTKNONYWQXTHAVCDEDPYTNCNUVZKWFEODBGIYLLBJOWGYWFKQDHPEMWNJPSJEJPTAYDAVLGVMDDWBJKTSYEVOXYAKCMSMEPHTXGOTNFKOBTADKPQQCKAIXGSXRCVSSLDCXFCEIRQKPXSMVHFHCEDMSFIMRRWAGIVQGMTCNRFMVWTQFFNTZJFSLXXJDTZBGAHAMOWAZARZTQCPOMAXKKYUKOMHNELAOMBBIIJDSOPXFVUFXACKODFHHQRMUZQNHWWEWKEUQTDCYGPMWLQHLCUYDUBWGNPWIRILVGICVQFVKKFEIUDDRKWMPVYBBSFESJTNQMYLYEBQIQBIDSPYQQFUQRGUPROKKQETIFRPIWJGDMILMXGFJODKUGZZIQRWYSJVJZTNEVLXHXEZRPLNZPAWTVFQKRDVSBXXREEPYYLPOGMIKMNEDMWMTKNQVMCIWIPHSHIHFGHEWPWNYXMEFTYGBQLASFDXBVRNYMGHGMEGYHGYFUFZHVHLSQQPRXGJTZAGWLPLIKRZCGGSOBBDMUMDKNCEWJBDBMHOYJOAPIKAPFTRTHXDFULBREUQJATSHPJUVVACPLVAJWTYGXOMNLMKCVLGFFJRWFHLMTOZLEUEMHOZESJRGFRCWSIZAHFHEWWZOAYNRNBTRSFJNYLBLLJKZAYZEWPWWNWSEFXCGXOTOOAOLKAUAOQKQSVIQPGTFPUBYMUMPIMQYTAWVJLJDEUVEPQFOUOFAROYILGVDHDVFPXFTKPWYFYKVFDQYRKNKJ');do.call('warning', argv) +##com.oracle.truffle.r.test.builtins.TestBuiltin_warning.testwarning# +#argv <- list('foo'); do.call('warning', argv) +Warning message: +In do.call("warning", argv) : foo + +##com.oracle.truffle.r.test.builtins.TestBuiltin_warning.testwarning# +#f <- function() warning('foo'); f() +Warning message: +In f() : foo + +##com.oracle.truffle.r.test.builtins.TestBuiltin_warning.testwarning# +#f <- function() warning('foo'); f2 <- function() f(); f2() Warning message: -In do.call("warning", argv) : - OGXAGDISZSNLYDBXLBQMQHECNODETNWRASXQCXRDTYKHGFOTROVTAJBUYOWPRNTXVBABWOIYPNJIVBJWSRJODUXFUPYENWWAZMKKCEKIKHOEYBJZQBKLNLQDXOODTMUBVHHQYAJKLSXQXTDDELCFOKOVQKSCHPEWWMUHBLMIENAUOQMHLUPKVIPLGOGOLDQODOLLVSLNGBKAWZSVXOOHRGHSSEHJCSODZOUWWUQQHAKJKEIKTHDAUMUCCDTTZQHFUSFTWNPYYRBVMKHGKYGOFFSIDBYODOOVSOSTJHNGVKBYFKQQIDXPTXNJBWNFJFLGDBRHDZKKQXFOSKCQAFRWUDKUSPDOLTAFWCZKWXMSMZBEUOKZGNCVJUFYINCXYBMFWNAHIPGBCSYICIQLUHOBESVNOADWCGZPGPADSBQYCZASLOWOTQIKFWPTOHTOINVNFWJHUTVOAMOVSOBDRCFJWGSCUGOAUIXJZJMMAQNIPQLESTVNHLJGRYHQNPAADACMFVGMQEVLGHEPDEIEKPRVJYAPMJWBWEFWBGZRLJLURMBGGFBMGTOYCYSXPEESPIUIWPKYMCMZYLWHUUKJQWRNDPBMTTBLNHPTSDOUGSVDYTVEAWXDMMSBTKLSMZVVTCVVZBTKPVAAZTIVZFQLYZLFSOPLLPLYVFKKAJKESATLTABKQFVSXKKGJGYMBUIORHBLPZZCMKKIRHKZUIVFNEDXCWHAUJATALGMQCECVQQKLJUXQPIBPETHQDGVUBWDPMOSMZZKPILFAABTMWPEPXUNKRXXEGCUCVUYMYUWKCHSJJANDXBUWAHQUKYKLHPOBTFRNQQHFOZIIANPTYMCGWWVYQMESCLYVSDPZQHBBWJYONYCVJOICUFRLFZLAYWPHVYWDZOADAVUYJZVUQZMXKLYRAEMLZXISXRQDPHLFGQMEHSPDBZJRVGAPVJIQYPNEVFRQBYPWNGPURMMQLPAZKDWOWAWSUWNYFAIRIYUIMKU [... truncated] +In f() : foo ##com.oracle.truffle.r.test.builtins.TestBuiltin_weekdaysDate.testweekdaysDate1# #argv <- structure(list(x = structure(16352, class = 'Date')), .Names = 'x');do.call('weekdays.Date', argv) @@ -60441,11 +60825,11 @@ raw(0) #{ 1+TRUE } [1] 2 -##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testScalarsReal#Ignored.Unknown# +##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testScalarsReal# #{ 1000000000*100000000000 } [1] 1e+20 -##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testScalarsReal#Ignored.Unknown# +##com.oracle.truffle.r.test.library.base.TestSimpleArithmetic.testScalarsReal# #{ 1000000000L*1000000000 } [1] 1e+18 @@ -65765,7 +66149,7 @@ a d <NA> <NA> NA NA -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting2# #{ x<-(1:4); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[1, c(1,NA)] } c <NA> 1 NA @@ -65787,7 +66171,7 @@ a 1 NA a 1 NA <NA> NA NA -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting1# #{ x<-(1:4); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[c(1,NA), 1] } a <NA> 1 NA @@ -66115,7 +66499,7 @@ z #{ x<-c("a", "b", "c", "d"); dim(x)<-c(2, 2); x[1, 1] } [1] "a" -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting2# #{ x<-c("a", "b", "c", "d"); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[1, c(1,NA)] } c <NA> "a" NA @@ -66132,7 +66516,7 @@ a "a" NA a "a" NA <NA> NA NA -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting1# #{ x<-c("a", "b", "c", "d"); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[c(1,NA), 1] } a <NA> "a" NA @@ -66251,7 +66635,7 @@ z #{ x<-c(1+1i, 2+2i, 3+3i, 4+4i); dim(x)<-c(2, 2); x[1, 1] } [1] 1+1i -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting2# #{ x<-c(1+1i, 2+2i, 3+3i, 4+4i); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[1, c(1,NA)] } c <NA> 1+1i NA @@ -66268,7 +66652,7 @@ a 1+1i NA a 1+1i NA <NA> NA NA -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting1# #{ x<-c(1+1i, 2+2i, 3+3i, 4+4i); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[c(1,NA), 1] } a <NA> 1+1i NA @@ -66473,7 +66857,7 @@ z [1,] 1.1 3.3 [2,] 2.2 4.4 -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting2# #{ x<-c(1.1, 2.2, 3.3, 4.4); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[1, c(1,NA)] } c <NA> 1.1 NA @@ -66490,7 +66874,7 @@ a 1.1 NA a 1.1 NA <NA> NA NA -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting1# #{ x<-c(1.1, 2.2, 3.3, 4.4); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[c(1,NA), 1] } a <NA> 1.1 NA @@ -66703,7 +67087,7 @@ TRUE TRUE [1,] TRUE TRUE [2,] FALSE FALSE -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting2# #{ x<-c(TRUE, FALSE, TRUE, FALSE); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[1, c(1,NA)] } c <NA> TRUE NA @@ -66720,7 +67104,7 @@ a TRUE NA a TRUE NA <NA> NA NA -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting1# #{ x<-c(TRUE, FALSE, TRUE, FALSE); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[c(1,NA), 1] } a <NA> TRUE NA @@ -66835,7 +67219,7 @@ z [1,] 01 03 [2,] 02 04 -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting2# #{ x<-c(as.raw(1),as.raw(2),as.raw(3),as.raw(4)); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[1, c(1,NA)] } c <NA> 01 00 @@ -66852,7 +67236,7 @@ a 01 00 a 01 00 <NA> 00 00 -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting1# #{ x<-c(as.raw(1),as.raw(2),as.raw(3),as.raw(4)); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[c(1,NA), 1] } a <NA> 01 00 @@ -66995,7 +67379,7 @@ $d [1,] TRUE 42 [2,] "a" 1.1 -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting2# #{ x<-list(TRUE, "a", 42, 1.1); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[1, c(1,NA)] } $c [1] TRUE @@ -67016,7 +67400,7 @@ a TRUE NULL a TRUE NULL <NA> NULL NULL -##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#Ignored.ReferenceError# +##com.oracle.truffle.r.test.library.base.TestSimpleMatrix.testAccessScalarIndex#WhiteList.matrix formatting1# #{ x<-list(TRUE, "a", 42, 1.1); dim(x)<-c(2,2); dimnames(x)<-list(c("a", "b"), c("c", "d")); x[c(1,NA), 1] } $a [1] TRUE diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java index 76738ecfa18a5b432ee11fb4be04bff5fca7952d..df96882222cd0eb25fb15a6a5eefa8dd51e31311 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Im.java @@ -63,7 +63,7 @@ public class TestBuiltin_Im extends TestBase { assertEval("{ Im(as.raw(12)) }"); - assertEval(Ignored.ImplementationError, "Im(c(NaN, 1+1i))"); + assertEval("Im(c(NaN, 1+1i))"); assertEval("Im(NaN)"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java index 7eac103d968c9f9e2baac2e6176c20aa684b4c8d..b9c27c34d4ef1ea7e22eab6459cb9fcd6459ba5f 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Re.java @@ -67,7 +67,7 @@ public class TestBuiltin_Re extends TestBase { assertEval("{ Re(as.raw(12)) }"); - assertEval(Ignored.ImplementationError, "Re(c(NaN, 1+1i))"); + assertEval("Re(c(NaN, 1+1i))"); assertEval("Re(NaN)"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_abs.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_abs.java index c6280515a93e3d1ff2eb70ead0048c406da1dc71..c15b3706a2ea6d0649e0f88665868cd6ec9cd2b2 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_abs.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_abs.java @@ -56,7 +56,7 @@ public class TestBuiltin_abs extends TestBase { @Test public void testabs8() { - assertEval(Ignored.Unknown, "argv <- list(1e+07);abs(argv[[1]]);"); + assertEval("argv <- list(1e+07);abs(argv[[1]]);"); } @Test @@ -149,7 +149,7 @@ public class TestBuiltin_abs extends TestBase { assertEval("{ abs(c(1, -2, NA)) }"); assertEval("{ abs(NULL) }"); - assertEval(Ignored.Unknown, "{ abs(c(0/0,1i)) }"); + assertEval("{ abs(c(0/0,1i)) }"); assertEval("{ abs(1:3) }"); assertEval("{ abs(-1:-3) }"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ascharacter.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ascharacter.java index 3d0f94e7ed0848787130b26bbfb5cf6be02eb232..6deb046c20253c0a5cfe6b6d718e071506d28b21 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ascharacter.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ascharacter.java @@ -105,8 +105,7 @@ public class TestBuiltin_ascharacter extends TestBase { @Test public void testascharacter18() { - assertEval(Ignored.Unknown, "argv <- list(list(epsilon = 1e-08, maxit = 25, trace = FALSE));as.character(argv[[1]]);"); - // 1e-08 prints as 1e-8 + assertEval("argv <- list(list(epsilon = 1e-08, maxit = 25, trace = FALSE));as.character(argv[[1]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asmatrix.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asmatrix.java index 549f56d5816490f9e8f91868a3c3a270eb920004..5e62c86975ae9d1f84718a5e292bd744202af628 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asmatrix.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asmatrix.java @@ -71,8 +71,7 @@ public class TestBuiltin_asmatrix extends TestBase { assertEval("{ matrix(1:6, ncol=3:5,byrow=TRUE)}"); assertEval("{ matrix(TRUE,FALSE,FALSE,TRUE)}"); - // prints as NA not NaN - assertEval(Ignored.Unknown, "{ matrix(c(NaN,4+5i,2+0i,5+10i)) } "); + assertEval("{ matrix(c(NaN,4+5i,2+0i,5+10i)) } "); // FIXME missing warning assertEval(Ignored.Unknown, Output.IgnoreWarningContext, "{ matrix(c(1,2,3,4),3,2) }"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java index 5becc0a8b7117c0180c5e8b92c4419e6df449649..8cb738d0a9fd6756af8ab06ad898fb28e635b74d 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_asvector.java @@ -341,7 +341,7 @@ public class TestBuiltin_asvector extends TestBase { @Test public void testasvector69() { - assertEval(Ignored.Unknown, "argv <- list(c(200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 1e+05, 2e+05, 5e+05), 'any'); .Internal(as.vector(argv[[1]], argv[[2]]))"); + assertEval("argv <- list(c(200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 1e+05, 2e+05, 5e+05), 'any'); .Internal(as.vector(argv[[1]], argv[[2]]))"); } @Test @@ -421,7 +421,7 @@ public class TestBuiltin_asvector extends TestBase { assertEval("{ x<-factor(c(\"a\", \"b\", \"a\")); as.vector(x) }"); assertEval("as.vector(x~z)"); - assertEval(Ignored.Unimplemented, "as.vector(file(''))"); + assertEval("as.vector(file(''))"); assertEval(Output.IgnoreErrorContext, "{ as.vector(42, NULL) }"); assertEval(Output.IgnoreErrorContext, "{ as.vector(42, c(\"character\", \"character\")) }"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java index 223602182781ec7fd20a324d37139797968398f4..80f08f938328dde2e819144475e5cb9c8b1107be 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_c.java @@ -31,7 +31,7 @@ public class TestBuiltin_c extends TestBase { @Test public void testc3() { - assertEval(Ignored.Unknown, "argv <- list(0.1, 1e+60);c(argv[[1]],argv[[2]]);"); + assertEval("argv <- list(0.1, 1e+60);c(argv[[1]],argv[[2]]);"); } @Test @@ -383,8 +383,7 @@ public class TestBuiltin_c extends TestBase { @Test public void testc73() { - assertEval(Ignored.Unknown, - "argv <- list(structure(list(coefficients = structure(c(-0.0529307911108286, -0.200175675120066), .Names = c('(Intercept)', 'xTRUE')), residuals = structure(c(0.196977726701894, -0.102864715594501, -1.21764591766838, -0.425219263997792, 0.671048026430597, 1.41161034263987, 0.150318738887899, 0.440602402670198, 0.19930142564799, -1.32412876571778), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')), effects = structure(c(0.483887391035467, -0.316505532770654, -1.29088865053614, -0.430233412486575, 0.597805293562832, 1.40659619415109, 0.0770760060201344, 0.435588254181415, 0.126058692780225, -1.32914291420656), .Names = c('(Intercept)', 'xTRUE', '', '', '', '', '', '', '', '')), rank = 2L), .Names = c('coefficients', 'residuals', 'effects', 'rank')), structure(list(fitted.values = structure(c(-0.253106466230895, -0.0529307911108286, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')), assign = 0:1, qr = structure(list(qr = structure(c(-3.16227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, -1.58113883008419, 1.58113883008419, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634), .Dim = c(10L, 2L), .Dimnames = list(c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'), c('(Intercept)', 'xTRUE')), assign = 0:1, contrasts = structure(list(x = 'contr.treatment'), .Names = 'x')), qraux = c(1.31622776601684, 1.39220245868163), pivot = 1:2, tol = 1e-07, rank = 2L), .Names = c('qr', 'qraux', 'pivot', 'tol', 'rank'), class = 'qr'), df.residual = 8L), .Names = c('fitted.values', 'assign', 'qr', 'df.residual')));c(argv[[1]],argv[[2]]);"); + assertEval("argv <- list(structure(list(coefficients = structure(c(-0.0529307911108286, -0.200175675120066), .Names = c('(Intercept)', 'xTRUE')), residuals = structure(c(0.196977726701894, -0.102864715594501, -1.21764591766838, -0.425219263997792, 0.671048026430597, 1.41161034263987, 0.150318738887899, 0.440602402670198, 0.19930142564799, -1.32412876571778), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')), effects = structure(c(0.483887391035467, -0.316505532770654, -1.29088865053614, -0.430233412486575, 0.597805293562832, 1.40659619415109, 0.0770760060201344, 0.435588254181415, 0.126058692780225, -1.32914291420656), .Names = c('(Intercept)', 'xTRUE', '', '', '', '', '', '', '', '')), rank = 2L), .Names = c('coefficients', 'residuals', 'effects', 'rank')), structure(list(fitted.values = structure(c(-0.253106466230895, -0.0529307911108286, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285, -0.253106466230895, -0.0529307911108285), .Names = c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')), assign = 0:1, qr = structure(list(qr = structure(c(-3.16227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, 0.316227766016838, -1.58113883008419, 1.58113883008419, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634, -0.240253073352042, 0.392202458681634), .Dim = c(10L, 2L), .Dimnames = list(c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'), c('(Intercept)', 'xTRUE')), assign = 0:1, contrasts = structure(list(x = 'contr.treatment'), .Names = 'x')), qraux = c(1.31622776601684, 1.39220245868163), pivot = 1:2, tol = 1e-07, rank = 2L), .Names = c('qr', 'qraux', 'pivot', 'tol', 'rank'), class = 'qr'), df.residual = 8L), .Names = c('fitted.values', 'assign', 'qr', 'df.residual')));c(argv[[1]],argv[[2]]);"); } @Test @@ -542,7 +541,6 @@ public class TestBuiltin_c extends TestBase { @Test public void testCombineBroken() { - assertEval(Ignored.Unknown, "{ c(1i,0/0) }"); // yes, this is done by GNU-R, note - // inconsistency with as.complex(0/0) + assertEval("{ c(1i,0/0) }"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ceiling.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ceiling.java index 40d7bf32dc93e354a0f00f075d4171a7223ea615..6ee6a89326e81f908bf5bc5a7e0b265d6bab25a5 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ceiling.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_ceiling.java @@ -49,7 +49,7 @@ public class TestBuiltin_ceiling extends TestBase { @Test public void testceiling7() { - assertEval(Ignored.Unknown, "argv <- list(1e+05);ceiling(argv[[1]]);"); + assertEval("argv <- list(1e+05);ceiling(argv[[1]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_clearPushBack.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_clearPushBack.java index dc9d200bf96053e72b289c9b8072bfab673b5c4d..a538128f5368b3b87e6dbbd0a14ac94fdadc1cde 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_clearPushBack.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_clearPushBack.java @@ -19,6 +19,6 @@ public class TestBuiltin_clearPushBack extends TestBase { @Test public void testclearPushBack1() { - assertEval(Ignored.Unknown, "argv <- list(FALSE); .Internal(clearPushBack(argv[[1]]))"); + assertEval("argv <- list(FALSE); .Internal(clearPushBack(argv[[1]]))"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_colMeans.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_colMeans.java index b35955c9cf4696abfab70ff619aae08fcb98bf37..25ae251a816d2125cae289712f6b4ae3a8685e58 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_colMeans.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_colMeans.java @@ -105,9 +105,6 @@ public class TestBuiltin_colMeans extends TestBase { assertEval("{colMeans(matrix(c(NA,NaN,NaN,NA),ncol=2,nrow=2))}"); assertEval("{ a = colSums(array(1:24,c(2,3,4))); colMeans(a)}"); - // Following fails not because of colMeans implementation, but because following code does - // not work: - // x <- c(NaN, 3+2i); xre <- Re(x); xim <- (0+1i) * Im(x); xre + xim - assertEval(Ignored.ImplementationError, "{colMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = TRUE)}"); + assertEval("{colMeans(matrix(c(NaN,4+5i,2+0i,5+10i),nrow=2,ncol=2), na.rm = TRUE)}"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_cumsum.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_cumsum.java index a4be02abad4a1a1228373a139caefe8b7884c9f1..b0a4a9fa33352790bad83148684027ac44dcc723 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_cumsum.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_cumsum.java @@ -107,12 +107,10 @@ public class TestBuiltin_cumsum extends TestBase { assertEval("{ cumsum((1:6)*(1+1i)) }"); assertEval(Ignored.Unknown, "{ cumsum(c(1,2,3,0/0,5)) }"); - assertEval(Ignored.Unknown, "{ cumsum(c(1,0/0,5+1i)) }"); + assertEval("{ cumsum(c(1,0/0,5+1i)) }"); assertEval("{ cumsum(as.raw(1:6)) }"); - // FIXME 1e+308 - assertEval(Ignored.Unknown, "{ cumsum(rep(1e308, 3) ) }"); - // FIXME 1e+308 - assertEval(Ignored.Unknown, "{ cumsum(c(1e308, 1e308, NA, 1, 2)) }"); + assertEval("{ cumsum(rep(1e308, 3) ) }"); + assertEval("{ cumsum(c(1e308, 1e308, NA, 1, 2)) }"); // FIXME missing warning assertEval(Ignored.Unknown, "{ cumsum(c(2000000000L, 2000000000L)) }"); // FIXME missing warning diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_deparse.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_deparse.java index 5df001b1eced2ec044ca27df289421189658b8b5..f1581fdeebbebcd9780417bd66467ff65e4c88be 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_deparse.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_deparse.java @@ -94,7 +94,7 @@ public class TestBuiltin_deparse extends TestBase { @Test public void testdeparse15() { - assertEval(Ignored.Unknown, "argv <- list(1e-07, 60L, FALSE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); + assertEval("argv <- list(1e-07, 60L, FALSE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); } @Test @@ -146,7 +146,7 @@ public class TestBuiltin_deparse extends TestBase { @Test public void testdeparse25() { - assertEval(Ignored.Unknown, "argv <- list(1e+05, 60L, FALSE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); + assertEval("argv <- list(1e+05, 60L, FALSE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); } @Test @@ -270,35 +270,24 @@ public class TestBuiltin_deparse extends TestBase { assertEval("argv <- list(quote(x[[i]] <- 0.9999997), 500L, TRUE, 69, -1L); .Internal(deparse(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]]))"); } + private static final String[] VALUES = new String[]{"TRUE", "c(T, F)", "17", "-17", "0L", "-0L", "16L", "-16L", "5i", "NA_integer_", "NA_complex_", + "NA_real_", "NA_character_", "1:2", "1:6", "0", "1", "1000", "10000", "99999", "100000000", "10000000000000", "0.1", "0.123", "0.00123", "0.0000000001", "0.0000000000000001", + "1.545234523452345252523452345", "Inf", "NaN", "-0", "-1", "-1000", "-10000", "-99999", "-100000000", "-10000000000000", "-0.1", "-0.123", "-0.00123", "-0.0000000001", + "-0.0000000000000001", "-1.545234523452345252523452345", "-Inf", "c(1L,2L,3L)", "c(1,2,3)", "c(NA_integer_, 1L,2L,3L)", "c(1L,2L,3L, NA_integer_)", "c(3L,2L,1L)", + "c(-2L,-1L,0L,1L)"}; + @Test public void testDeparse() { - assertEval("{ deparse(TRUE) }"); - assertEval("{ deparse(c(T, F)) }"); - assertEval("{ deparse(17) }"); - assertEval("{ deparse(-17) }"); - assertEval("{ deparse(0) }"); - assertEval("{ deparse(0L) }"); - assertEval("{ deparse(-0) }"); - assertEval("{ deparse(-0L) }"); - assertEval("{ deparse(16L) }"); - assertEval("{ deparse(-16L) }"); - assertEval("{ deparse(5i) }"); - assertEval("{ deparse(-5i) }"); - assertEval("{ deparse(199.1234-5i) }"); - assertEval("{ deparse(-199.1234+5.77i) }"); + assertEval(template("deparse(%0)", VALUES)); + assertEval(template("deparse(quote(cat(%0)))", VALUES)); + assertEval("deparse(-5i)"); + assertEval(Ignored.OutputFormatting, "deparse(quote(cat(-5i)))"); + assertEval("deparse(199.1234-5i)"); + assertEval(Ignored.OutputFormatting, "deparse(quote(cat(199.1234-5i)))"); + assertEval("deparse(-199.1234-5i)"); + assertEval(Ignored.OutputFormatting, "deparse(quote(cat(-199.1234-5i)))"); + assertEval(Ignored.OutputFormatting, "deparse(1.53160350210786e-322)"); assertEval("{ deparse(new.env()) }"); - assertEval("{ deparse(NA_integer_) }"); - assertEval("{ deparse(NA_complex_) }"); - assertEval("{ deparse(NA_real_) }"); - assertEval("{ deparse(NA_character_) }"); - assertEval("{ deparse(1:2) }"); - assertEval("{ deparse(1:6) }"); - assertEval("{ deparse(c(1L,2L,3L)) }"); - assertEval("{ deparse(c(1,2,3)) }"); - assertEval("{ deparse(c(NA_integer_, 1L,2L,3L)) }"); - assertEval("{ deparse(c(1L,2L,3L, NA_integer_)) }"); - assertEval("{ deparse(c(3L,2L,1L)) }"); - assertEval("{ deparse(c(-2L,-1L,0L,1L)) }"); assertEval("{ k <- 2 ; deparse(k) }"); assertEval("{ deparse(round) }"); assertEval("{ x<-expression(1); deparse(x) }"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_format.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_format.java index eaaffe5711ac037b4c58ad78ec2e3133da8e8299..8ef63beb180da0d71c6edd5735e613932e97e0b5 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_format.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_format.java @@ -214,8 +214,7 @@ public class TestBuiltin_format extends TestBase { @Test public void testformat40() { - assertEval(Ignored.Unknown, - "argv <- list(1e-07, TRUE, NULL, 0L, NULL, 3L, TRUE, NA, \".\"); .Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]], argv[[9]]))"); + assertEval("argv <- list(1e-07, TRUE, NULL, 0L, NULL, 3L, TRUE, NA, \".\"); .Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]], argv[[9]]))"); } @Test @@ -289,8 +288,7 @@ public class TestBuiltin_format extends TestBase { @Test public void testformat55() { - assertEval(Ignored.Unknown, - "argv <- list(1e-11, FALSE, NULL, 0L, NULL, 3L, TRUE, NA, \".\"); .Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]], argv[[9]]))"); + assertEval("argv <- list(1e-11, FALSE, NULL, 0L, NULL, 3L, TRUE, NA, \".\"); .Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]], argv[[9]]))"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java index f913795f49c098948f2de84210c9939a2c68d171..ceb2167bfc0ce15331bdba66838dca509d70021a 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_intToBits.java @@ -48,7 +48,7 @@ public class TestBuiltin_intToBits extends TestBase { assertEval(Output.IgnoreWarningContext, "intToBits('23rrff')"); assertEval("intToBits(new.env())"); assertEval("intToBits(environment)"); - assertEval(Ignored.ImplementationError, "intToBits(stdout())"); + assertEval("intToBits(stdout())"); assertEval(Output.IgnoreErrorContext, "intToBits(list(c(5,5,7,8),88,6L))"); assertEval("intToBits(list(5,5,7,8))"); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isOpen.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isOpen.java index 5d7d69457ecf37c6bb8b6f7586451a4ca6ee4616..c8a1eb477e192a440180a0f4184abebdf3eb452c 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isOpen.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isOpen.java @@ -24,6 +24,6 @@ public class TestBuiltin_isOpen extends TestBase { @Test public void testisOpen3() { - assertEval(Ignored.Unknown, "argv <- list(FALSE, 2L); .Internal(isOpen(argv[[1]], argv[[2]]))"); + assertEval("argv <- list(FALSE, 2L); .Internal(isOpen(argv[[1]], argv[[2]]))"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isnull.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isnull.java index bc0c4054611e94a5323db5b8a0673769f7013a8e..04b21e8ad2423abd094804f12666972e3c5192de 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isnull.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_isnull.java @@ -90,7 +90,7 @@ public class TestBuiltin_isnull extends TestBase { @Test public void testisnull16() { assertEval(Ignored.Unknown, - "argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { initPSandPDFfonts() new <- list() if (!missing(width)) new$width <- width if (!missing(height)) new$height <- height if (!missing(onefile)) new$onefile <- onefile if (!missing(title)) new$title <- title if (!missing(fonts)) new$fonts <- fonts if (!missing(version)) new$version <- version if (!missing(paper)) new$paper <- paper if (!missing(encoding)) new$encoding <- encoding if (!missing(bg)) new$bg <- bg if (!missing(fg)) new$fg <- fg if (!missing(pointsize)) new$pointsize <- pointsize if (!missing(pagecentre)) new$pagecentre <- pagecentre if (!missing(colormodel)) new$colormodel <- colormodel if (!missing(useDingbats)) new$useDingbats <- useDingbats if (!missing(useKerning)) new$useKerning <- useKerning if (!missing(fillOddEven)) new$fillOddEven <- fillOddEven if (!missing(compress)) new$compress <- compress old <- check.options(new, name.opt = '.PDF.Options', envir = .PSenv) if (!missing(family) && (inherits(family, 'Type1Font') || inherits(family, 'CIDFont'))) { enc <- family$encoding if (inherits(family, 'Type1Font') && !is.null(enc) && enc != 'default' && (is.null(old$encoding) || old$encoding == 'default')) old$encoding <- enc family <- family$metrics } if (is.null(old$encoding) || old$encoding == 'default') old$encoding <- guessEncoding() if (!missing(family)) { if (length(family) == 4L) { family <- c(family, 'Symbol.afm') } else if (length(family) == 5L) { } else if (length(family) == 1L) { pf <- pdfFonts(family)[[1L]] if (is.null(pf)) stop(gettextf('unknown family '%s'', family), domain = NA) matchFont(pf, old$encoding) } else stop('invalid 'family' argument') old$family <- family } version <- old$version versions <- c('1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '2.0') if (version %in% versions) version <- as.integer(strsplit(version, '[.]')[[1L]]) else stop('invalid PDF version') onefile <- old$onefile if (!checkIntFormat(file)) stop(gettextf('invalid 'file' argument '%s'', file), domain = NA) .External(C_PDF, file, old$paper, old$family, old$encoding, old$bg, old$fg, old$width, old$height, old$pointsize, onefile, old$pagecentre, old$title, old$fonts, version[1L], version[2L], old$colormodel, old$useDingbats, old$useKerning, old$fillOddEven, old$compress) invisible()});" + + "argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { invisible() });" + "do.call('is.null', argv)"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_length.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_length.java index 2b5df17cc5794b154d092dfc32ec1ecdd3daa449..62dee27127dced946709a9b53cb034dd31b42166 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_length.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_length.java @@ -29,7 +29,7 @@ public class TestBuiltin_length extends TestBase { @Test public void testlength3() { - assertEval(Ignored.Unknown, "argv <- list(structure(' \\\'Le français, c'est façile: Règles, Liberté, Egalité, Fraternité...\\\')\\n', Rd_tag = 'RCODE'));length(argv[[1]]);"); + assertEval("argv <- list(structure(' \\\'Le français, cest façile: Règles, Liberté, Egalité, Fraternité...\\\')\\n', Rd_tag = 'RCODE'));length(argv[[1]]);"); } @Test @@ -44,8 +44,7 @@ public class TestBuiltin_length extends TestBase { @Test public void testlength6() { - assertEval(Ignored.Unknown, - "argv <- list(list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cook's distance', 'Residuals vs Leverage', expression('Cook's dist vs Leverage ' * h[ii]/(1 - h[ii]))));length(argv[[1]]);"); + assertEval("argv <- list(list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cooks distance', 'Residuals vs Leverage', expression('Cooks dist vs Leverage ' * h[ii]/(1 - h[ii]))));length(argv[[1]]);"); } @Test @@ -195,9 +194,7 @@ public class TestBuiltin_length extends TestBase { @Test public void testlength37() { - assertEval(Ignored.Unknown, - "argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { initPSandPDFfonts() new <- list() if (!missing(width)) new$width <- width if (!missing(height)) new$height <- height if (!missing(onefile)) new$onefile <- onefile if (!missing(title)) new$title <- title if (!missing(fonts)) new$fonts <- fonts if (!missing(version)) new$version <- version if (!missing(paper)) new$paper <- paper if (!missing(encoding)) new$encoding <- encoding if (!missing(bg)) new$bg <- bg if (!missing(fg)) new$fg <- fg if (!missing(pointsize)) new$pointsize <- pointsize if (!missing(pagecentre)) new$pagecentre <- pagecentre if (!missing(colormodel)) new$colormodel <- colormodel if (!missing(useDingbats)) new$useDingbats <- useDingbats if (!missing(useKerning)) new$useKerning <- useKerning if (!missing(fillOddEven)) new$fillOddEven <- fillOddEven if (!missing(compress)) new$compress <- compress old <- check.options(new, name.opt = '.PDF.Options', envir = .PSenv) if (!missing(family) && (inherits(family, 'Type1Font') || inherits(family, 'CIDFont'))) { enc <- family$encoding if (inherits(family, 'Type1Font') && !is.null(enc) && enc != 'default' && (is.null(old$encoding) || old$encoding == 'default')) old$encoding <- enc family <- family$metrics } if (is.null(old$encoding) || old$encoding == 'default') old$encoding <- guessEncoding() if (!missing(family)) { if (length(family) == 4L) { family <- c(family, 'Symbol.afm') } else if (length(family) == 5L) { } else if (length(family) == 1L) { pf <- pdfFonts(family)[[1L]] if (is.null(pf)) stop(gettextf('unknown family '%s'', family), domain = NA) matchFont(pf, old$encoding) } else stop('invalid 'family' argument') old$family <- family } version <- old$version versions <- c('1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '2.0') if (version %in% versions) version <- as.integer(strsplit(version, '[.]')[[1L]]) else stop('invalid PDF version') onefile <- old$onefile if (!checkIntFormat(file)) stop(gettextf('invalid 'file' argument '%s'', file), domain = NA) .External(C_PDF, file, old$paper, old$family, old$encoding, old$bg, old$fg, old$width, old$height, old$pointsize, onefile, old$pagecentre, old$title, old$fonts, version[1L], version[2L], old$colormodel, old$useDingbats, old$useKerning, old$fillOddEven, old$compress) invisible()});" + - "do.call('length', argv)"); + assertEval("argv <- list(function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { invisible()}); do.call('length', argv)"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levels.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levels.java index e73524c0e5f798c75ecf1be8e69a5d8f1c5ac4be..20125e3e04fa1e90698e325f7a7603bf653270f3 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levels.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levels.java @@ -37,6 +37,6 @@ public class TestBuiltin_levels extends TestBase { assertEval("{ x <- 1 ; levels(x)<-c(3, \"cat\"); levels(x);}"); assertEval("{ x <- 1 ; levels(x)<-c(1, \"cat\", 4.5, \"3\"); levels(x);}"); assertEval(Output.IgnoreErrorContext, "{ x <- 1 ; levels(x)<-NULL; levels(notx)}"); - assertEval(Ignored.Unknown, "{ x <- NULL; levels(x)<-\"dog\"; levels(x)}"); + assertEval("{ x <- NULL; levels(x)<-\"dog\"; levels(x)}"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levelsassign.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levelsassign.java index 97b80ce231d650ff28b9220aee324e82d02eca91..1247073e1f1d22ec5d1d5a209b6fb400b8038212 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levelsassign.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_levelsassign.java @@ -39,7 +39,7 @@ public class TestBuiltin_levelsassign extends TestBase { @Test public void testlevelsassign6() { - assertEval(Ignored.Unknown, "argv <- list(NULL, NULL);`levels<-`(argv[[1]],argv[[2]]);"); + assertEval("argv <- list(NULL, NULL);`levels<-`(argv[[1]],argv[[2]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java index 98dd3d94abf4c245a35ac28372e8ed7ec8d06c66..0317997c24916e2917819c231054d6cd5b44a61a 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_list.java @@ -29,7 +29,7 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist3() { - assertEval(Ignored.Unknown, + assertEval(Ignored.OutputFormatting, "argv <- list(x = c(9.5367431640625e-07, 1.9073486328125e-06, 3.814697265625e-06, 7.62939453125e-06, 1.52587890625e-05, 3.0517578125e-05, 6.103515625e-05, 0.0001220703125, 0.000244140625, 0.00048828125, 0.0009765625, 0.001953125, 0.00390625, 0.0078125, 0.015625, 0.03125, 0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024), y = c(3.69420518444359e+25, 2.30887824027777e+24, 1.44304890017492e+23, 9.01905562612606e+21, 5.63690976641081e+20, 35230686042118275072, 2201917878145066496, 137619867512235136, 8601241751556820, 537577617482832, 33598603095309.8, 2099913194115.17, 131244699796.888, 8202825028.58974, 512684387.219832, 32044730.0464007, 2003284.70114408, 125327.674230857, 7863.68742857025, 499.272560819512, 33.2784230289721, 2.7659432263306, 0.488936768533843, -0.282943224311172, 7.32218543045282e-05, -0.00636442868227041, -0.0483709204009262, -0.0704795507649514, 0.0349437746169591, -0.0264830837608839, 0.0200901469411759), xlab = NULL, ylab = NULL);list(argv[[1]],argv[[2]],argv[[3]],argv[[4]]);"); } @@ -65,13 +65,13 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist10() { - assertEval(Ignored.Unknown, + assertEval(Output.IgnoreWhitespace, "argv <- list(linkfun = function (mu) .Call(C_logit_link, mu), linkinv = function (eta) .Call(C_logit_linkinv, eta), mu.eta = function (eta) .Call(C_logit_mu_eta, eta), valideta = function (eta) TRUE, name = 'logit');list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]]);"); } @Test public void testlist11() { - assertEval(Ignored.Unknown, + assertEval(Output.IgnoreWhitespace, "argv <- list(linkfun = function (mu) log(mu), linkinv = function (eta) pmax(exp(eta), .Machine$double.eps), mu.eta = function (eta) pmax(exp(eta), .Machine$double.eps), valideta = function (eta) TRUE, name = 'log');list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]]);"); } @@ -87,12 +87,12 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist14() { - assertEval(Ignored.Unknown, "argv <- list(error = function (e) -1);list(argv[[1]]);"); + assertEval(Output.IgnoreWhitespace, "argv <- list(error = function (e) -1);list(argv[[1]]);"); } @Test public void testlist15() { - assertEval(Ignored.Unknown, + assertEval(Ignored.OutputFormatting, "argv <- list(error = function (e) warning(gettextf('%s namespace cannot be unloaded:\\n ', sQuote(pkgname)), conditionMessage(e), call. = FALSE, domain = NA));list(argv[[1]]);"); } @@ -113,14 +113,14 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist19() { - assertEval(Ignored.Unknown, + assertEval(Ignored.ImplementationError, "argv <- list(arguments = structure('object', simpleOnly = TRUE), generic = structure(function (object) standardGeneric('show'), generic = structure('show', package = 'methods'), package = 'methods', group = list(), valueClass = character(0), signature = structure('object', simpleOnly = TRUE), default = structure(function (object) showDefault(object, FALSE), target = structure('ANY', class = structure('signature', package = 'methods'), .Names = 'object', package = 'methods'), defined = structure('ANY', class = structure('signature', package = 'methods'), .Names = 'object', package = 'methods'), generic = structure('show', package = 'methods'), class = structure('derivedDefaultMethod', package = 'methods')), skeleton = quote((function (object) showDefault(object, FALSE))(object)), class = structure('standardGeneric', package = 'methods')));list(argv[[1]],argv[[2]]);"); } @Test public void testlist20() { - assertEval(Ignored.Unknown, - "argv <- list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cook's distance', 'Residuals vs Leverage', expression('Cook's dist vs Leverage ' * h[ii]/(1 - h[ii])));list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]]);"); + assertEval(Output.IgnoreWhitespace, + "argv <- list('Residuals vs Fitted', 'Normal Q-Q', 'Scale-Location', 'Cooks distance', 'Residuals vs Leverage', expression('Cooks dist vs Leverage ' * h[ii]/(1 - h[ii])));list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]]);"); } @Test @@ -165,13 +165,12 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist29() { - assertEval(Ignored.Unknown, - "argv <- list(assign = c(0L, 1L, 1L, 1L), qr = structure(list(qr = structure(c(-28.8270706107991, 0.273146306828071, 0.312206540911182, 0.247733407426682, 0.216636580341913, 0.0849718577324175, 0.298411357268471, 0.294351149612123, 0.247733407426682, 0.308328048219576, 0.125075187976724, 0.138758462627192, 0.190002850064127, 0.1835601922086, 0.232705016165824, 0.069379231313596, 0.120168353625222, 0.222121918799273, 0.190002850064127, 0.247733407426682, 0.0917800961043001, -10.2334366187554, 13.7940847818881, 0.190374922931528, 0.151060987411652, 0.132099001405849, -0.125761881229701, -0.441661211981173, -0.435651935890569, -0.366655739827817, -0.45633832676795, -0.185116476853374, 0.084611076858457, 0.115858488525451, 0.111929933764425, 0.141897089628727, 0.0423055384292285, 0.0732753420009814, 0.13544380924692, 0.115858488525451, 0.151060987411652, 0.0559649668822123, -4.26682272578616, -3.16543363464969, 9.7352069177467, 0.118607830555703, 0.10371953900067, 0.00616533725634264, 0.0216519528674631, 0.0213573547475655, 0.0179748924786157, 0.0223714822011986, 0.00907513071804667, -0.344446140042991, -0.471652301867824, -0.45565941330494, -0.577653737792655, -0.172223070021495, 0.0575332486360618, 0.106345765721762, 0.0909680534393656, 0.118607830555703, 0.0439417444752447, -4.89123580760852, -3.62866782508622, -3.32364207119197, 9.63649238427318, 0.135617489972887, 0.00806142768852949, 0.0283108036266689, 0.0279256046761512, 0.0235028985277947, 0.0292516173165799, 0.0118661002643811, 0.0254562434016423, 0.0348573968510539, 0.0336754446773372, 0.0426914180233895, 0.0127281217008212, -0.284250391934964, -0.525414891452651, -0.449439332155022, -0.585997195035538, -0.217099822893807), assign = c(0L, 1L, 1L, 1L), contrasts = structure(list(trt = 'contr.treatment'), .Names = 'trt'), .Dim = c(21L, 4L), .Dimnames = list(c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'), c('(Intercept)', 'trt2', 'trt3', 'trt4'))), qraux = c(1.21663658034191, 1.16655707135303, 1.14947576464323, 1.15508453302121), pivot = 1:4, tol = 1e-07, rank = 4L), .Names = c('qr', 'qraux', 'pivot', 'tol', 'rank'), class = 'qr'), df.residual = 17L);list(argv[[1]],argv[[2]],argv[[3]]);"); + assertEval("argv <- list(assign = c(0L, 1L, 1L, 1L), qr = structure(list(qr = structure(c(-28.8270706107991, 0.273146306828071, 0.312206540911182, 0.247733407426682, 0.216636580341913, 0.0849718577324175, 0.298411357268471, 0.294351149612123, 0.247733407426682, 0.308328048219576, 0.125075187976724, 0.138758462627192, 0.190002850064127, 0.1835601922086, 0.232705016165824, 0.069379231313596, 0.120168353625222, 0.222121918799273, 0.190002850064127, 0.247733407426682, 0.0917800961043001, -10.2334366187554, 13.7940847818881, 0.190374922931528, 0.151060987411652, 0.132099001405849, -0.125761881229701, -0.441661211981173, -0.435651935890569, -0.366655739827817, -0.45633832676795, -0.185116476853374, 0.084611076858457, 0.115858488525451, 0.111929933764425, 0.141897089628727, 0.0423055384292285, 0.0732753420009814, 0.13544380924692, 0.115858488525451, 0.151060987411652, 0.0559649668822123, -4.26682272578616, -3.16543363464969, 9.7352069177467, 0.118607830555703, 0.10371953900067, 0.00616533725634264, 0.0216519528674631, 0.0213573547475655, 0.0179748924786157, 0.0223714822011986, 0.00907513071804667, -0.344446140042991, -0.471652301867824, -0.45565941330494, -0.577653737792655, -0.172223070021495, 0.0575332486360618, 0.106345765721762, 0.0909680534393656, 0.118607830555703, 0.0439417444752447, -4.89123580760852, -3.62866782508622, -3.32364207119197, 9.63649238427318, 0.135617489972887, 0.00806142768852949, 0.0283108036266689, 0.0279256046761512, 0.0235028985277947, 0.0292516173165799, 0.0118661002643811, 0.0254562434016423, 0.0348573968510539, 0.0336754446773372, 0.0426914180233895, 0.0127281217008212, -0.284250391934964, -0.525414891452651, -0.449439332155022, -0.585997195035538, -0.217099822893807), assign = c(0L, 1L, 1L, 1L), contrasts = structure(list(trt = 'contr.treatment'), .Names = 'trt'), .Dim = c(21L, 4L), .Dimnames = list(c('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21'), c('(Intercept)', 'trt2', 'trt3', 'trt4'))), qraux = c(1.21663658034191, 1.16655707135303, 1.14947576464323, 1.15508453302121), pivot = 1:4, tol = 1e-07, rank = 4L), .Names = c('qr', 'qraux', 'pivot', 'tol', 'rank'), class = 'qr'), df.residual = 17L);list(argv[[1]],argv[[2]],argv[[3]]);"); } @Test public void testlist30() { - assertEval(Ignored.Unknown, "argv <- list(function (x, i, j, ...) x@aa[[i]]);list(argv[[1]]);"); + assertEval(Output.IgnoreWhitespace, "argv <- list(function (x, i, j, ...) x@aa[[i]]);list(argv[[1]]);"); } @Test @@ -181,13 +180,13 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist32() { - assertEval(Ignored.Unknown, - "argv <- list(structure(function (e1, e2) standardGeneric('Ops'), generic = structure('Ops', package = 'base'), package = 'base', group = list(), valueClass = character(0), signature = c('e1', 'e2'), default = quote(`\\001NULL\\001`), skeleton = quote((function (e1, e2) stop('invalid call in method dispatch to 'Ops' (no default method)', domain = NA))(e1, e2)), groupMembers = list('Arith', 'Compare', 'Logic'), class = structure('groupGenericFunction', package = 'methods')));list(argv[[1]]);"); + assertEval(Ignored.ImplementationError, + "argv <- list(structure(function (e1, e2) standardGeneric('Ops'), generic = structure('Ops', package = 'base'), package = 'base', group = list(), valueClass = character(0), signature = c('e1', 'e2'), default = quote(`\\001NULL\\001`), skeleton = quote((function (e1, e2) stop('invalid call in method dispatch to Ops (no default method)', domain = NA))(e1, e2)), groupMembers = list('Arith', 'Compare', 'Logic'), class = structure('groupGenericFunction', package = 'methods')));list(argv[[1]]);"); } @Test public void testlist33() { - assertEval(Ignored.Unknown, + assertEval(Ignored.OutputFormatting, "argv <- list(tables = structure(list(`Grand mean` = 103.87323943662, N = structure(c(78.7365206866197, 98.5088731171753, 113.842206450509, 123.008873117175), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N'), class = 'mtable'), `V:N` = structure(c(79.5323303457107, 86.1989970123773, 69.7732394366197, 98.0323303457106, 108.032330345711, 89.1989970123773, 114.198997012377, 116.698997012377, 110.365663679044, 124.365663679044, 126.365663679044, 118.032330345711), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')), class = 'mtable')), .Names = c('Grand mean', 'N', 'V:N')), n = structure(list(N = structure(c(17, 18, 18, 18), .Dim = 4L, .Dimnames = structure(list(N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = 'N')), `V:N` = structure(c(6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6), .Dim = 3:4, .Dimnames = structure(list(V = c('Golden.rain', 'Marvellous', 'Victory'), N = c('0.0cwt', '0.2cwt', '0.4cwt', '0.6cwt')), .Names = c('V', 'N')))), .Names = c('N', 'V:N')));list(argv[[1]],argv[[2]]);"); } @@ -243,13 +242,12 @@ public class TestBuiltin_list extends TestBase { @Test public void testlist44() { - assertEval(Ignored.Unknown, - "argv <- list(trace = 0, fnscale = 1, parscale = 1, ndeps = 0.001, maxit = 100L, abstol = -Inf, reltol = 1.49011611938477e-08, alpha = 1, beta = 0.5, gamma = 2, REPORT = 10, type = 1, lmm = 5, factr = 1e+07, pgtol = 0, tmax = 10, temp = 10);list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]],argv[[7]],argv[[8]],argv[[9]],argv[[10]],argv[[11]],argv[[12]],argv[[13]],argv[[14]],argv[[15]],argv[[16]],argv[[17]]);"); + assertEval("argv <- list(trace = 0, fnscale = 1, parscale = 1, ndeps = 0.001, maxit = 100L, abstol = -Inf, reltol = 1.49011611938477e-08, alpha = 1, beta = 0.5, gamma = 2, REPORT = 10, type = 1, lmm = 5, factr = 1e+07, pgtol = 0, tmax = 10, temp = 10);list(argv[[1]],argv[[2]],argv[[3]],argv[[4]],argv[[5]],argv[[6]],argv[[7]],argv[[8]],argv[[9]],argv[[10]],argv[[11]],argv[[12]],argv[[13]],argv[[14]],argv[[15]],argv[[16]],argv[[17]]);"); } @Test public void testlist45() { - assertEval(Ignored.Unknown, "argv <- list(error = function (...) {});list(argv[[1]]);"); + assertEval(Output.IgnoreWhitespace, "argv <- list(error = function (...) {});list(argv[[1]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java index f201c9e1243b2b5b93c6bad34f57413578e5b1ce..e1f119b9e0dc06d9e252fab82b9e7d9552a27028 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_operators.java @@ -1613,7 +1613,7 @@ public class TestBuiltin_operators extends TestBase { @Test public void testoperators322() { - assertEval(Ignored.Unknown, "argv <- list(c(-1, 1), structure(c(1e-05, 1e-04, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000, 1e+05), .Dim = c(1L, 11L)));`%*%`(argv[[1]],argv[[2]]);"); + assertEval("argv <- list(c(-1, 1), structure(c(1e-05, 1e-04, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000, 1e+05), .Dim = c(1L, 11L)));`%*%`(argv[[1]],argv[[2]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_options.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_options.java index 9e6696ec52b12a5a9bc0da34f275434966ca848b..fcdff56933fddd01069b518af04d50d582e6407e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_options.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_options.java @@ -34,7 +34,7 @@ public class TestBuiltin_options extends TestBase { @Test public void testoptions4() { - assertEval(Ignored.Unknown, "argv <- list('ts.eps'); .Internal(options(argv[[1]]))"); + assertEval("argv <- list('ts.eps'); .Internal(options(argv[[1]]))"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_prod.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_prod.java index 831ddca35d42ef67a58e8f26dae1d065aa957c3f..264a3af783fdfbb7ffb7d99604b181b0788238b5 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_prod.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_prod.java @@ -24,7 +24,7 @@ public class TestBuiltin_prod extends TestBase { @Test public void testprod2() { - assertEval(Ignored.Unknown, "argv <- list(c(1000L, 1000L));prod(argv[[1]]);"); + assertEval("argv <- list(c(1000L, 1000L));prod(argv[[1]]);"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_pushBackLength.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_pushBackLength.java index dde747203f0d5de8f0eaee6bd76c775cc65d8071..e53133c6f41cf573657a69054aeadedd6a09d6a8 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_pushBackLength.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_pushBackLength.java @@ -19,6 +19,6 @@ public class TestBuiltin_pushBackLength extends TestBase { @Test public void testpushBackLength1() { - assertEval(Ignored.Unknown, "argv <- list(FALSE); .Internal(pushBackLength(argv[[1]]))"); + assertEval("argv <- list(FALSE); .Internal(pushBackLength(argv[[1]]))"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java index 814d34bb3a8b387cee833b1dbf5a5297ba6e13bc..c634f9bcf0ba0af38f727a6d98142f9ef0bc52b6 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java @@ -84,7 +84,7 @@ public class TestBuiltin_repint extends TestBase { @Test public void testrepint14() { - assertEval(Ignored.OutputFormatting, "argv <- list(2e-08, 9); .Internal(rep.int(argv[[1]], argv[[2]]))"); + assertEval("argv <- list(2e-08, 9); .Internal(rep.int(argv[[1]], argv[[2]]))"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java index f77ea55ad9e0df862695904d94611606dfbe520c..9596b616888254622533060e394badc00184cc68 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_substitute.java @@ -59,7 +59,7 @@ public class TestBuiltin_substitute extends TestBase { assertEval("{ env <- new.env() ; z <- 0 ; delayedAssign(\"var\", z+2, assign.env=env) ; substitute(var, env=env) }"); assertEval("{ env <- new.env() ; z <- 0 ; delayedAssign(\"var\", z+2, assign.env=env) ; z <- 10 ; substitute(var, env=env) }"); - assertEval(Ignored.ReferenceError, "{ substitute(if(a) { x } else { x * a }, list(a = quote(x + y), x = 1)) }"); + assertEval("{ substitute(if(a) { x } else { x * a }, list(a = quote(x + y), x = 1)) }"); assertEval("{ f <- function() { substitute(x(1:10), list(x=quote(sum))) } ; f() }"); assertEval("{ substitute(x + y, list(x=1)) }"); assertEval("{ f <- function(expra, exprb) { substitute(expra + exprb) } ; f(a * b, a + b) }"); @@ -69,7 +69,7 @@ public class TestBuiltin_substitute extends TestBase { assertEval("{ substitute(x <- x + 1, list(x = 1) }"); assertEval("{ f <- function(y) { substitute(y) } ; f() }"); - assertEval(Ignored.Unknown, "{ substitute(function(x, a) { x + a }, list(a = quote(x + y), x = 1)) }"); + assertEval(Output.IgnoreWhitespace, "{ substitute(function(x, a) { x + a }, list(a = quote(x + y), x = 1)) }"); // GNU R generates warning here, but the test has been included nevertheless to make sure // that FastR does not crash here diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tolower.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tolower.java index f216fb17383d13f45e41e65f7a756002c2cc96a6..7128a9526223d8293b3fee9d16a167918f2a8e1b 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tolower.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tolower.java @@ -57,8 +57,7 @@ public class TestBuiltin_tolower extends TestBase { assertEval("{ tolower(c(\"Hello\",\"ByE\")) }"); assertEval("{ tolower(c()) }"); - // double-to-string conversion problem - assertEval(Ignored.OutputFormatting, "{ tolower(1E100) }"); + assertEval("{ tolower(1E100) }"); assertEval("{ tolower(c(a=\"HI\", \"HELlo\")) }"); assertEval("{ tolower(NA) }"); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_toupper.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_toupper.java index a6a2008deac27591833cea3559e7b408bbcffd1f..fe8582dd9dbe41b8ac5bf513a9ccc690285fce6e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_toupper.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_toupper.java @@ -48,7 +48,7 @@ public class TestBuiltin_toupper extends TestBase { assertEval("{ toupper(c()) }"); assertEval("{ toupper(NA) }"); - assertEval(Ignored.OutputFormatting, "{ toupper(1E100) }"); + assertEval("{ toupper(1E100) }"); assertEval("{ m <- matrix(\"hi\") ; toupper(m) }"); assertEval("{ toupper(c(a=\"hi\", \"hello\")) }"); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_typeof.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_typeof.java index d1ed3f5fcc3c5d4effa1d444c3162f6cb2bb1caf..999cd43a8cc0e60d2078a92e75120bd7e9f02734 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_typeof.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_typeof.java @@ -184,9 +184,7 @@ public class TestBuiltin_typeof extends TestBase { @Test public void testtypeof35() { - assertEval(Ignored.Unknown, - "argv <- structure(list(x = function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { initPSandPDFfonts() new <- list() if (!missing(width)) new$width <- width if (!missing(height)) new$height <- height if (!missing(onefile)) new$onefile <- onefile if (!missing(title)) new$title <- title if (!missing(fonts)) new$fonts <- fonts if (!missing(version)) new$version <- version if (!missing(paper)) new$paper <- paper if (!missing(encoding)) new$encoding <- encoding if (!missing(bg)) new$bg <- bg if (!missing(fg)) new$fg <- fg if (!missing(pointsize)) new$pointsize <- pointsize if (!missing(pagecentre)) new$pagecentre <- pagecentre if (!missing(colormodel)) new$colormodel <- colormodel if (!missing(useDingbats)) new$useDingbats <- useDingbats if (!missing(useKerning)) new$useKerning <- useKerning if (!missing(fillOddEven)) new$fillOddEven <- fillOddEven if (!missing(compress)) new$compress <- compress old <- check.options(new, name.opt = '.PDF.Options', envir = .PSenv) if (!missing(family) && (inherits(family, 'Type1Font') || inherits(family, 'CIDFont'))) { enc <- family$encoding if (inherits(family, 'Type1Font') && !is.null(enc) && enc != 'default' && (is.null(old$encoding) || old$encoding == 'default')) old$encoding <- enc family <- family$metrics } if (is.null(old$encoding) || old$encoding == 'default') old$encoding <- guessEncoding() if (!missing(family)) { if (length(family) == 4L) { family <- c(family, 'Symbol.afm') } else if (length(family) == 5L) { } else if (length(family) == 1L) { pf <- pdfFonts(family)[[1L]] if (is.null(pf)) stop(gettextf('unknown family '%s'', family), domain = NA) matchFont(pf, old$encoding) } else stop('invalid 'family' argument') old$family <- family } version <- old$version versions <- c('1.1', '1.2', '1.3', '1.4', '1.5', '1.6', '1.7', '2.0') if (version %in% versions) version <- as.integer(strsplit(version, '[.]')[[1L]]) else stop('invalid PDF version') onefile <- old$onefile if (!checkIntFormat(file)) stop(gettextf('invalid 'file' argument '%s'', file), domain = NA) .External(C_PDF, file, old$paper, old$family, old$encoding, old$bg, old$fg, old$width, old$height, old$pointsize, onefile, old$pagecentre, old$title, old$fonts, version[1L], version[2L], old$colormodel, old$useDingbats, old$useKerning, old$fillOddEven, old$compress) invisible()}), .Names = 'x');" + - "do.call('typeof', argv)"); + assertEval("argv <- structure(list(x = function(file = ifelse(onefile, 'Rplots.pdf', 'Rplot%03d.pdf'), width, height, onefile, family, title, fonts, version, paper, encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, useKerning, fillOddEven, compress) { invisible() }), .Names = 'x'); do.call('typeof', argv)"); } @Test diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_warning.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_warning.java index f9fcb5c35ef51560be7e3e92c5130d8f64917a99..5a5983658c5f28085de17f339f515b5c38ebc13e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_warning.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_warning.java @@ -19,9 +19,9 @@ import com.oracle.truffle.r.test.TestBase; public class TestBuiltin_warning extends TestBase { @Test - public void testwarning1() { - assertEval(Ignored.Unknown, - "argv <- list('OGXAGDISZSNLYDBXLBQMQHECNODETNWRASXQCXRDTYKHGFOTROVTAJBUYOWPRNTXVBABWOIYPNJIVBJWSRJODUXFUPYENWWAZMKKCEKIKHOEYBJZQBKLNLQDXOODTMUBVHHQYAJKLSXQXTDDELCFOKOVQKSCHPEWWMUHBLMIENAUOQMHLUPKVIPLGOGOLDQODOLLVSLNGBKAWZSVXOOHRGHSSEHJCSODZOUWWUQQHAKJKEIKTHDAUMUCCDTTZQHFUSFTWNPYYRBVMKHGKYGOFFSIDBYODOOVSOSTJHNGVKBYFKQQIDXPTXNJBWNFJFLGDBRHDZKKQXFOSKCQAFRWUDKUSPDOLTAFWCZKWXMSMZBEUOKZGNCVJUFYINCXYBMFWNAHIPGBCSYICIQLUHOBESVNOADWCGZPGPADSBQYCZASLOWOTQIKFWPTOHTOINVNFWJHUTVOAMOVSOBDRCFJWGSCUGOAUIXJZJMMAQNIPQLESTVNHLJGRYHQNPAADACMFVGMQEVLGHEPDEIEKPRVJYAPMJWBWEFWBGZRLJLURMBGGFBMGTOYCYSXPEESPIUIWPKYMCMZYLWHUUKJQWRNDPBMTTBLNHPTSDOUGSVDYTVEAWXDMMSBTKLSMZVVTCVVZBTKPVAAZTIVZFQLYZLFSOPLLPLYVFKKAJKESATLTABKQFVSXKKGJGYMBUIORHBLPZZCMKKIRHKZUIVFNEDXCWHAUJATALGMQCECVQQKLJUXQPIBPETHQDGVUBWDPMOSMZZKPILFAABTMWPEPXUNKRXXEGCUCVUYMYUWKCHSJJANDXBUWAHQUKYKLHPOBTFRNQQHFOZIIANPTYMCGWWVYQMESCLYVSDPZQHBBWJYONYCVJOICUFRLFZLAYWPHVYWDZOADAVUYJZVUQZMXKLYRAEMLZXISXRQDPHLFGQMEHSPDBZJRVGAPVJIQYPNEVFRQBYPWNGPURMMQLPAZKDWOWAWSUWNYFAIRIYUIMKUMAQGTHXWMBPPZIRYORCWNFKXMRHVGJGYKDXJWDJGBUFKIPOZGTZOKVCNLHEWOOPSQPBOPQQCCRVDUMZMOJNBOYNLAABEMUHTNHARBVDRVGDTFGNMJUOEZGDFJJHBYOFWMOUQDIYETLDFRDKLQGMEWECXHTKLEDDNMQLBAFWGPPZETGIAZLZFCGRPKSOPPFCTPYYTLELTXXVFBMPCYEXDRUTRDWQVEAIHVYDXPKRTNKZBDSSCMQKZRIDHCAITYKNBQJLZRSEFWVSHFMNFTASVYRHFWAWNLYEJDDROMVZNSEJBDCHKQSIZSEJHLVGKZDQSPZBZTLDLELVBIVBUZRAMSAVTGTRERYWURPKDVSUAEPCSOHKRECNCCQOHGQVBZAEIWEUWMQIMYGAZGRBZXWLUHHZZMTIGQIBZRWMDRAEXDGGIFAXYYLLBJXJNNEOCPOFXFKWGHWQWMXEQSEORXIOAJQPVDRFPSNJSMGLCGOAFQSUBCYYXQEXXEBOJLMUVHSMBAGFKOSGXMGIRSOWKFMJGYMAYJAZJZDOUFSOAGMYZFOQXTPFXUIFRTMWREAWCILQIPVIJPMCVLTUKATBNDRBURGEBAVGBJPUIDUWZRGQLFPZFLIACKBAEJPIMTEVIGIUGXDFQGSTGOXSVXHQDWRTIRMQUXNEHDGSQLQNIUQUEKZJCNYWORNYCMUWXVDSTRXKYLFPENKVOLFMGIWLLMVAICVMNKLCAACJTTCZDMOYVNJOUQCEVMUVHFQJXDEQERNTICKOTEPMYXDHSTNFEIBRTGMBCXPQLHYAEZUZGPBUWXAGPJSBRFHTEKRKOLDAEUDBAKWILKJYYHSFYBZFIDPRZFVQZLSBQFXVWVKZMMIBXFHROZCOXWXUEDDLUXLVMRTRWIECAXUCCENTDCOHLDXTLRHRJRKSHTOAJLKOWTBDIITDZWPXAUXCMRMWKOQHXDOGBTPIXPYXKSVXDBZKSNKSWDJUFQJPOSVLJVNTWLKWSPSTGHFYHMAUKLYKTUFBIRTQYAJQCADTWIGGYMSXPGXSBQWDYBEAKSRMCZOSHUQXKITSLUHXQUSRSFPTGRCTYRRKDMCTJOJFNKWCBEYLRAMBQWFHWAULCXETLREWBFGTKHCNLZDVAUFDEFYZIDRPIVHVDWBLRFYJQERTMWVZRQBEAWLVDKSBIUVWYJYSKKFTLLCJXOAKCHSJQMUPEYBCVKSTZYDRAMUJYRLVULIOWPQTSWCPGMHXKOCYTMESPBBLEMZFSDNVDVGCERRDZDYSOGIVXNXSLHZDRVFPEKGNRXIGIFDGYBNUVOGPDMCHRFKUFBURNFEPBFVHAZCTVAWOIIQDIPTORJXZTANUFKOTIILHQBPKBZQVKYJVAWBVPRSHRHOBJMNVNWPNQHOZXUVXPJTMARKYDJXUNAGHRCZWHLIJHXHWVEFRMCDIPYKYCWGHEACDFVAKXAILOXNTQFNBUFWNGVBAPWLNFSNBVGNICWQWDRPYPHYVLMTGVVKXBVMHQIQXOQKUWJMXMFRTQFYAXCVOPVGBDCEYFIRSHHLJXNPNNLFIGAFZLZGDOLWXQVHXDDPZNDEUQOTIKJQEGYZNBPSPNJCDJPGAICGDJDOOEYQBERXVLEEMKUUKQKJQYMQHKLHZWVSEBCWJUXQPBGKVJLODARVYBRKODGISEDOBLMMMTZVCWORUKWEMDFXMOZZRUASXLSVMVMALMPLHRPZEZPTWQSZWTDCNFTMDVYHDSOCOPOKKXRYDOCQGMMVXOYHQQQGKENPCSPRHJQYJFGMKIJRWMPMRRCCYKOYFFQVVDCUYQLRWNNUJYAIDIMTUKAYXPXQDDRXDXLBVZUHFFJFECQUBCADYEZSIIUMMGYRSHPYANWHJXCNKELEWRDDHYYEXBWBYEPSHASIWMZCAOPATBMYBYUWFZSHVYXDBVWBFSCAXBWDKFUOFLLXMYKUTIYNILMVYMJFASSAENEGXJZSDPWTMNOFXEPMFZIBTOAHWGBSNKLXXFOBOCTCFTKOWSTPCVTWCVHIXEASAVXEFUXGLKRHUIGAJPIEZGODRLJKKVXTJRNAQQIAZZBNZCJMXOAWVWVACVFAOTWBFKKPYZDHVZRCDIGGUEPRXRHABEWBHXOUYRKZYNDQVDPZFKCHNIPZPDSRILHVPUHDXAOZGZAGGYZTHKFTTMRTUPKRWLDQMYGUTROPWMZBOEHVFPKHMTZEDPDFIGSSUHEMOQMDWZWWJQNATVBXJSSRHHMBMPGZEOKDJZUJYSMVRJMPSJPNPXWVEIYYQUOBHMLYQAAHHVSRJEFSGFPDBAVUAPHPFYCDDHPFLLJZAWCELSEDFEWTOWDJIAKSGQEUMBUWPPKBQNUOLVRBDVKNIQPFQJLKFGELPKXHFOJYQLHAOIMVFCUEUAWVXJHXIYPPTKJLISGWYMAYLVNMDBQJABVTBSAPFQONGJHEQADNMNRZYYRTYFRCMTAECUJQTGJISODHKNPIJYOPGKQJMEMYAJGPBQBHILLZPIWIRXVCHNJVWRNUBGFVVVHAQTNJIJJOQKPSXYKQECOVTOZZIEJOVSXSGITFHXEDTOOSQTHZZATJJATECSLAXULDVSKEAIEOPHYSHSPKEAEPFBXWVPSUWSIMUKPHDHFFNXPGJOERAARFJESPBKCKLQCIAIUTVBDQKEDDQNMWETFEDXRLSSQXFLAESTLJMAWQEOWFIUGBKFQQKDELKBAWHZRWLYTHRXTRTCBJNYYQINRWOCSVKFGANPPXLGNBRTFEWHZSYTIJAXNIVUUNCXDVOOTKVWUKESCBAQSEUUQYDBYWJKZCSOWTQEMLEVHQMOPCMELROGHAHSBZUXNIMCFJKRDMDOAUVFOPDSWYTAUIKAIILVRJUJYUHGEXOXZOIRWZKTILGSKRYBQTRWUWZOUPBMDOBTACXZIQQPWUHBLLQTPMFLTGSUKICMTNYAXPVLIKHDHHIATLPCAEAYMUOCALFUNOYBAOCGDDOBQTJSBPGEHPKQYNGTNDGDCQTLDVZANUNGMHZSTAKLDGDKFNXNLHFBUYXHGIIPQCMBRYYXMJKYRKMTTMKKRRBLNEHFDWIBQTNNTXVNUFJKCAKEWPLNBTRDPQIROHXBXVIKNOBIGCZIYVKUGUCFZBORHMWMDITBYRKDYGTAGZSQGCHOUHIYMZVZCIYQZZSKRGIVRUIQPFGWUATXXDZXGXVLBWIGVZFCQWENJVMGHVAKPNRNOVIAVUWBAPWLAKJMDMGMXNSBRUAAPUTGULEPVUCBYCFLUWQKDWWINMUXPVUHNHWSJZSGQIUIGBOAHHVDGLYIUDMNXJMLSBSRRMHJCGBMIFTGKSCDZZTAZTXFHPITBXUWYIEDCMVWBTZISPBLQUOWALMUHPEUPHUPYEAJUOECWDQLYPBNRMQMWGKUWOIPIENADEIJWJYMWIIEQEOFCIPRFKDFTMGULEEZNNRUSWDGXJYIQNOMNJPGQROITWJLWKMNBKLORRXRNIADNNCGEHDLFCWFFIITOEVXGTFVHTDVVWAAHIBSAVNTYOYIHZGUHSTHAKPLINFHANKZBQMAEQNXRNHKDJHYGTBJFWLIKEQUXPQRYZGHXJSVDVRACLVIHXKOGDFNYKVCTGNBUXTCYEURKTKPIQJWKLXQARGZLRCFYOKPDMEGVRZDLMOLESXHTYANGMKVDWKQDWQNQZUYRLYRJJALNBTDIJXQWKSFNXHHLXRLVGJDGRZVSNEZVZNTUNNSMHNPRYHGGLLKOJJHQEDCBRZURRIQKDUWKQOXKKICSXODXKDXLLKIDUVFLGCTHNDMWAZUGTMAPKZLAAHDCLKHKOGBZEPYZPUCCDFIPFHCQWTPRTLFGLCAQNVRMWUJZFZLIWSOGNTMMNPMFNXBMWIPMTNZYODGZKFJOAAIGATUSBRTIKAMDUKYTLUJJRLSLRNXYYGLKENYCREGPCRQWFIKYBFSBZANWHQOLYJIYCXHECCGWKSYHTRHAJGNRHMJCEVMWVESLPTYUYHAETQNABEZUNBHCSKXJLBLSVDOLSKLTGMFLXYPQYTYRGSMXYMLPSZMHVXPHLYNGKFNWAVGSRPQPRZVBNELCCVYKJLLZTHMZOCBXVQFJDLUXVYJBHZLZSHXMVGYMDUDORONYFAHIXODFCWBINIWWXUXLKJNBSGVZCMRVTLYSIMZXFHJBZVRKGYJONYNQGJXTUICYLOEAFIPBGAFNITYFZCTHHBFTISFBSGIWALDNZRWTNXMUNCOJNQGLCACFDVKOPBUPULQTSZHBLHLLQAGMXHHZMABYMVVTPONGQWTEJTCRSWFHVHWQGQBXXRYOUUGHFWSDWQOBHPYBLKNBWGLFYSKHSFHXMYUWOBNXACQMZTUKZLZOTRVRABYLQPYSFJRGPCYGHLMGFSKQQBMQISXKKMBIEJLEBRKCMHCENENJVINGIKQBSOITGCJCFZDPRNKKNRZNMHEIHJMJLFBWONQFNSAQTLURPETKCEUDMJMOYEKLWAAIIWODBDVKZSGXQZCUZTUZIJEKKPKCRAEZNHAIWEJOMSVKFNHVGMCHVMLFGOSEEXDAHRNIEZTKCRPQTPCSAZYVGPIZWSUTIXBOITQKWOWNQGHZZHPJZXNMKWXHWMQKCEAJSGKUUKTMFFBPZBSAZZSULTRANTASWMGULWQLNZRVKXAJRLFERRKPKNWGRKOZPEWIWCBCWKWJJGMFVKTWWJOCDDEAGBBFEEPDSZSYXZGUSLRDADRIJXMTQVNLMBPQEKHJUZNVZKXARKHVOQJPXWZLWJBKMTGKKUNCMCXOYUQIUHGAKQVEZRVYPIUTWLVQJDORBXEZCDLSJHSSTLFKHTOUNPRRDQGPSNTVLTYUYWGSULVDNIOEZJVHNKSDJGVQTPZIJVJBARWYMIDQFHMMIUGECHFSNREUFXCUCDFORINMIVXPHORLQRWDWIVYFTOEHCBEQSQRCHYJEVVJRMDQVLLGCIFDORIXGPRULGOLOLYBINRRATGXMBJTMTHKTSFCNPCAEQSYMYKAASYJJMYACQFHWQJLMDOQKSYNLSGIDXZJNHEWKWQTAPBYLEOWBYWNVSZSNWEFBVSBXZVHLJBPICAKINJJAZOANLNWBFBLDZDAMFLCHTHFCRGGDLRUYORAXHITCZVDDKCMUGKCEZRYPCVAVKDRQLUWZKJDZYYKUKAKYNRANTLTOTSISOWBJQAFQXMETAQODBBEGUEZMKNVBCYYKMKFTRNFTNEOJWWHHJMOMVEZQYNVZAEVQUTGGHBCOMHNNBLBKODDHJFVIIRODTKDVXYVLXIISBNSSTYZJYPICEDTHZJDDFXYEZGPDBLHKWSZAMJGHQWOEEESYXLNUTLPYRKKCWZPXHRTKVPMEAYYNFWJMYOAXDHFECOWAXWRRIDIOHLHLRAVCIRQVAXNIEQWRWCAFVIHDLWVOTUFHQFIEXUBQUMXLAUTLJHOHKITBVXSDLHIELTKQPRFVSFEOBJPERMWHTYPZTZEUDGCTNUTWVUYNQELWGVPEMUJGGIEJEYYLPLIRBCOCIBMPKSUNMTLSZPWXOPGOWLEFMIUBIKJRREOKKPKBPHRJXWIYXABSGECTQJRSCCNYEORABQUZMYDYMEKVJZBRHHLUBWQGXUUGFXGRIRSPMBEVBZSKDNRMNKTGWXCSWRTUJJMBRYTEBNYXCKAZVABMKVCSAOIVTRQOGAMVLSMLIAQPDJQQJJJXTDIGEZCBTDAWIMOCCWNMTEAPEFYEGPEQFNIOOHGXPMTBQQUKFQLOTDNDPFNWORMYDKOQIVYXHOOVAOGRFEXMLPOQQDHTQQYPTETUFKOMPHGUOEZMEFSCDKQADGSLCJNNXEKKLAXTZXZJJUDNTFRLXHOAOOYROETHRDMCHDJMALXFBIHMJRXKNIVEJRYFRCSYVEBOMVPRFINYGHPBATPTGUVEAINZKKVVBLHITASDQBPDBSUTPMAGLRVETLGKVYIVQFVTQFGKUSYAEQLHVGFABOIEWYCPKEVRNNSWYXVDSQREDOUVSXRDNHCAOTXTHTAPZQHIWFTJYZMPJJYQZIQXOUUAGHRBENJMUUFDUCRKYBZUHIQCYJPTGXEXXQZRDSOZBDNRJJMXZYCARBZHHMFFNJXGJZDFNKALBXWHRCAWTXABIKQLBMXIXEGWWJPMTFTVCHAPZVPIQADNWCZYYTALDLOTTXHOFUPOEXZZADSCAAIPYGWWCABPNREBRAEPBBIDCHWSJCMEXBZJMFQYXOLZDJVUBLKHIYHXAHHCXOIYGWGAEAOOSWYLBHQYLZPODKNPDJTEEBNIATQZWMUTWTCRLNMNTRLKKDYGWWBIJKEYZSIGWXNPOQRULMUMSQBJHIHVHTWNYVEBSBDLHKQVLIGBCPJENVSBEASLDGHZREGLFQMUNIVYKEBUGRGDEMQYZGUGLWSIYLJUTOSILYNITUMTJIHZPKMBJLOQFVFTXHEZQYEHKBQFESSGPUJEPCNTFOCJOLEJMABCETPTWZOBEJIMWSSDUPVFQNWBEEQFJRPWXESEGMJJENMHIIUHILTNTTIPYRNEGMNOECTFEIXNAADXJQGSXRMPQATNOMVARUTBBJDBAHKWYMEJQXRXPJKFGRGRNWXDFMLROFUCKATMBMTINMDBAUJOTHQIJUNJOZFVNFODGTPMQTSETNRMQVMPRJCJTOHGZPHCAIXVHMSXPNWVEQDHWUEVBEUPMYZOQTJXGPYBCLTUSEHJYIFAMUQEZCTGYHGPBBVDBHCNSWMHUQYWVAQKSUOLYUNLUUEONJANOIBXLXKRVJGHGEAGTKWQKZYUIGEWPCTEBDBMNARXATBWQMVWJQXVHGLGXRMDNZEPNTGQAYEIKLOOWLNNLIWVZLMMWNREMRAJEPHNDQDRIQVUEGOIKRUENWLKHMVEWWNQZQMIZGLGBYCMEZYNYSRFQWHJGSGCETHRGASFUDYVASRFJKKUBBMNFPQRDDZGFRKOCUJVZOJZSOEQYRRDGOPJJPSMFIRDYEXAQPQLRTVPQGSHTCPFTZNTVCIAOHNRDPXGDGXPDSEZUKMKARYGAVGCBOHANSJKHYLDPCFXAOEBATTFZRDWEMESUYNHREUTPORPDRMPGSCCDRVZCMIIVSQXTMQSLIAGHICXJYZDOOGRVCRPMIKALTMHTBOZGUUWGOXAEGUBXIXPLSTNABRSLFSAOCXULPTFLATSCSSLJFQCEHSJZEYDVWGHQQLPARKIJSMOHXTOZGWYTKNONYWQXTHAVCDEDPYTNCNUVZKWFEODBGIYLLBJOWGYWFKQDHPEMWNJPSJEJPTAYDAVLGVMDDWBJKTSYEVOXYAKCMSMEPHTXGOTNFKOBTADKPQQCKAIXGSXRCVSSLDCXFCEIRQKPXSMVHFHCEDMSFIMRRWAGIVQGMTCNRFMVWTQFFNTZJFSLXXJDTZBGAHAMOWAZARZTQCPOMAXKKYUKOMHNELAOMBBIIJDSOPXFVUFXACKODFHHQRMUZQNHWWEWKEUQTDCYGPMWLQHLCUYDUBWGNPWIRILVGICVQFVKKFEIUDDRKWMPVYBBSFESJTNQMYLYEBQIQBIDSPYQQFUQRGUPROKKQETIFRPIWJGDMILMXGFJODKUGZZIQRWYSJVJZTNEVLXHXEZRPLNZPAWTVFQKRDVSBXXREEPYYLPOGMIKMNEDMWMTKNQVMCIWIPHSHIHFGHEWPWNYXMEFTYGBQLASFDXBVRNYMGHGMEGYHGYFUFZHVHLSQQPRXGJTZAGWLPLIKRZCGGSOBBDMUMDKNCEWJBDBMHOYJOAPIKAPFTRTHXDFULBREUQJATSHPJUVVACPLVAJWTYGXOMNLMKCVLGFFJRWFHLMTOZLEUEMHOZESJRGFRCWSIZAHFHEWWZOAYNRNBTRSFJNYLBLLJKZAYZEWPWWNWSEFXCGXOTOOAOLKAUAOQKQSVIQPGTFPUBYMUMPIMQYTAWVJLJDEUVEPQFOUOFAROYILGVDHDVFPXFTKPWYFYKVFDQYRKNKJ');" + - "do.call('warning', argv)"); + public void testwarning() { + assertEval("argv <- list('foo'); do.call('warning', argv)"); + assertEval("f <- function() warning('foo'); f()"); + assertEval("f <- function() warning('foo'); f2 <- function() f(); f2()"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java index b5e52e768f380012669824044aa59319a1b8efec..acef8ebf71b959321af693c36a35f6dd97cad904 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleArithmetic.java @@ -32,8 +32,8 @@ public class TestSimpleArithmetic extends TestBase { assertEval("{ 2L^10L }"); assertEval("{ 0x10 + 0x10L + 1.28 }"); - assertEval(Ignored.Unknown, "{ 1000000000*100000000000 }"); // FIXME GNU R: 1e+20 - assertEval(Ignored.Unknown, "{ 1000000000L*1000000000 }"); // FIXME GNU R: 1e+18 + assertEval("{ 1000000000*100000000000 }"); + assertEval("{ 1000000000L*1000000000 }"); assertEval(Ignored.Unknown, "{ 1000000000L*1000000000L }"); // FIXME missing warning } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleMatrix.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleMatrix.java index 333385a0815ed5850d2274affd299bdfe6fb9b54..3ce0c94e121bdec3c9513f145bb29bd30e779cda 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleMatrix.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/TestSimpleMatrix.java @@ -25,6 +25,7 @@ package com.oracle.truffle.r.test.library.base; import org.junit.Test; import com.oracle.truffle.r.test.TestBase; +import com.oracle.truffle.r.test.WhiteList; public class TestSimpleMatrix extends TestBase { @@ -84,8 +85,14 @@ public class TestSimpleMatrix extends TestBase { assertEval(template("{ x<-%0; dim(x)<-c(2,2); x[c(TRUE, NA), ] }", TESTED_4L_VECTORS)); assertEval(template("{ x<-%0; x<-1:4; dim(x)<-c(2,2); x[NA, ] }", TESTED_4L_VECTORS)); // A misalignment error similar to those in TestSimpleVector (testIgnored1-3) - assertEval(Ignored.ReferenceError, template("{ x<-%0; dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[c(1,NA), 1] }", TESTED_4L_VECTORS)); - assertEval(Ignored.ReferenceError, template("{ x<-%0; dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[1, c(1,NA)] }", TESTED_4L_VECTORS)); + WhiteList wl = WhiteList.create("matrix formatting1"); + wl.add("{ x<-c(as.raw(1),as.raw(2),as.raw(3),as.raw(4)); dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[c(1,NA), 1] }", + " a <NA>\n 01 00\n", " a <NA>\n01 00\n"); + assertEval(wl, template("{ x<-%0; dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[c(1,NA), 1] }", TESTED_4L_VECTORS)); + wl = WhiteList.create("matrix formatting2"); + wl.add("{ x<-c(as.raw(1),as.raw(2),as.raw(3),as.raw(4)); dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[1, c(1,NA)] }", + " c <NA>\n 01 00\n", " c <NA>\n01 00\n"); + assertEval(wl, template("{ x<-%0; dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[1, c(1,NA)] }", TESTED_4L_VECTORS)); assertEval(template("{ x<-%0; dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[c(1, NA), c(1,NA)] }", TESTED_4L_VECTORS)); assertEval(template("{ x<-%0; dim(x)<-c(2,2); dimnames(x)<-list(c(\"a\", \"b\"), c(\"c\", \"d\")); x[c(1, 1), c(1,NA)] }", TESTED_4L_VECTORS)); assertEval(template("{ x<-%0; dim(x)<-c(1,4); dimnames(x)<-list(\"z\", c(\"a\", \"b\", \"c\", \"d\")); x[1, 0] }", TESTED_4L_VECTORS));