Skip to content
Snippets Groups Projects
Commit d42a25bd authored by Lukas Stadler's avatar Lukas Stadler
Browse files

connect RCaller hierarchy in RfEvalNode

parent 791e323d
No related branches found
No related tags found
No related merge requests found
......@@ -31,13 +31,16 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.profiles.ConditionProfile;
import com.oracle.truffle.api.profiles.ValueProfile;
import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode;
import com.oracle.truffle.r.nodes.function.PromiseHelperNode;
import com.oracle.truffle.r.runtime.ArgumentsSignature;
import com.oracle.truffle.r.runtime.RArguments;
import com.oracle.truffle.r.runtime.RCaller;
import com.oracle.truffle.r.runtime.RError;
import com.oracle.truffle.r.runtime.Utils;
import com.oracle.truffle.r.runtime.context.RContext;
import com.oracle.truffle.r.runtime.data.RExpression;
import com.oracle.truffle.r.runtime.data.RFunction;
......@@ -57,28 +60,33 @@ public abstract class RfEvalNode extends FFIUpCallNode.Arg2 {
return RfEvalNodeGen.create();
}
private static RCaller createCall() {
Frame frame = Utils.getActualCurrentFrame();
return RArguments.getCall(frame);
}
@Specialization
@TruffleBoundary
Object handlePromise(RPromise expr, @SuppressWarnings("unused") RNull nulLEnv) {
return getPromiseHelper().evaluate(null, expr);
return getPromiseHelper().evaluate(Utils.getActualCurrentFrame().materialize(), expr);
}
@Specialization
@TruffleBoundary
Object handlePromise(RPromise expr, @SuppressWarnings("unused") REnvironment env) {
return getPromiseHelper().evaluate(null, expr);
return getPromiseHelper().evaluate(Utils.getActualCurrentFrame().materialize(), expr);
}
@Specialization
@TruffleBoundary
Object handleExpression(RExpression expr, Object envArg) {
return RContext.getEngine().eval(expr, getEnv(envArg), null);
return RContext.getEngine().eval(expr, getEnv(envArg), createCall());
}
@Specialization(guards = "expr.isLanguage()")
@TruffleBoundary
Object handleLanguage(RPairList expr, Object envArg) {
return RContext.getEngine().eval(expr, getEnv(envArg), null);
return RContext.getEngine().eval(expr, getEnv(envArg), createCall());
}
@Specialization
......@@ -124,7 +132,7 @@ public abstract class RfEvalNode extends FFIUpCallNode.Arg2 {
@TruffleBoundary
private static Object evalFunction(RFunction f, REnvironment env, ArgumentsSignature argsNames, Object... args) {
return RContext.getEngine().evalFunction(f, env == REnvironment.globalEnv() ? null : env.getFrame(), RCaller.topLevel, true, argsNames, args);
return RContext.getEngine().evalFunction(f, env == REnvironment.globalEnv() ? null : env.getFrame(), createCall(), true, argsNames, args);
}
@Fallback
......
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