Skip to content
Snippets Groups Projects
Commit 3c1ce8fe authored by Mick Jordan's avatar Mick Jordan
Browse files

add TruffleBoundary's for AOT

parent 0dcbd252
Branches
No related tags found
No related merge requests found
......@@ -471,6 +471,7 @@ final class REngine implements Engine, Engine.Timings {
* {@link FunctionBodyNode} has a {@link SourceSection}, for instrumentation, although the
* anonymous {@link FunctionDefinitionNode} itself does not need one.
*/
@TruffleBoundary
private static RootCallTarget doMakeCallTarget(RNode body, String description) {
BodyNode fbn;
SourceSection sourceSection = null;
......
......@@ -51,7 +51,6 @@ public abstract class FastRCompile extends RExternalBuiltinNode.Arg2 {
if (System.getProperty("fastr.truffle.compile", "true").equals("true") && Truffle.getRuntime().getName().contains("Graal")) {
return new Compiler();
} else {
Utils.warn("fastr.compile not supported in this environment");
return null;
}
}
......@@ -78,6 +77,8 @@ public abstract class FastRCompile extends RExternalBuiltinNode.Arg2 {
} catch (InvocationTargetException | IllegalAccessException e) {
throw RError.error(this, RError.Message.GENERIC, e.toString());
}
} else {
throw RError.error(this, RError.Message.GENERIC, "fastr.compile not supported in this environment");
}
return RRuntime.LOGICAL_FALSE;
}
......
......@@ -14,6 +14,7 @@ package com.oracle.truffle.r.nodes.builtin.base;
import static com.oracle.truffle.r.runtime.RErrorHandling.*;
import com.oracle.truffle.api.*;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.utilities.*;
import com.oracle.truffle.r.nodes.builtin.*;
......@@ -187,6 +188,7 @@ public class ConditionFunctions {
@RBuiltin(name = "printDeferredWarnings", kind = RBuiltinKind.INTERNAL, parameterNames = {})
public abstract static class PrintDeferredWarnings extends Adapter {
@Specialization
@TruffleBoundary
protected RNull printDeferredWarnings() {
forceVisibility(false);
RErrorHandling.printDeferredWarnings();
......
......@@ -26,6 +26,7 @@ import static com.oracle.truffle.r.runtime.RBuiltinKind.*;
import java.io.*;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.r.nodes.builtin.*;
......@@ -37,6 +38,7 @@ public class PrintFunctions {
public abstract static class PrintAdapter extends RInvisibleBuiltinNode {
@Child protected PrettyPrinterNode prettyPrinter = PrettyPrinterNodeGen.create(null, null, null, null, false);
@TruffleBoundary
protected void printHelper(String string) {
try {
StdConnections.getStdout().writeString(string, true);
......
......@@ -22,6 +22,7 @@
*/
package com.oracle.truffle.r.nodes.builtin.base;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.r.nodes.builtin.*;
import com.oracle.truffle.r.runtime.*;
......@@ -31,6 +32,7 @@ import com.oracle.truffle.r.runtime.data.model.*;
@RBuiltin(name = "readline", kind = RBuiltinKind.INTERNAL, parameterNames = "prompt")
public abstract class Readline extends RBuiltinNode {
@Specialization
@TruffleBoundary
protected String readline(RAbstractStringVector prompt) {
if (!RContext.getInstance().isInteractive()) {
return "";
......
......@@ -242,6 +242,11 @@ public final class RCallNode extends RNode implements RSyntaxNode {
return execute(frame, executeFunctionNode(frame));
}
@TruffleBoundary
private static String getMessage(Throwable e) {
return e.getMessage() != null ? e.getMessage() : e.toString();
}
public Object execute(VirtualFrame frame, Object functionObject) {
RFunction function;
if (isRFunctionProfile.profile(functionObject instanceof RFunction)) {
......@@ -262,7 +267,7 @@ public final class RCallNode extends RNode implements RSyntaxNode {
return ForeignAccess.execute(foreignCall, frame, (TruffleObject) functionObject, argumentsArray);
} catch (Throwable e) {
errorProfile.enter();
throw RError.error(this, RError.Message.GENERIC, "Foreign function failed: " + e.getMessage() != null ? e.getMessage() : e.toString());
throw RError.error(this, RError.Message.GENERIC, "Foreign function failed: " + getMessage(e));
}
} else {
errorProfile.enter();
......
......@@ -27,6 +27,7 @@ import java.util.*;
import com.oracle.truffle.api.*;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.api.instrument.*;
import com.oracle.truffle.api.nodes.*;
......@@ -408,6 +409,7 @@ public class DebugHandling {
}
@TruffleBoundary
private static void printNode(Node node, boolean curly) {
ConsoleHandler consoleHandler = RContext.getInstance().getConsoleHandler();
RDeparse.State state = RDeparse.State.createPrintableState();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment