# HG changeset patch # User Christian Humer # Date 1390221894 -3600 # Node ID 232eb670894333bcad2513d67fee6c7fd8c805b8 # Parent ac5b0f31f7a220219e0ceb1dfc79cfa003d74221 Ruby: required fixes for moving FrameDescriptor to the RootNode. diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/RubyRootNode.java --- 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; diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/CoreMethodNodeManager.java --- 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 { diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/core/ModuleNodes.java --- 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); diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/JRubyParser.java --- 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); diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/MethodTranslator.java --- 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(), diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.parser/src/com/oracle/truffle/ruby/parser/ModuleTranslator.java --- 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); diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyContext.java --- 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) { diff -r ac5b0f31f7a2 -r 232eb6708943 graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/RubyParserResult.java --- 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; - } - }