diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java index d39308b1ce11a881d5752fedf1fc500ba68ae365..5d38f5473f74d870b7c4c5d4ca30384b1758c9b2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Parse.java @@ -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]); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java index c37597d0690a1c8ccae5322cb8a7ae91e4b3e26f..af83fd603a56f75d1caf484a3af591f654851582 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java @@ -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(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java index 2eb77334c9d86cdb3b18af0e955c8b07a448931b..ca56335a05ff1e8ee2ae11e192a9e19829cdfc22 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ReplacementNode.java @@ -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. diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java index fe6fc77fa95752f8dea4d2fced40aa64930cd326..1442f9e5680f51ae2c80378deb70efeaa0f8690d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/Engine.java @@ -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. diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java index ed06179415b6664a02f7c636e3f3e317cea37ea4..60e4849da510533cf94c597f48145f165e6bbf45 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RLanguage.java @@ -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) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java index 0539766d5a960249d716461c4a4d59062ae389e7..e72da32fb6a83a80d1e330546701ec42bf420e38 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxFunction.java @@ -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; - } - }; - } }