Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 13804:3840d61e0e68
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 28 Jan 2014 12:52:57 +0100 |
parents | e076c87ab175 |
children | 641f22b1c6b8 |
rev | line source |
---|---|
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
11535
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
11279
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9258
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9258
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
494b818b527c
Adding "Classpath" exception to the classes in the com.oracle.truffle.api and the com.oracle.truffle.api.dsl package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9258
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 * questions. |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 */ |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.nodes; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.*; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 import com.oracle.truffle.api.frame.*; |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7267
diff
changeset
|
31 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7267
diff
changeset
|
32 * root node can be used to create a call target using |
13705
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
33 * {@link TruffleRuntime#createCallTarget(RootNode)}. |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 */ |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 public abstract class RootNode extends Node { |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 |
13705
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
37 private CallTarget callTarget; |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
38 private final FrameDescriptor frameDescriptor; |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
39 |
11535
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
40 protected RootNode() { |
13705
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
41 this(null, null); |
11535
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
42 } |
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
43 |
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
44 protected RootNode(SourceSection sourceSection) { |
13705
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
45 this(sourceSection, null); |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
46 } |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
47 |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
48 protected RootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor) { |
11535
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
49 super(sourceSection); |
13705
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
50 if (frameDescriptor == null) { |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
51 this.frameDescriptor = new FrameDescriptor(); |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
52 } else { |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
53 this.frameDescriptor = frameDescriptor; |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
54 } |
11535
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
55 } |
8f0fb0ade839
Truffle: add alternate Node/RootNode constructors with SourceSection argument.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
11279
diff
changeset
|
56 |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 /** |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
58 * Creates a copy of the current {@link RootNode} for use as inlined AST. The default |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
59 * implementation copies this {@link RootNode} and all its children recursively. It is |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
60 * recommended to override this method to provide an implementation that copies an uninitialized |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
61 * version of this AST. An uninitialized version of an AST was usually never executed which |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
62 * means that it has not yet collected any profiling feedback. Please note that changes in the |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
63 * behavior of this method might also require changes in {@link #getInlineNodeCount()}. |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
64 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
65 * @see RootNode#getInlineNodeCount() |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
66 * @see RootNode#isInlinable() |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
67 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
68 * @return the copied RootNode for inlining |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
69 * @throws UnsupportedOperationException if {@link #isInlinable()} returns false |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
70 */ |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
71 public RootNode inline() { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
72 if (!isInlinable()) { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
73 throw new UnsupportedOperationException("Inlining is not enabled."); |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
74 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
75 return NodeUtil.cloneNode(this); |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
76 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
77 |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
78 /** |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
79 * Returns the number of nodes that would be returned if {@link #inline()} would get invoked. |
13804 | 80 * This node count may be used for the calculation in a smart inlining heuristic. |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
81 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
82 * @see RootNode#inline() |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
83 * @see RootNode#isInlinable() |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
84 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
85 * @return the number of nodes that will get inlined |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
86 * @throws UnsupportedOperationException if {@link #isInlinable()} returns false |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
87 */ |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
88 public int getInlineNodeCount() { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
89 if (!isInlinable()) { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
90 throw new UnsupportedOperationException("Inlining is not enabled."); |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
91 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
92 return NodeUtil.countNodes(this); |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
93 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
94 |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
95 /** |
13804 | 96 * Returns true if this RootNode can be inlined. If this method returns true implementations of |
97 * {@link #inline()} and {@link #getInlineNodeCount()} must be provided. Returns | |
98 * <code>true</code> by default. | |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
99 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
100 * @see RootNode#inline() |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
101 * @see RootNode#getInlineNodeCount() |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
102 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
103 * @return true if this RootNode can be inlined |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
104 */ |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
105 public boolean isInlinable() { |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
106 return true; |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
107 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
108 |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
109 /** |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 * Executes this function using the specified frame and returns the result value. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7267
diff
changeset
|
111 * |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 * @param frame the frame of the currently executing guest language method |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 * @return the value of the execution |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
114 */ |
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 public abstract Object execute(VirtualFrame frame); |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
116 |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
117 public CallTarget getCallTarget() { |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
118 return callTarget; |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
119 } |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
120 |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
13705
diff
changeset
|
121 public final FrameDescriptor getFrameDescriptor() { |
13705
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
122 return frameDescriptor; |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
123 } |
ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
Christian Humer <christian.humer@gmail.com>
parents:
11535
diff
changeset
|
124 |
9258
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
125 public void setCallTarget(CallTarget callTarget) { |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
126 this.callTarget = callTarget; |
07f8d136a05e
Truffle API changes for the Frame API. Introduction of Assumptions class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
127 } |
7267
a4b84ba6dc2e
Introduction of the Truffle API for efficient implementation of dynamic languages on top of the Graal VM. New projects com.oracle.truffle.api for the API definition and com.oracle.truffle.api.test for API tests and documentation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 } |