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

various small fixes

parent 77fd1900
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,7 @@ public abstract class Parse extends RBuiltinNode.Arg6 {
@TruffleBoundary
@Specialization
protected Object parse(int conn, int n, @SuppressWarnings("unused") RNull text, String prompt, Object srcFile, String encoding) {
protected RExpression parse(int conn, int n, @SuppressWarnings("unused") RNull text, String prompt, Object srcFile, String encoding) {
String[] lines;
RConnection connection = RConnection.fromIndex(conn);
if (connection == StdConnections.getStdin()) {
......@@ -128,12 +128,12 @@ public abstract class Parse extends RBuiltinNode.Arg6 {
@TruffleBoundary
@Specialization
protected Object parse(int conn, int n, RAbstractStringVector text, String prompt, Object srcFile, String encoding) {
protected RExpression parse(int conn, int n, RAbstractStringVector text, String prompt, Object srcFile, String encoding) {
RConnection connection = RConnection.fromIndex(conn);
return doParse(connection, n, text.materialize().getDataWithoutCopying(), prompt, srcFile, encoding);
}
private Object doParse(RConnection conn, int n, String[] lines, @SuppressWarnings("unused") String prompt, Object srcFile, @SuppressWarnings("unused") String encoding) {
private RExpression doParse(RConnection conn, int n, String[] lines, @SuppressWarnings("unused") String prompt, Object srcFile, @SuppressWarnings("unused") String encoding) {
String coalescedLines = coalesce(lines);
if (coalescedLines.length() == 0 || n == 0) {
return RDataFactory.createExpression(new Object[0]);
......
......@@ -23,7 +23,6 @@
package com.oracle.truffle.r.nodes.builtin.helpers;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.frame.VirtualFrame;
......@@ -88,7 +87,8 @@ public abstract class BrowserInteractNode extends RNode {
if (currentCaller == null) {
currentCaller = RCaller.topLevel;
}
RCaller browserCaller = createCaller(currentCaller);
RCodeBuilder<RSyntaxNode> builder = RContext.getASTBuilder();
RCaller browserCaller = RCaller.create(null, currentCaller, builder.call(RSyntaxNode.INTERNAL, builder.lookup(RSyntaxNode.INTERNAL, "browser", true)));
try {
browserState.setInBrowser(browserCaller);
LW: while (true) {
......@@ -178,12 +178,6 @@ public abstract class BrowserInteractNode extends RNode {
return exitMode;
}
@TruffleBoundary
private static RCaller createCaller(RCaller currentCaller) {
RCodeBuilder<RSyntaxNode> builder = RContext.getASTBuilder();
return RCaller.create(null, currentCaller, builder.call(RSyntaxNode.INTERNAL, builder.lookup(RSyntaxNode.INTERNAL, "browser", true)));
}
private String getSrcinfo(RStringVector element) {
if (getSrcRefAttrNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
......
......@@ -261,7 +261,8 @@ abstract class ReplacementNode extends OperatorNode {
replaceCall.execute(frame);
} catch (FullCallNeededException e) {
CompilerDirectives.transferToInterpreterAndInvalidate();
replace(new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex)).executeReplacement(frame);
replace(new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, RContext.getASTBuilder().process(rhs.asRSyntaxNode()).asRNode(), calls, targetVarName, isSuper,
tempNamesStartIndex)).executeReplacement(frame);
}
}
}
......@@ -308,7 +309,8 @@ abstract class ReplacementNode extends OperatorNode {
@Override
public Object execute(VirtualFrame frame) {
CompilerDirectives.transferToInterpreterAndInvalidate();
GenericReplacementNode replacement = new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex);
GenericReplacementNode replacement = new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, RContext.getASTBuilder().process(rhs.asRSyntaxNode()).asRNode(), calls,
targetVarName, isSuper, tempNamesStartIndex);
return replace(replacement).execute(frame);
}
......@@ -322,7 +324,8 @@ abstract class ReplacementNode extends OperatorNode {
replaceCall.execute(frame);
} catch (FullCallNeededException e) {
CompilerDirectives.transferToInterpreterAndInvalidate();
GenericReplacementNode replacement = replace(new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, rhs, calls, targetVarName, isSuper, tempNamesStartIndex));
GenericReplacementNode replacement = replace(new GenericReplacementNode(getLazySourceSection(), operator, target, lhs, RContext.getASTBuilder().process(rhs.asRSyntaxNode()).asRNode(),
calls, targetVarName, isSuper, tempNamesStartIndex));
if (e.rhsValue == null) {
// we haven't queried the rhs value yet
......@@ -351,7 +354,7 @@ abstract class ReplacementNode extends OperatorNode {
GenericReplacementNode(SourceSection source, RSyntaxLookup operator, RNode target, RSyntaxElement lhs, RNode rhs, List<RSyntaxCall> calls, String targetVarName, boolean isSuper,
int tempNamesStartIndex) {
super(source, operator, lhs, RContext.getASTBuilder().process(rhs.asRSyntaxNode()).asRNode(), 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.
......
......@@ -171,7 +171,7 @@ public interface Engine {
* namespace, but the current stack is not empty. So when {@code frame} is not {@code null} a
* {@code caller} should be passed to maintain the call stack correctly. {@code names} string
* vector describing (optional) argument names
*
*
* @param names signature of the given parameters, may be {@code null} in which case the empty
* signature of correct cardinality shall be used.
* @param evalPromises whether to evaluate promises in args array before calling the function.
......
......@@ -76,6 +76,7 @@ public class RLanguage extends RSharingAttributeStorage implements RAbstractCont
this.length = length;
}
@TruffleBoundary
public static Object fromList(Object o, RLanguage.RepType type) {
RList l;
if (o instanceof RPairList) {
......
......@@ -22,7 +22,6 @@
*/
package com.oracle.truffle.r.runtime.nodes;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.r.runtime.ArgumentsSignature;
/**
......@@ -39,45 +38,4 @@ public interface RSyntaxFunction extends RSyntaxElement {
String getSyntaxDebugName();
/**
* Helper function: creates a synthetic RSyntaxFunction.
*/
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;
}
@Override
public ArgumentsSignature getSyntaxSignature() {
return signature;
}
@Override
public RSyntaxElement[] getSyntaxArgumentDefaults() {
return arguments;
}
@Override
public RSyntaxElement getSyntaxBody() {
return body;
}
@Override
public void setSourceSection(SourceSection src) {
// ignored
}
@Override
public String getSyntaxDebugName() {
return debugName;
}
};
}
}
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