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

Merge pull request #575 in G/fastr from...

Merge pull request #575 in G/fastr from ~LUKAS.STADLER_ORACLE.COM/fastr:feature/update_truffle to master

* commit 'e89ba976':
  update Truffle dependency
parents cead44c8 e89ba976
No related branches found
No related tags found
No related merge requests found
...@@ -293,9 +293,9 @@ final class REngine implements Engine, Engine.Timings { ...@@ -293,9 +293,9 @@ final class REngine implements Engine, Engine.Timings {
} }
@Override @Override
public CallTarget parseToCallTarget(Source source) throws ParseException { public CallTarget parseToCallTarget(Source source, MaterializedFrame executionFrame) throws ParseException {
List<RSyntaxNode> statements = parseImpl(source); List<RSyntaxNode> statements = parseImpl(source);
return Truffle.getRuntime().createCallTarget(new PolyglotEngineRootNode(statements, createSourceSection(statements))); return Truffle.getRuntime().createCallTarget(new PolyglotEngineRootNode(statements, createSourceSection(statements), executionFrame));
} }
private static SourceSection createSourceSection(List<RSyntaxNode> statements) { private static SourceSection createSourceSection(List<RSyntaxNode> statements) {
...@@ -311,16 +311,18 @@ final class REngine implements Engine, Engine.Timings { ...@@ -311,16 +311,18 @@ final class REngine implements Engine, Engine.Timings {
private final class PolyglotEngineRootNode extends RootNode { private final class PolyglotEngineRootNode extends RootNode {
private final List<RSyntaxNode> statements; private final List<RSyntaxNode> statements;
private final MaterializedFrame executionFrame;
@Children private final DirectCallNode[] calls; @Children private final DirectCallNode[] calls;
private final boolean printResult; private final boolean printResult;
@Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode(); @Child private Node findContext = TruffleRLanguage.INSTANCE.actuallyCreateFindContextNode();
PolyglotEngineRootNode(List<RSyntaxNode> statements, SourceSection sourceSection) { PolyglotEngineRootNode(List<RSyntaxNode> statements, SourceSection sourceSection, MaterializedFrame executionFrame) {
super(TruffleRLanguage.class, sourceSection, new FrameDescriptor()); super(TruffleRLanguage.class, sourceSection, new FrameDescriptor());
// can't print if initializing the system in embedded mode (no builtins yet) // can't print if initializing the system in embedded mode (no builtins yet)
this.printResult = !sourceSection.getSource().getName().equals(RSource.Internal.INIT_EMBEDDED.string); this.printResult = !sourceSection.getSource().getName().equals(RSource.Internal.INIT_EMBEDDED.string);
this.statements = statements; this.statements = statements;
this.executionFrame = executionFrame;
this.calls = new DirectCallNode[statements.size()]; this.calls = new DirectCallNode[statements.size()];
} }
...@@ -343,7 +345,7 @@ final class REngine implements Engine, Engine.Timings { ...@@ -343,7 +345,7 @@ final class REngine implements Engine, Engine.Timings {
CompilerDirectives.transferToInterpreterAndInvalidate(); CompilerDirectives.transferToInterpreterAndInvalidate();
calls[i] = insert(Truffle.getRuntime().createDirectCallNode(doMakeCallTarget(node.asRNode(), RSource.Internal.REPL_WRAPPER.string, printResult, true))); calls[i] = insert(Truffle.getRuntime().createDirectCallNode(doMakeCallTarget(node.asRNode(), RSource.Internal.REPL_WRAPPER.string, printResult, true)));
} }
lastValue = calls[i].call(frame, new Object[]{newContext.stateREnvironment.getGlobalFrame()}); lastValue = calls[i].call(frame, new Object[]{executionFrame != null ? executionFrame : newContext.stateREnvironment.getGlobalFrame()});
} }
return lastValue; return lastValue;
} catch (ReturnException ex) { } catch (ReturnException ex) {
......
...@@ -25,18 +25,16 @@ package com.oracle.truffle.r.engine; ...@@ -25,18 +25,16 @@ package com.oracle.truffle.r.engine;
import java.util.Locale; import java.util.Locale;
import com.oracle.truffle.api.CallTarget; import com.oracle.truffle.api.CallTarget;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.Truffle; import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.TruffleLanguage; import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.frame.FrameDescriptor; import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.instrumentation.Instrumenter; import com.oracle.truffle.api.instrumentation.Instrumenter;
import com.oracle.truffle.api.instrumentation.ProvidedTags; import com.oracle.truffle.api.instrumentation.ProvidedTags;
import com.oracle.truffle.api.instrumentation.StandardTags; import com.oracle.truffle.api.instrumentation.StandardTags;
import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.r.engine.interop.RForeignAccessFactoryImpl; import com.oracle.truffle.r.engine.interop.RForeignAccessFactoryImpl;
import com.oracle.truffle.r.nodes.RASTBuilder; import com.oracle.truffle.r.nodes.RASTBuilder;
import com.oracle.truffle.r.nodes.builtin.RBuiltinPackages; import com.oracle.truffle.r.nodes.builtin.RBuiltinPackages;
...@@ -139,13 +137,13 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> { ...@@ -139,13 +137,13 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> {
return null; return null;
} }
@Override
@TruffleBoundary
@SuppressWarnings("try") @SuppressWarnings("try")
protected CallTarget parse(Source source, Node context, String... argumentNames) throws com.oracle.truffle.api.vm.IncompleteSourceException { @Override
protected CallTarget parse(ParsingRequest request) throws Exception {
CompilerAsserts.neverPartOfCompilation();
try (RCloseable c = RContext.withinContext(findContext(createFindContextNode()))) { try (RCloseable c = RContext.withinContext(findContext(createFindContextNode()))) {
try { try {
return RContext.getEngine().parseToCallTarget(source); return RContext.getEngine().parseToCallTarget(request.getSource(), request.getFrame());
} catch (IncompleteSourceException e) { } catch (IncompleteSourceException e) {
throw new com.oracle.truffle.api.vm.IncompleteSourceException(e); throw new com.oracle.truffle.api.vm.IncompleteSourceException(e);
} catch (ParseException e) { } catch (ParseException e) {
...@@ -189,9 +187,4 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> { ...@@ -189,9 +187,4 @@ public final class TruffleRLanguage extends TruffleLanguage<RContext> {
public RContext actuallyFindContext0(Node contextNode) { public RContext actuallyFindContext0(Node contextNode) {
return findContext(contextNode); return findContext(contextNode);
} }
@Override
protected Object evalInContext(Source source, Node node, MaterializedFrame frame) {
return RContext.getEngine().parseAndEval(source, frame, false);
}
} }
...@@ -126,7 +126,7 @@ public interface Engine { ...@@ -126,7 +126,7 @@ public interface Engine {
* return a {@link CallTarget} which may be cached for future use, and the * return a {@link CallTarget} which may be cached for future use, and the
* {@link PolyglotEngine} is responsible for actually invoking the call target. * {@link PolyglotEngine} is responsible for actually invoking the call target.
*/ */
CallTarget parseToCallTarget(Source source) throws ParseException; CallTarget parseToCallTarget(Source source, MaterializedFrame executionFrame) throws ParseException;
/** /**
* Parse and evaluate {@code rscript} in {@code frame}. {@code printResult == true}, the result * Parse and evaluate {@code rscript} in {@code frame}. {@code printResult == true}, the result
......
...@@ -28,7 +28,7 @@ suite = { ...@@ -28,7 +28,7 @@ suite = {
"suites" : [ "suites" : [
{ {
"name" : "truffle", "name" : "truffle",
"version" : "13641c9f68eefccd0099d283ca25d6bb44b3349a", "version" : "720bba917bc2907b9e6620365a1b3c66e2ad3cc6",
"urls" : [ "urls" : [
{"url" : "https://github.com/graalvm/truffle", "kind" : "git"}, {"url" : "https://github.com/graalvm/truffle", "kind" : "git"},
{"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
......
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