Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/RubyRootNode.java @ 13792:9e7acc9cad8e
kill unused frame states when loop exits are removed
thanks to Gilles
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Tue, 28 Jan 2014 23:38:22 +0100 |
parents | 232eb6708943 |
children |
rev | line source |
---|---|
13514 | 1 /* |
2 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This | |
3 * code is released under a tri EPL/GPL/LGPL license. You can use it, | |
4 * redistribute it and/or modify it under the terms of the: | |
5 * | |
6 * Eclipse Public License version 1.0 | |
7 * GNU General Public License version 2 | |
8 * GNU Lesser General Public License version 2.1 | |
9 */ | |
10 package com.oracle.truffle.ruby.nodes; | |
11 | |
12 import com.oracle.truffle.api.*; | |
13 import com.oracle.truffle.api.frame.*; | |
14 import com.oracle.truffle.api.nodes.*; | |
15 | |
16 /** | |
17 * The root node in an AST for a method. Unlike {@link RubyNode}, this has a single entry point, | |
18 * {@link #execute}, which Truffle knows about and can create a {@link CallTarget} from. | |
19 */ | |
20 public class RubyRootNode extends RootNode { | |
21 | |
22 protected final String indicativeName; | |
23 @Child protected RubyNode body; | |
24 | |
13706
232eb6708943
Ruby: required fixes for moving FrameDescriptor to the RootNode.
Christian Humer <christian.humer@gmail.com>
parents:
13514
diff
changeset
|
25 public RubyRootNode(SourceSection sourceSection, FrameDescriptor descriptor, String indicativeName, RubyNode body) { |
232eb6708943
Ruby: required fixes for moving FrameDescriptor to the RootNode.
Christian Humer <christian.humer@gmail.com>
parents:
13514
diff
changeset
|
26 super(sourceSection, descriptor); |
13514 | 27 |
28 assert indicativeName != null; | |
29 assert body != null; | |
30 | |
31 this.body = adoptChild(body); | |
32 this.indicativeName = indicativeName; | |
33 } | |
34 | |
35 @Override | |
36 public Object execute(VirtualFrame frame) { | |
37 return body.execute(frame); | |
38 } | |
39 | |
40 @Override | |
41 public String toString() { | |
42 final SourceSection sourceSection = getSourceSection(); | |
43 final String source = sourceSection == null ? "<unknown>" : sourceSection.toString(); | |
44 return "Method " + indicativeName + ":" + source + "@" + Integer.toHexString(hashCode()); | |
45 } | |
46 | |
47 } |