changeset 13706:232eb6708943

Ruby: required fixes for moving FrameDescriptor to the RootNode.
author Christian Humer <christian.humer@gmail.com>
date Mon, 20 Jan 2014 13:44:54 +0100
parents ac5b0f31f7a2
children 40fd9958cdf5
files graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/RubyRootNode.java graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/CoreMethodNodeManager.java graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/ModuleNodes.java graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/JRubyParser.java graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/MethodTranslator.java graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/ModuleTranslator.java graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyContext.java graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyParserResult.java
diffstat 8 files changed, 14 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/RubyRootNode.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/RubyRootNode.java	Mon Jan 20 13:44:54 2014 +0100
@@ -22,8 +22,8 @@
     protected final String indicativeName;
     @Child protected RubyNode body;
 
-    public RubyRootNode(SourceSection sourceSection, String indicativeName, RubyNode body) {
-        super(sourceSection);
+    public RubyRootNode(SourceSection sourceSection, FrameDescriptor descriptor, String indicativeName, RubyNode body) {
+        super(sourceSection, descriptor);
 
         assert indicativeName != null;
         assert body != null;
--- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/CoreMethodNodeManager.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/CoreMethodNodeManager.java	Mon Jan 20 13:44:54 2014 +0100
@@ -176,7 +176,7 @@
         final CheckArityNode checkArity = new CheckArityNode(context, sourceSection, arity);
         final SequenceNode block = new SequenceNode(context, sourceSection, checkArity, methodNode);
 
-        return new RubyRootNode(sourceSection, methodDetails.getClassAnnotation().name() + "#" + methodDetails.getMethodAnnotation().names()[0] + "(core)", block);
+        return new RubyRootNode(sourceSection, null, methodDetails.getClassAnnotation().name() + "#" + methodDetails.getMethodAnnotation().names()[0] + "(core)", block);
     }
 
     public static class MethodDetails {
--- a/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/ModuleNodes.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/ModuleNodes.java	Mon Jan 20 13:44:54 2014 +0100
@@ -96,7 +96,7 @@
 
             final SequenceNode block = new SequenceNode(context, sourceSection, checkArity, readInstanceVariable);
 
-            final RubyRootNode pristineRoot = new RubyRootNode(sourceSection, name + "(attr_reader)", block);
+            final RubyRootNode pristineRoot = new RubyRootNode(sourceSection, null, name + "(attr_reader)", block);
             final CallTarget callTarget = Truffle.getRuntime().createCallTarget(NodeUtil.cloneNode(pristineRoot));
             final InlinableMethodImplementation methodImplementation = new InlinableMethodImplementation(callTarget, null, new FrameDescriptor(), pristineRoot, true, false);
             final RubyMethod method = new RubyMethod(sourceSection, module, new UniqueMethodIdentifier(), null, name, Visibility.PUBLIC, false, methodImplementation);
@@ -139,7 +139,7 @@
 
             final SequenceNode block = new SequenceNode(context, sourceSection, checkArity, writeInstanceVariable);
 
-            final RubyRootNode pristineRoot = new RubyRootNode(sourceSection, name + "(attr_writer)", block);
+            final RubyRootNode pristineRoot = new RubyRootNode(sourceSection, null, name + "(attr_writer)", block);
             final CallTarget callTarget = Truffle.getRuntime().createCallTarget(NodeUtil.cloneNode(pristineRoot));
             final InlinableMethodImplementation methodImplementation = new InlinableMethodImplementation(callTarget, null, new FrameDescriptor(), pristineRoot, true, false);
             final RubyMethod method = new RubyMethod(sourceSection, module, new UniqueMethodIdentifier(), null, name + "=", Visibility.PUBLIC, false, methodImplementation);
--- a/graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/JRubyParser.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/JRubyParser.java	Mon Jan 20 13:44:54 2014 +0100
@@ -150,11 +150,10 @@
                     throw new UnsupportedOperationException();
             }
 
-            final RootNode root = new RubyRootNode(truffleNode.getSourceSection(), indicativeName, truffleNode);
+            final RootNode root = new RubyRootNode(truffleNode.getSourceSection(), environment.getFrameDescriptor(), indicativeName, truffleNode);
 
             // Return the root and the frame descriptor
-
-            return new RubyParserResult(root, environment.getFrameDescriptor());
+            return new RubyParserResult(root);
         } finally {
             if (debugManager != null) {
                 debugManager.notifyFinishedLoading(source);
--- a/graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/MethodTranslator.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/MethodTranslator.java	Mon Jan 20 13:44:54 2014 +0100
@@ -59,9 +59,9 @@
             body = new CatchNextNode(context, sourceSection, body);
         }
 
-        final RubyRootNode pristineRootNode = new RubyRootNode(sourceSection, methodName, body);
+        final RubyRootNode pristineRootNode = new RubyRootNode(sourceSection, environment.getFrameDescriptor(), methodName, body);
 
-        final CallTarget callTarget = Truffle.getRuntime().createCallTarget(NodeUtil.cloneNode(pristineRootNode), environment.getFrameDescriptor());
+        final CallTarget callTarget = Truffle.getRuntime().createCallTarget(NodeUtil.cloneNode(pristineRootNode));
 
         if (isBlock) {
             return new BlockDefinitionNode(context, sourceSection, methodName, environment.getUniqueMethodIdentifier(), environment.getFrameDescriptor(), environment.needsDeclarationFrame(),
--- a/graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/ModuleTranslator.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/ModuleTranslator.java	Mon Jan 20 13:44:54 2014 +0100
@@ -57,9 +57,9 @@
 
         body = new CatchReturnNode(context, sourceSection, body, environment.getReturnID());
 
-        final RubyRootNode pristineRootNode = new RubyRootNode(sourceSection, methodName, body);
+        final RubyRootNode pristineRootNode = new RubyRootNode(sourceSection, environment.getFrameDescriptor(), methodName, body);
 
-        final CallTarget callTarget = Truffle.getRuntime().createCallTarget(NodeUtil.cloneNode(pristineRootNode), environment.getFrameDescriptor());
+        final CallTarget callTarget = Truffle.getRuntime().createCallTarget(NodeUtil.cloneNode(pristineRootNode));
 
         return new MethodDefinitionNode(context, sourceSection, methodName, environment.getUniqueMethodIdentifier(), environment.getFrameDescriptor(), environment.needsDeclarationFrame(),
                         pristineRootNode, callTarget);
--- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyContext.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyContext.java	Mon Jan 20 13:44:54 2014 +0100
@@ -172,7 +172,7 @@
         try {
             final RubyParserResult parseResult = parser.parse(context, source, parserContext, parentFrame);
             final RubyArguments arguments = new RubyArguments(parentFrame, self, null);
-            final CallTarget callTarget = Truffle.getRuntime().createCallTarget(parseResult.getRootNode(), parseResult.getFrameDescriptor());
+            final CallTarget callTarget = Truffle.getRuntime().createCallTarget(parseResult.getRootNode());
 
             return callTarget.call(null, arguments);
         } catch (RaiseException e) {
--- a/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyParserResult.java	Fri Jan 17 17:06:08 2014 +0100
+++ b/graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyParserResult.java	Mon Jan 20 13:44:54 2014 +0100
@@ -9,7 +9,6 @@
  */
 package com.oracle.truffle.ruby.runtime;
 
-import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
 /**
@@ -19,23 +18,15 @@
  */
 public class RubyParserResult {
 
-    private RootNode rootNode;
-    private FrameDescriptor frameDescriptor;
+    private final RootNode rootNode;
 
-    public RubyParserResult(RootNode rootNode, FrameDescriptor frameDescriptor) {
+    public RubyParserResult(RootNode rootNode) {
         assert rootNode != null;
-        assert frameDescriptor != null;
-
         this.rootNode = rootNode;
-        this.frameDescriptor = frameDescriptor;
     }
 
     public RootNode getRootNode() {
         return rootNode;
     }
 
-    public FrameDescriptor getFrameDescriptor() {
-        return frameDescriptor;
-    }
-
 }