diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java index d4d9a7bb0745b67ef3f12ba531e15d917d83dcaf..dda216149f7a5fead78ff5b54c62c58a1a2d19c6 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java @@ -206,6 +206,14 @@ public final class REngine implements RContext.Engine { return null; } catch (DebugExitException | BrowserQuitException e) { throw e; + } catch (RInternalError e) { + singleton.context.getConsoleHandler().printErrorln("FastR internal error: " + e.getMessage()); + RInternalError.reportError(e); + return null; + } catch (RError e) { + // RError prints the correct result on the console during construction + RInternalError.reportError(e); + return null; } catch (Throwable t) { writeStderr("Exception while parsing: " + t, true); t.printStackTrace(); @@ -220,7 +228,13 @@ public final class REngine implements RContext.Engine { for (FrameSlot slot : globalFrame.getFrameDescriptor().getSlots()) { FrameSlotChangeMonitor.setObjectAndInvalidate(globalFrame, slot, null, true, null); } - return parseAndEvalImpl(Source.fromText(rscript, "<test_input>"), REnvironment.globalEnv().getFrame(), printResult, false); + try { + return parseAndEvalImpl(Source.fromText(rscript, "<test_input>"), REnvironment.globalEnv().getFrame(), printResult, false); + } catch (RInternalError e) { + singleton.context.getConsoleHandler().printErrorln("FastR internal error: " + e.getMessage()); + RInternalError.reportError(e); + throw e; + } } private static Object parseAndEvalImpl(Source source, MaterializedFrame frame, boolean printResult, boolean allowIncompleteSource) throws RecognitionException { @@ -237,16 +251,11 @@ public final class REngine implements RContext.Engine { writeStderr(source.getLineCount() == 1 ? message : (message + " (line " + e.line + ")"), true); return null; } + RootCallTarget callTarget = doMakeCallTarget(node, "<repl wrapper>"); try { - RootCallTarget callTarget = doMakeCallTarget(node, "<repl wrapper>"); - try { - return runCall(callTarget, frame, printResult, true); - } catch (BreakException | NextException cfe) { - throw RError.error(RError.Message.NO_LOOP_FOR_BREAK_NEXT); - } - } catch (RError e) { - // RError prints the correct result on the console - return null; + return runCall(callTarget, frame, printResult, true); + } catch (BreakException | NextException cfe) { + throw RError.error(RError.Message.NO_LOOP_FOR_BREAK_NEXT); } } @@ -445,6 +454,13 @@ public final class REngine implements RContext.Engine { throw e; } catch (Throwable e) { reportImplementationError(e); + if (e instanceof Error) { + throw (Error) e; + } else if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } else { + throw new RInternalError(e, "throwable caught while evaluating"); + } } return result; } @@ -494,13 +510,13 @@ public final class REngine implements RContext.Engine { @TruffleBoundary private static void reportImplementationError(Throwable e) { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - e.printStackTrace(new PrintStream(out)); - // We don't call writeStdErr as that may exercise the (broken) implementation - singleton.context.getConsoleHandler().printErrorln(out.toString()); // R suicide, unless, e.g., we are running units tests. // We also don't call quit as the system is broken. if (singleton.crashOnFatalError) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + e.printStackTrace(new PrintStream(out)); + // We don't call writeStdErr as that may exercise the (broken) implementation + singleton.context.getConsoleHandler().printErrorln(out.toString()); Utils.exit(2); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java index 3cf0a1367f513789ec5e782884f4b1f8f3cc4cf6..34579323fc4d1d20b95763cad9fbec96407904ac 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Attributes.java @@ -40,8 +40,8 @@ public abstract class Attributes extends RBuiltinNode { private final BranchProfile rownamesBranch = BranchProfile.create(); - @Specialization(guards = "!hasAttributes(vector)") - protected RNull attributesNull(@SuppressWarnings("unused") RAbstractVector vector) { + @Specialization(guards = "!hasAttributes(container)") + protected Object attributesNull(@SuppressWarnings("unused") RAbstractContainer container) { controlVisibility(); return RNull.instance; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java index 4fd790c4f6f2f589dc79ca8770689cbe91d97857..f8667a61331f41159dd7e606839a170a5801d385 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java @@ -53,7 +53,7 @@ public abstract class Bind extends RPrecedenceBuiltinNode { protected String getBindType() { // this method should be abstract but due to annotation processor problem it does not work - Utils.nyi("getBindType() method must be overridden in a subclass"); + RInternalError.unimplemented("getBindType() method must be overridden in a subclass"); return null; } @@ -208,7 +208,7 @@ public abstract class Bind extends RPrecedenceBuiltinNode { RStringVector names = vec.getNames(attrProfiles); firstDimNames = names == null ? RNull.instance : names; } else { - Utils.nyi("binding multi-dimensional arrays is not supported"); + RInternalError.unimplemented("binding multi-dimensional arrays is not supported"); } if (firstDimNames != RNull.instance) { RStringVector names = (RStringVector) firstDimNames; @@ -275,7 +275,7 @@ public abstract class Bind extends RPrecedenceBuiltinNode { } } } else { - Utils.nyi("binding multi-dimensional arrays is not supported"); + RInternalError.unimplemented("binding multi-dimensional arrays is not supported"); return 0; } } @@ -283,7 +283,7 @@ public abstract class Bind extends RPrecedenceBuiltinNode { @SuppressWarnings("unused") protected RVector genericBind(VirtualFrame frame, RAbstractVector[] vectors, boolean complete, String[] vacNames, boolean vecNamesComplete, Object deparseLevel) { // this method should be abstract but due to annotation processor problem it does not work - Utils.nyi("genericBind() method must be overridden in a subclass"); + RInternalError.unimplemented("genericBind() method must be overridden in a subclass"); return null; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Body.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Body.java index d3fd82b55e4ef5bc5be9383fd5b0337c1fa021a0..cb0c233e0838e6adf604eabac4221971d471bd22 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Body.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Body.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -22,29 +22,25 @@ */ package com.oracle.truffle.r.nodes.builtin.base; -import com.oracle.truffle.api.dsl.Fallback; -import com.oracle.truffle.api.dsl.Specialization; -import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode; -import com.oracle.truffle.r.runtime.RBuiltin; +import static com.oracle.truffle.r.runtime.RBuiltinKind.*; -import static com.oracle.truffle.r.runtime.RBuiltinKind.INTERNAL; - -import com.oracle.truffle.r.runtime.data.RDataFactory; -import com.oracle.truffle.r.runtime.data.RFunction; -import com.oracle.truffle.r.runtime.data.RLanguage; -import com.oracle.truffle.r.runtime.data.RNull; +import com.oracle.truffle.api.dsl.*; +import com.oracle.truffle.r.nodes.builtin.*; +import com.oracle.truffle.r.nodes.function.*; +import com.oracle.truffle.r.runtime.*; +import com.oracle.truffle.r.runtime.data.*; @RBuiltin(name = "body", kind = INTERNAL, parameterNames = {"fun"}) public abstract class Body extends RBuiltinNode { + @Specialization public RLanguage doBody(RFunction fun) { FunctionDefinitionNode fdn = (FunctionDefinitionNode) fun.getRootNode(); return RDataFactory.createLanguage(fdn.getUninitializedBody()); } - @Fallback - public RNull doBody(@SuppressWarnings("unused") Object fun) { + @Specialization(guards = "!isRFunction(fun)") + public RNull doBodyNull(@SuppressWarnings("unused") Object fun) { return RNull.instance; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java index f43c98fcda9923925e8f9d9b404b73ece452a4c8..087588e2a952459ee9a15e112c7fc75840760953 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java @@ -187,12 +187,11 @@ public class EnvFunctions { @RBuiltin(name = "environment", kind = INTERNAL, parameterNames = {"fun"}) public abstract static class Environment extends RBuiltinNode { - private final ConditionProfile isFunctionProfile = ConditionProfile.createBinaryProfile(); private final ConditionProfile createEnvironmentProfile = ConditionProfile.createBinaryProfile(); private final PromiseDeoptimizeFrameNode deoptFrameNode = new PromiseDeoptimizeFrameNode(); @Specialization - protected Object environment(VirtualFrame frame, @SuppressWarnings("unused") RNull x) { + protected Object environment(VirtualFrame frame, @SuppressWarnings("unused") RNull fun) { controlVisibility(); Frame callerFrame = Utils.getCallerFrame(frame, FrameAccess.MATERIALIZE); MaterializedFrame matFrame = callerFrame.materialize(); @@ -205,24 +204,24 @@ public class EnvFunctions { * cannot both have a specialization for {@link RFunction} and one for {@link Object}, but * an object that is not an {@link RFunction} is legal and must return {@code NULL}. */ - @Fallback - protected Object environment(Object funcArg) { + @Specialization + protected Object environment(RFunction fun) { controlVisibility(); - if (isFunctionProfile.profile(funcArg instanceof RFunction)) { - RFunction func = (RFunction) funcArg; - Frame enclosing = func.getEnclosingFrame(); - REnvironment env = RArguments.getEnvironment(enclosing); - if (createEnvironmentProfile.profile(env == null)) { - return REnvironment.createEnclosingEnvironments(enclosing.materialize()); - } else { - return env; - } + Frame enclosing = fun.getEnclosingFrame(); + REnvironment env = RArguments.getEnvironment(enclosing); + if (createEnvironmentProfile.profile(env == null)) { + return REnvironment.createEnclosingEnvironments(enclosing.materialize()); } else { - // Not an error according to GnuR - return RNull.instance; + return env; } } + @Specialization(guards = {"!isRNull(fun)", "!isRFunction(fun)"}) + protected Object environment(@SuppressWarnings("unused") Object fun) { + // Not an error according to GnuR + controlVisibility(); + return RNull.instance; + } } @RBuiltin(name = "environmentName", kind = INTERNAL, parameterNames = {"fun"}) @@ -234,7 +233,7 @@ public class EnvFunctions { return env.getName(); } - @Fallback + @Specialization(guards = "!isREnvironment(env)") protected String environmentName(@SuppressWarnings("unused") Object env) { controlVisibility(); // Not an error according to GnuR @@ -282,19 +281,17 @@ public class EnvFunctions { } - private interface BindingErrorMixin { - default void check(SourceSection source, Object sym, Object env) throws RError { - if (!(sym instanceof RSymbol)) { - throw RError.error(source, RError.Message.NOT_A_SYMBOL); - } - if (!(env instanceof REnvironment)) { - throw RError.error(source, RError.Message.NOT_AN_ENVIRONMENT); - } + private static RuntimeException typeError(SourceSection source, Object sym, Object env) { + if (!(sym instanceof RSymbol)) { + throw RError.error(source, RError.Message.NOT_A_SYMBOL); + } else { + assert !(env instanceof REnvironment); + throw RError.error(source, RError.Message.NOT_AN_ENVIRONMENT); } } @RBuiltin(name = "lockBinding", kind = INTERNAL, parameterNames = {"sym", "env"}) - public abstract static class LockBinding extends RInvisibleBuiltinNode implements BindingErrorMixin { + public abstract static class LockBinding extends RInvisibleBuiltinNode { @Specialization protected Object lockBinding(RSymbol sym, REnvironment env) { controlVisibility(); @@ -302,61 +299,38 @@ public class EnvFunctions { return RNull.instance; } - @Specialization - protected Object lockBinding(RAbstractStringVector name, REnvironment env) { - controlVisibility(); - env.lockBinding(name.getDataAt(0)); - return RNull.instance; - } - @Fallback protected Object lockBinding(Object sym, Object env) { - check(getEncapsulatingSourceSection(), sym, env); - return RNull.instance; + throw typeError(getEncapsulatingSourceSection(), sym, env); } } @RBuiltin(name = "unlockBinding", kind = INTERNAL, parameterNames = {"sym", "env"}) - public abstract static class UnlockBinding extends RInvisibleBuiltinNode implements BindingErrorMixin { + public abstract static class UnlockBinding extends RInvisibleBuiltinNode { @Specialization - protected Object unlockBinding(RSymbol sym, REnvironment env) { + protected RNull unlockBinding(RSymbol sym, REnvironment env) { controlVisibility(); env.unlockBinding(sym.getName()); return RNull.instance; } - @Specialization - protected Object unlockBinding(RAbstractStringVector name, REnvironment env) { - controlVisibility(); - env.unlockBinding(name.getDataAt(0)); - return RNull.instance; - } - @Fallback - protected Object unlockBinding(Object sym, Object env) { - check(getEncapsulatingSourceSection(), sym, env); - return RNull.instance; + protected Object unlockBindings(Object sym, Object env) { + throw typeError(getEncapsulatingSourceSection(), sym, env); } } @RBuiltin(name = "bindingIsLocked", kind = INTERNAL, parameterNames = {"sym", "env"}) - public abstract static class BindingIsLocked extends RBuiltinNode implements BindingErrorMixin { + public abstract static class BindingIsLocked extends RBuiltinNode { @Specialization protected Object bindingIsLocked(RSymbol sym, REnvironment env) { controlVisibility(); return RDataFactory.createLogicalVectorFromScalar(env.bindingIsLocked(sym.getName())); } - @Specialization - protected Object bindingIsLocked(RAbstractStringVector name, REnvironment env) { - controlVisibility(); - return RDataFactory.createLogicalVectorFromScalar(env.bindingIsLocked(name.getDataAt(0))); - } - @Fallback protected Object bindingIsLocked(Object sym, Object env) { - check(getEncapsulatingSourceSection(), sym, env); - return RNull.instance; + throw typeError(getEncapsulatingSourceSection(), sym, env); } } @@ -477,7 +451,7 @@ public class EnvFunctions { @Fallback Object copy(@SuppressWarnings("unused") Object o) { - throw Utils.nyi("copying of object in the environment not supported"); + throw RInternalError.unimplemented("copying of object in the environment not supported"); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java index 92cd74b6abc1d491ebabe8250f434dd7296a4404..6c3b06f3349b3998764469f8d3bdcaa252645141 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GrepFunctions.java @@ -412,37 +412,30 @@ public class GrepFunctions { @TruffleBoundary private static String convertGroups(String value) { - int x = 0; - int groupStart = groupIndex(value, x); - if (groupStart < 0) { - return value; - } - StringBuffer result = new StringBuffer(); - while (groupStart >= 0) { - result.append(value.substring(x, groupStart)); - result.append('$'); - result.append(value.charAt(groupStart + 1)); - x = groupStart + 2; - groupStart = groupIndex(value, x); - } - result.append(value.substring(x)); - return result.toString(); - } - - private static int groupIndex(String value, int x) { - int ix = value.indexOf('\\', x); - if (ix < 0 || ix >= value.length() - 2) { - return ix; - } else { - char ch = value.charAt(ix + 1); - if (Character.isDigit(ch)) { - return ix; + StringBuilder result = new StringBuilder(); + int i = 0; + while (i < value.length()) { + char c = value.charAt(i); + if (c == '\\') { + i++; + if (i >= value.length()) { + result.append('\\'); + } else { + c = value.charAt(i); + if (c >= '0' && c <= '9') { + result.append('$'); + } else { + result.append('\\'); + } + result.append(c); + } } else { - return -1; + result.append(c); } + i++; } + return result.toString(); } - } @RBuiltin(name = "sub", kind = INTERNAL, parameterNames = {"pattern", "replacement", "x", "ignore.case", "perl", "fixed", "useBytes"}) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/InfixEmulationFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/InfixEmulationFunctions.java index 750222e29f00a1ec1ae9cfcb51c4128e900f6f40..97b3b9168c466fff75bafc40b2e6f1d5a967c28b 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/InfixEmulationFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/InfixEmulationFunctions.java @@ -119,7 +119,7 @@ public class InfixEmulationFunctions { protected abstract Object execute(VirtualFrame frame, Object op); - @Child private PromiseHelperNode promiseHelper = new PromiseHelperNode(); + @Child private PromiseHelperNode promiseHelper; @Child private PromiseEvaluator evalRecursive; protected Object evalRecursive(VirtualFrame frame, Object op) { @@ -130,14 +130,18 @@ public class InfixEmulationFunctions { return evalRecursive.execute(frame, op); } - @Specialization - protected Object eval(VirtualFrame frame, RPromise p) { - return promiseHelper.evaluate(frame, p); + @Specialization(guards = {"!isRPromise(op)", "!isRArgsValuesAndNames(op)"}) + protected Object eval(Object op) { + return op; } @Specialization - protected RAbstractVector eval(RAbstractVector op) { - return op; + protected Object eval(VirtualFrame frame, RPromise p) { + if (promiseHelper == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + promiseHelper = insert(new PromiseHelperNode()); + } + return promiseHelper.evaluate(frame, p); } @Specialization(guards = "!argsEmpty(args)") @@ -154,15 +158,9 @@ public class InfixEmulationFunctions { return args; } - @Fallback - protected Object eval(Object op) { - return op; - } - protected boolean argsEmpty(RArgsValuesAndNames args) { return args.length() == 0; } - } public abstract static class AccessArrayBuiltin extends RBuiltinNode { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java index 6f1fbfd72339933361d2a4fc9feced5b7f2e6af4..1c831d8a2f402905f700f87d5cb727a6b52126b8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java @@ -277,7 +277,7 @@ public abstract class Unlist extends RBuiltinNode { return RDataFactory.createList(result, namesInfo != null && namesInfo.namesAssigned ? RDataFactory.createStringVector(namesData, RDataFactory.INCOMPLETE_VECTOR) : null); } default: - throw Utils.nyi(); + throw RInternalError.unimplemented(); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RNode.java index 2370cc3ba659b2e8c9940464cd934cebad2eb66c..40943001e18bf5d808a42a2e18a76d63fa1e20a4 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RNode.java @@ -241,4 +241,92 @@ public abstract class RNode extends Node implements RSyntaxNode, RInstrumentable } } } + + protected boolean isRAbstractContainer(Object value) { + return value instanceof RAbstractContainer; + } + + protected boolean isRAbstractVector(Object value) { + return value instanceof RAbstractVector; + } + + protected boolean isRAbstractIntVector(Object value) { + return value instanceof RAbstractIntVector; + } + + protected boolean isRAbstractDoubleVector(Object value) { + return value instanceof RAbstractDoubleVector; + } + + protected boolean isRAbstractComplexVector(Object value) { + return value instanceof RAbstractComplexVector; + } + + protected boolean isRAbstractRawVector(Object value) { + return value instanceof RAbstractRawVector; + } + + protected boolean isRAbstractStringVector(Object value) { + return value instanceof RAbstractStringVector; + } + + protected boolean isRAbstractLogicalVector(Object value) { + return value instanceof RAbstractLogicalVector; + } + + protected boolean isRList(Object value) { + return value instanceof RList; + } + + protected boolean isRDataFrame(Object value) { + return value instanceof RDataFrame; + } + + protected boolean isRFactor(Object value) { + return value instanceof RFactor; + } + + protected boolean isRPromise(Object value) { + return value instanceof RPromise; + } + + protected boolean isRLanguage(Object value) { + return value instanceof RLanguage; + } + + protected boolean isRExpression(Object value) { + return value instanceof RExpression; + } + + protected boolean isRFunction(Object value) { + return value instanceof RFunction; + } + + protected boolean isREnvironment(Object value) { + return value instanceof REnvironment; + } + + protected boolean isRConnection(Object value) { + return value instanceof RConnection; + } + + protected boolean isRPairList(Object value) { + return value instanceof RPairList; + } + + protected boolean isRSymbol(Object value) { + return value instanceof RSymbol; + } + + protected boolean isRArgsValuesAndNames(Object value) { + return value instanceof RArgsValuesAndNames; + } + + protected boolean isRMissing(Object value) { + return value == RMissing.instance; + } + + protected boolean isRNull(Object value) { + return value == RNull.instance; + } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java index 0a4c97e12550db0e419e9fe9d90223eeb438d7cb..93e0f2e40d9dffa4488dda5be3a688e13d3f285b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RTruffleVisitor.java @@ -414,7 +414,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { } else if (v.getVector() instanceof FunctionCall) { return null; } else { - Utils.nyi(); + RInternalError.unimplemented(); return null; } } @@ -425,7 +425,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { } else if (a.getLhs() instanceof FunctionCall) { return null; } else { - Utils.nyi(); + RInternalError.unimplemented(); return null; } } @@ -498,7 +498,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { CoerceVector coerceVector = CoerceVectorNodeGen.create(null, null, null); return createPositions(a.getArguments(), argLength, a.isSubset(), null, callAST.accept(this), rhs, coerceVector, true); } else { - Utils.nyi(); + RInternalError.unimplemented(); return null; } } @@ -722,7 +722,7 @@ public final class RTruffleVisitor extends BasicVisitor<RNode> { arguments.add(ArgNode.create(null, (String) null, Constant.createStringConstant(null, new String[]{a.getFieldName().toString()}))); return createPositions(arguments, arguments.size(), false, null, callAST.accept(this), rhs, coerceVector, true); } else { - Utils.nyi(); + RInternalError.unimplemented(); return null; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/array/write/UpdateArrayHelperNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/array/write/UpdateArrayHelperNode.java index 547900ccd424f0e8931b73bff4fe3b7451ef8879..7702680de58b2ee9cec2f51564bd127344fd2e30 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/array/write/UpdateArrayHelperNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/array/write/UpdateArrayHelperNode.java @@ -1305,7 +1305,7 @@ public abstract class UpdateArrayHelperNode extends RNode { } } if (value.getLength() == 0) { - Utils.nyi(); + RInternalError.unimplemented(); } if (positions.getLength() % value.getLength() != 0) { warning.enter(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java index 206dac08414f5c7b860a87745e0ae820fa74541a..098a8f60f5dfcc9ed9f160d2495c49330a483d4e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentMatcher.java @@ -146,7 +146,7 @@ public class ArgumentMatcher { public static MatchPermutation matchArguments(ArgumentsSignature suppliedSignature, ArgumentsSignature formalSignature, SourceSection callSrc, boolean forNextMethod) { CompilerAsserts.neverPartOfCompilation(); MatchPermutation match = permuteArguments(suppliedSignature, formalSignature, callSrc, null, forNextMethod, index -> { - throw Utils.nyi("S3Dispatch should not have arg length mismatch"); + throw RInternalError.unimplemented("S3Dispatch should not have arg length mismatch"); }, index -> suppliedSignature.getName(index)); return match; } @@ -212,7 +212,7 @@ public class ArgumentMatcher { RRootNode rootNode = (RRootNode) function.getTarget().getRootNode(); FormalArguments formals = rootNode.getFormalArguments(); MatchPermutation match = permuteArguments(evaluatedArgs.getSignature(), formals.getSignature(), callSrc, null, forNextMethod, index -> { - throw Utils.nyi("S3Dispatch should not have arg length mismatch"); + throw RInternalError.unimplemented("S3Dispatch should not have arg length mismatch"); }, index -> evaluatedArgs.getSignature().getName(index)); Object[] evaledArgs = new Object[match.resultPermutation.length]; diff --git a/com.oracle.truffle.r.options/src/com/oracle/truffle/r/options/FastROptions.java b/com.oracle.truffle.r.options/src/com/oracle/truffle/r/options/FastROptions.java index b0b8ee25a7b02558cc996c1e2865ae5a912364ae..59386b7b376276f9ae10abba284e315ca63c3f32 100644 --- a/com.oracle.truffle.r.options/src/com/oracle/truffle/r/options/FastROptions.java +++ b/com.oracle.truffle.r.options/src/com/oracle/truffle/r/options/FastROptions.java @@ -43,8 +43,10 @@ public class FastROptions { //@formatter:off @Option(help = "Disable prototypical group generics implementation") public static final OptionValue<Boolean> DisableGroupGenerics = new OptionValue<>(false); - @Option(help = "Prints Java and R stack traces for all R errors") + @Option(help = "Prints Java and R stack traces for all errors") public static final OptionValue<Boolean> PrintErrorStacktraces = new OptionValue<>(false); + @Option(help = "Dumps Java and R stack traces to file for all errors") + public static final OptionValue<Boolean> PrintErrorStacktracesToFile = new OptionValue<>(true); @Option(help = "Assert completeness of results vectors after evaluating unit tests and R shell commands") public static final OptionValue<Boolean> CheckResultCompleteness = new OptionValue<>(true); @Option(help = "Debug=name1,name2,...; Turn on debugging output for 'name1', 'name2', etc.") diff --git a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java index f76d03c016a1bb0fd31e235a4ede7a7a49267360..00947b7f59abb1b952976f7c1a72ea83a3a112a6 100644 --- a/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java +++ b/com.oracle.truffle.r.parser/src/com/oracle/truffle/r/parser/ast/AssignVariable.java @@ -58,7 +58,7 @@ public abstract class AssignVariable extends ASTNode { String value = c.getValues()[0]; return writeVariable(src, isSuper, value, rhs); } - Utils.nyi(); + RInternalError.unimplemented(); return null; } @@ -92,7 +92,7 @@ public abstract class AssignVariable extends ASTNode { lhs.getArguments().add(ArgNode.create(rhs.getSource(), "value", rhs)); return writeFunction(lhs.getSource(), isSuper, replacementFunc, update); } else { - Utils.nyi(); // TODO here we need to flatten complex assignments + RInternalError.unimplemented(); // TODO here we need to flatten complex assignments return null; } } @@ -116,7 +116,7 @@ public abstract class AssignVariable extends ASTNode { if (first instanceof SimpleAccessVariable || first instanceof AccessVector || first instanceof FieldAccess) { return new Replacement(src, isSuper, lhs, rhs); } else { - Utils.nyi(); // TODO here we need to flatten complex assignments + RInternalError.unimplemented(); // TODO here we need to flatten complex assignments } } return lhs; diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java index 160120fbfa42f0ecb8997b884eeb160da83a75ab..2d97ec0fa8c886ff528ad31acf1d710ea5a45ad7 100644 --- a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java +++ b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/gnfi/GNFI_RFFIFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -190,7 +190,7 @@ public class GNFI_RFFIFactory extends RFFIFactory implements RFFI, BaseRFFI { } public UtsName uname() { - Utils.nyi(); + RInternalError.unimplemented(); return null; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java index 35f0938bc787a2f37d0f3d15a6c59d48276e809f..45b82d9666c76893cd87109aa16caa65b21ae9a1 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java @@ -30,6 +30,8 @@ import com.oracle.truffle.r.runtime.env.REnvironment.PutException; @SuppressWarnings("serial") public final class RError extends RuntimeException { + private final String verboseStackTrace; + /** * This exception should be subclassed by subsystems that need to throw subsystem-specific * exceptions to be caught by builtin implementations, which can then invoke @@ -61,6 +63,7 @@ public final class RError extends RuntimeException { */ RError(String msg) { super(msg); + verboseStackTrace = RInternalError.createVerboseStackTrace(); } @Override @@ -68,6 +71,10 @@ public final class RError extends RuntimeException { return getMessage(); } + public String getVerboseStackTrace() { + return verboseStackTrace; + } + @TruffleBoundary public static RError error(SourceSection src, Message msg, Object... args) { throw error0(src, msg, args); @@ -94,7 +101,7 @@ public final class RError extends RuntimeException { * @param msg a {@link Message} instance specifying the error * @param args arguments for format specifiers in the message string */ - private static RError error0(final SourceSection srcCandidate, Message msg, Object... args) { + private static RError error0(SourceSection srcCandidate, Message msg, Object... args) { /* * First we call RErrorHandling.signalError to check for handlers and if that returns, then * call RErrorHandling.errorcallDflt. This follows GnuR, which also has a "hook" mechanism diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java index abcdecf1aeb142ea8c95f4619d0da5c3e799a85c..19628d61bda9d3f8c46034b8f41b597177bf02ba 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RErrorHandling.java @@ -310,7 +310,7 @@ public class RErrorHandling { throw new RError(Message.INVALID_ERROR.message); } } - throw new RError(null); + throw new RError(errorMessage); } private static MaterializedFrame safeCurrentFrame() { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java index b7f99f862b102855cd9f6496268adf4e72c95cb7..d713aff524b97c7312f0665afbdf1bf51b1bafff 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java @@ -22,10 +22,12 @@ */ package com.oracle.truffle.r.runtime; +import java.io.*; +import java.nio.charset.*; +import java.nio.file.*; +import java.util.*; + import com.oracle.truffle.api.*; -import com.oracle.truffle.api.frame.*; -import com.oracle.truffle.api.nodes.*; -import com.oracle.truffle.api.source.*; import com.oracle.truffle.r.options.*; /** @@ -35,14 +37,20 @@ public final class RInternalError extends Error { private static final long serialVersionUID = 80698622974155216L; + private final String verboseStackTrace; + public RInternalError(String message, Object... args) { super(String.format(message, args)); - reportError(this, null); + verboseStackTrace = createVerboseStackTrace(); } public RInternalError(Throwable cause, String message, Object... args) { super(String.format(message, args), cause); - reportError(this, null); + verboseStackTrace = createVerboseStackTrace(); + } + + public String getVerboseStackTrace() { + return verboseStackTrace; } public static RuntimeException unimplemented() { @@ -70,34 +78,39 @@ public final class RInternalError extends Error { throw new RInternalError("should not reach here: %s", message); } - static void reportError(Throwable t, SourceSection source) { - CompilerDirectives.transferToInterpreter(); - if (FastROptions.PrintErrorStacktraces.getValue()) { - System.err.printf("RError with message %s:%n", t.getMessage()); - if (source != null) { - System.err.printf(" at %s%n", source.getShortDescription()); - } - Truffle.getRuntime().iterateFrames(frame -> { - String sourceDesc = findSourceDesc(frame); - System.err.printf(" at %s%n", sourceDesc != null ? sourceDesc : frame.getCallTarget().toString()); - return null; - }); - System.err.println("Java stack trace:"); - t.printStackTrace(); + static String createVerboseStackTrace() { + if (FastROptions.PrintErrorStacktracesToFile.getValue() || FastROptions.PrintErrorStacktraces.getValue()) { + return Utils.createStackTrace(true); + } else { + return ""; } } - private static String findSourceDesc(FrameInstance frame) { - if (frame.getCallNode() == null) { - return null; - } - Node current = frame.getCallNode(); - do { - if (current.getSourceSection() != null) { - return current.getSourceSection().getShortDescription(); + public static void reportError(Throwable t) { + if (FastROptions.PrintErrorStacktracesToFile.getValue() || FastROptions.PrintErrorStacktraces.getValue()) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + t.printStackTrace(new PrintStream(out)); + String verboseStackTrace; + if (t instanceof RInternalError) { + verboseStackTrace = ((RInternalError) t).getVerboseStackTrace(); + } else if (t instanceof RError) { + verboseStackTrace = ((RError) t).getVerboseStackTrace(); + } else { + verboseStackTrace = ""; + } + if (FastROptions.PrintErrorStacktraces.getValue()) { + System.err.println(out.toString()); + System.err.println(verboseStackTrace); } - current = current.getParent(); - } while (current != null); - return null; + if (FastROptions.PrintErrorStacktracesToFile.getValue()) { + try (BufferedWriter writer = Files.newBufferedWriter(new File("fastr_errors.log").toPath(), StandardCharsets.UTF_8, StandardOpenOption.APPEND, StandardOpenOption.CREATE)) { + writer.append(new Date().toString()).append('\n'); + writer.append(out.toString()).append('\n'); + writer.append(verboseStackTrace).append("\n\n"); + } catch (IOException e) { + e.printStackTrace(); + } + } + } } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RegExp.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RegExp.java index c1a7ea32676365424e0e2499bba351f9b30a4f05..75545fdb33e042889906bca18749079e655ec160 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RegExp.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RegExp.java @@ -84,6 +84,28 @@ public class RegExp { result = result.substring(0, xxIndex) + "[\\[" + result.substring(xxIndex + 2); } } + // this loop replaces "[[]" (illegal in Java regex) to "[\[]" + boolean withinCharClass = false; + int i = 0; + while (i < result.length()) { + switch (result.charAt(i)) { + case '\\': + i++; + break; + case '[': + if (withinCharClass) { + result = result.substring(0, i) + '\\' + result.substring(i); + i++; + } else { + withinCharClass = true; + } + break; + case ']': + withinCharClass = false; + break; + } + i++; + } return result; } 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 d80f76da10d0cf2d2ccec16d5c4633d48b1142ff..7a73ae2d2bdef0f3a1b5a84f852e2fb88d03207b 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 @@ -38,27 +38,6 @@ import com.oracle.truffle.r.runtime.data.*; public final class Utils { - /** - * Not yet implemented. - * - * @return Throws an error - */ - public static Error nyi() { - CompilerDirectives.transferToInterpreter(); - throw new UnsupportedOperationException(); - } - - /** - * Not yet implemented. - * - * @param reason - * @return Throws an error - */ - public static Error nyi(String reason) { - CompilerDirectives.transferToInterpreter(); - throw new UnsupportedOperationException(reason); - } - public static boolean isIsoLatinDigit(char c) { return c >= '\u0030' && c <= '\u0039'; } @@ -297,17 +276,27 @@ public final class Utils { */ @TruffleBoundary public static String createStackTrace(boolean printFrameSlots) { - StringBuilder str = new StringBuilder(); - FrameInstance current = Truffle.getRuntime().getCurrentFrame(); - dumpFrame(str, current.getCallTarget(), current.getFrame(FrameAccess.READ_ONLY, true), printFrameSlots, current.isVirtualFrame()); - - Truffle.getRuntime().iterateFrames(frameInstance -> { - dumpFrame(str, frameInstance.getCallTarget(), frameInstance.getFrame(FrameAccess.READ_ONLY, true), printFrameSlots, frameInstance.isVirtualFrame()); - return null; - }); - str.append("\n"); - return str.toString(); + if (current == null) { + return "no R stack trace available\n"; + } else { + StringBuilder str = new StringBuilder(); + dumpFrame(str, current.getCallTarget(), current.getFrame(FrameAccess.READ_ONLY, true), false, current.isVirtualFrame()); + Truffle.getRuntime().iterateFrames(frameInstance -> { + dumpFrame(str, frameInstance.getCallTarget(), frameInstance.getFrame(FrameAccess.READ_ONLY, true), false, frameInstance.isVirtualFrame()); + return null; + }); + if (printFrameSlots) { + str.append("\n\nwith frame slot contents:\n"); + dumpFrame(str, current.getCallTarget(), current.getFrame(FrameAccess.READ_ONLY, true), true, current.isVirtualFrame()); + Truffle.getRuntime().iterateFrames(frameInstance -> { + dumpFrame(str, frameInstance.getCallTarget(), frameInstance.getFrame(FrameAccess.READ_ONLY, true), true, frameInstance.isVirtualFrame()); + return null; + }); + } + str.append("\n"); + return str.toString(); + } } private static void dumpFrame(StringBuilder str, CallTarget callTarget, Frame frame, boolean printFrameSlots, boolean isVirtual) { @@ -316,15 +305,13 @@ public final class Utils { } SourceSection callSrc = RArguments.getCallSourceSection(frame); str.append("Frame: ").append(callTarget).append(isVirtual ? " (virtual)" : ""); - if (callSrc == null) { - str.append("\n <no call info>"); - } else { - str.append("\n called as: ").append(callSrc.getCode()); + if (callSrc != null) { + str.append(" (called as: ").append(callSrc.getCode()).append(')'); } if (printFrameSlots) { FrameDescriptor frameDescriptor = frame.getFrameDescriptor(); for (FrameSlot s : frameDescriptor.getSlots()) { - str.append("\n ").append(s.getIdentifier()).append("=").append(frame.getValue(s)); + str.append("\n ").append(s.getIdentifier()).append(" = ").append(frame.getValue(s)); } } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFrame.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFrame.java index 4132c89701d408a14e25b9faf872cf8fb3987c68..3272522e689a7c6aaaddcbc4bf02869cb08820db 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFrame.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RDataFrame.java @@ -101,13 +101,13 @@ public final class RDataFrame implements RShareable, RAbstractContainer { @Override public boolean hasDimensions() { - Utils.nyi("data frame's dimensions need to be obtained using builtins"); + RInternalError.unimplemented("data frame's dimensions need to be obtained using builtins"); return false; } @Override public int[] getDimensions() { - Utils.nyi("data frame's dimensions need to be obtained using builtins"); + RInternalError.unimplemented("data frame's dimensions need to be obtained using builtins"); return null; } @@ -146,7 +146,7 @@ public final class RDataFrame implements RShareable, RAbstractContainer { @Override public RList getDimNames(RAttributeProfiles attrProfiles) { - Utils.nyi("data frame's dimnames needs to be obtained using builtins"); + RInternalError.unimplemented("data frame's dimnames needs to be obtained using builtins"); return null; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java index 7e2259b250930036c9c9880fb6e56a250a934ac8..28c89eb10310b74d182c4143c4d0bbb7eb798693 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RVector.java @@ -208,7 +208,7 @@ public abstract class RVector extends RBounded implements RShareable, RAbstractV } else if (name.equals(RRuntime.ROWNAMES_ATTR_KEY)) { setRowNames((RAbstractVector) value); } else if (name.equals(RRuntime.CLASS_ATTR_KEY)) { - throw Utils.nyi("The \"class\" attribute should be set using a separate method"); + throw RInternalError.unimplemented("The \"class\" attribute should be set using a separate method"); } else { attributes.put(name, value); } @@ -236,7 +236,7 @@ public abstract class RVector extends RBounded implements RShareable, RAbstractV } else if (name.equals(RRuntime.ROWNAMES_ATTR_KEY)) { setRowNames(null); } else if (name.equals(RRuntime.CLASS_ATTR_KEY)) { - throw Utils.nyi("The \"class\" attribute should be reset using a separate method"); + throw RInternalError.unimplemented("The \"class\" attribute should be reset using a separate method"); } else { attributes.remove(name); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java index 0ad5f60d9ea33bf5fa2255e635d025e7a6207e8b..54b09e3584de38b99462265fbad063d8e9421762 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryArithmetic.java @@ -910,7 +910,7 @@ public abstract class BinaryArithmetic extends Operation { @Override public String opName() { - throw Utils.nyi(); + throw RInternalError.unimplemented(); } @Override @@ -944,7 +944,7 @@ public abstract class BinaryArithmetic extends Operation { @Override public String opName() { - throw Utils.nyi(); + throw RInternalError.unimplemented(); } @Override diff --git a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java index d8ef8a4b8f6d8c6b7d25aac10b29336a2a8c58c1..b7bdbb913132a9c3ef95d30cdd5a1f424a4fee20 100644 --- a/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java +++ b/com.oracle.truffle.r.shell/src/com/oracle/truffle/r/shell/RCommand.java @@ -179,7 +179,7 @@ public class RCommand { } try { // long start = System.currentTimeMillis(); - MaterializedFrame globalFrame = REngine.initialize(commandArgs, new JLineConsoleHandler(isInteractive, console), true, false); + MaterializedFrame globalFrame = REngine.initialize(commandArgs, new JLineConsoleHandler(isInteractive, console), false, false); // console.println("initialize time: " + (System.currentTimeMillis() - start)); for (;;) { console.setPrompt(SLAVE.getValue() ? "" : "> "); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java index 40b44d65fa59385b34661c6f5aec72647b620756..f928b304fd5859f7035c2d72772ed6bf7f1cd754 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java @@ -463,7 +463,7 @@ public class TestBase { microTestFailed(); System.out.print('E'); } - allOk &= allOk; + allOk &= ok; afterMicroTest(); } if ((index) % 100 == 0) {