Skip to content
Snippets Groups Projects
Commit ba612b71 authored by Adam Welc's avatar Adam Welc
Browse files

Replaced RCallNode with DirectCallNode which removed the need for interpreting the recursive calls.

parent 0cc065c5
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ import static com.oracle.truffle.r.nodes.builtin.RBuiltinKind.*;
import com.oracle.truffle.api.*;
import com.oracle.truffle.api.frame.*;
import com.oracle.truffle.api.nodes.*;
import com.oracle.truffle.r.nodes.*;
import com.oracle.truffle.r.nodes.builtin.*;
import com.oracle.truffle.r.nodes.builtin.RBuiltin.*;
......@@ -44,7 +45,8 @@ public class Recall extends RCustomBuiltinNode {
return PARAMETER_NAMES;
}
@Child private RCallNode callNode;
@Child protected CallArgumentsNode args;
@Child private DirectCallNode callNode;
public Recall(RBuiltinNode prev) {
super(prev);
......@@ -53,11 +55,6 @@ public class Recall extends RCustomBuiltinNode {
@Override
public Object execute(VirtualFrame frame) {
controlVisibility();
// Recall is now only used in a massively recursive benchmark (b25.prog-3) and cannot be
// compiled (Truffle eventually barfs trying to inline that many calls). Possibilities for
// making this problem less severe is to perhaps inline only to a certain call depth and
// then go back to interpretation.
CompilerDirectives.transferToInterpreterAndInvalidate();
RFunction function = RArguments.getFunction(frame);
if (function == null) {
CompilerDirectives.transferToInterpreter();
......@@ -65,10 +62,12 @@ public class Recall extends RCustomBuiltinNode {
}
if (callNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
callNode = insert(RCallNode.createCall(null, CallArgumentsNode.createUnnamed(createArgs(arguments[0]))));
callNode = Truffle.getRuntime().createDirectCallNode(function.getTarget());
args = CallArgumentsNode.createUnnamed(createArgs(arguments[0]));
arguments[0] = null;
}
return callNode.execute(frame, function);
Object[] argsObject = RArguments.create(function, args.executeArray(frame));
return callNode.call(frame, argsObject);
}
private static RNode[] createArgs(RNode argNode) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment