Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/DirectCallNode.java @ 15093:5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 14 Apr 2014 20:32:25 +0200 |
parents | graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/CallNode.java@07e7aae05983 |
children | 40d0022115ee |
rev | line source |
---|---|
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * accompanied this code). |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 * questions. |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 */ |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.nodes; |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.*; |
15064
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
28 import com.oracle.truffle.api.frame.*; |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 /** |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
31 * Represents a direct call to a {@link CallTarget}. Direct calls are calls for which the |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
32 * {@link CallTarget} remains the same for each consecutive call. This part of the Truffle API |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
33 * enables the runtime system to perform additional optimizations on direct calls. |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
34 * |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
35 * Optimizations that can be applied to a {@link DirectCallNode} are inlining and splitting. |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
36 * Inlining inlines this call site into the call graph of the parent {@link CallTarget}. Splitting |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
37 * duplicates the {@link CallTarget} using {@link RootNode#split()} to collect call site sensitive |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
38 * profiling information. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
39 * |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
40 * Please note: This class is not intended to be subclassed by guest language implementations. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
41 * |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
42 * @see IndirectCallNode for calls with a non-constant target |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
43 * @see TruffleRuntime#createDirectCallNode(CallTarget) |
15089
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
44 * @see #forceInlining() |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
45 * @see #split() |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 */ |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
47 public abstract class DirectCallNode extends Node { |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 protected final CallTarget callTarget; |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
51 protected DirectCallNode(CallTarget callTarget) { |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 this.callTarget = callTarget; |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 } |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 /** |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
56 * Calls the inner {@link CallTarget} returned by {@link #getCurrentCallTarget()}. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
57 * |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 * @param arguments the arguments that should be passed to the callee |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 * @return the return result of the call |
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 */ |
15064
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
61 public abstract Object call(VirtualFrame frame, Object[] arguments); |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
63 /** |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
64 * Returns the originally supplied {@link CallTarget} when this call node was created. Please |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
65 * note that the returned {@link CallTarget} is not necessarily the {@link CallTarget} that is |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
66 * called. For that use {@link #getCurrentCallTarget()} instead. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
67 * |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
68 * @return the {@link CallTarget} provided. |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
69 */ |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
70 public CallTarget getCallTarget() { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
71 return callTarget; |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
72 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
73 |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
74 /** |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
75 * Returns <code>true</code> if the underlying runtime system supports inlining for the |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
76 * {@link CallTarget} in this {@link DirectCallNode}. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
77 * |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
78 * @return true if inlining is supported. |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
79 */ |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
80 public abstract boolean isInlinable(); |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
81 |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
82 /** |
15089
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
83 * Returns <code>true</code> if the {@link CallTarget} is forced to be inlined. A |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
84 * {@link DirectCallNode} can either be inlined manually by invoking {@link #forceInlining()} or |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
85 * by the runtime system which may at any point decide to inline. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
86 * |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
87 * @return true if this method was inlined else false. |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 */ |
15089
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
89 public abstract boolean isInliningForced(); |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
91 /** |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
92 * Enforces the runtime system to inline the {@link CallTarget} at this call site. If the |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
93 * runtime system does not support inlining or it is already inlined this method has no effect. |
15090
07e7aae05983
Truffle: context sensitive inlining cleanup
Christian Humer <christian.humer@gmail.com>
parents:
15089
diff
changeset
|
94 * The runtime system may decide to not inline calls which were forced to inline. |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
95 */ |
15089
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
96 public abstract void forceInlining(); |
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
97 |
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
98 /** |
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
99 * Returns true if the runtime system has decided to inline this call-site. If the |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
100 * {@link DirectCallNode} was forced to inline then this does not necessarily mean that the |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
101 * {@link DirectCallNode} is really going to be inlined. This depends on whether or not the |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
102 * runtime system supports inlining. The runtime system may also decide to not inline calls |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
103 * which were forced to inline. |
15089
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
104 */ |
448338c9ce96
Truffle: Made inlining context-insensitive again to reduce complexity.
Christian Humer <christian.humer@gmail.com>
parents:
15064
diff
changeset
|
105 public abstract boolean isInlined(); |
13983
f46cab39a9a2
Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13851
diff
changeset
|
106 |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
107 /** |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
108 * Returns <code>true</code> if this {@link DirectCallNode} can be split. A |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
109 * {@link DirectCallNode} can only be split if the runtime system supports splitting and if the |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
110 * {@link RootNode} contained the {@link CallTarget} returns <code>true</code> for |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
111 * {@link RootNode#isSplittable()}. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
112 * |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
113 * @return <code>true</code> if the target can be split |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
114 */ |
13983
f46cab39a9a2
Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13851
diff
changeset
|
115 public abstract boolean isSplittable(); |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
117 /** |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
118 * Enforces the runtime system to split the {@link CallTarget}. If the {@link DirectCallNode} is |
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
119 * not splittable this methods has no effect. |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
120 */ |
13983
f46cab39a9a2
Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13851
diff
changeset
|
121 public abstract boolean split(); |
f46cab39a9a2
Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13851
diff
changeset
|
122 |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
123 /** |
15093
5634b199c4da
Truffle: API-change: renamed CallNode to DirectCallNode and added IndirectCallNode.
Christian Humer <christian.humer@gmail.com>
parents:
15090
diff
changeset
|
124 * Returns <code>true</code> if the target of the {@link DirectCallNode} was split. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
125 * |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
126 * @return if the target was split |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
127 */ |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
128 public final boolean isSplit() { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
129 return getSplitCallTarget() != null; |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
130 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
131 |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
132 /** |
15064
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
133 * Returns the split {@link CallTarget} if this method is split. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
134 * |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
135 * @return the split {@link CallTarget} |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
136 */ |
13983
f46cab39a9a2
Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13851
diff
changeset
|
137 public abstract CallTarget getSplitCallTarget(); |
f46cab39a9a2
Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
Christian Humer <christian.humer@gmail.com>
parents:
13851
diff
changeset
|
138 |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
139 /** |
15064
f675818d9ad0
new getStackTrace and getCurrentFrame functionality in TruffleRuntime
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14991
diff
changeset
|
140 * Returns the used call target when {@link #call(VirtualFrame, Object[])} is invoked. If the |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
141 * {@link CallTarget} was split this method returns the {@link CallTarget} returned by |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
142 * {@link #getSplitCallTarget()}. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
143 * |
14073
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
144 * @return the used {@link CallTarget} when node is called |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
145 */ |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
146 public CallTarget getCurrentCallTarget() { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
147 CallTarget split = getSplitCallTarget(); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
148 if (split != null) { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
149 return split; |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
150 } else { |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
151 return getCallTarget(); |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
152 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
153 } |
c5411233cdf8
Truffle: Now keeps track of all not just inlined call-sites called by CallNode. Deprecated some old API in NodeUtil.
Christian Humer <christian.humer@gmail.com>
parents:
13983
diff
changeset
|
154 |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
155 /** |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
156 * Returns the {@link RootNode} associated with {@link CallTarget} returned by |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
157 * {@link #getCurrentCallTarget()}. If the stored {@link CallTarget} does not contain a |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
158 * {@link RootNode} this method returns <code>null</code>. |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14982
diff
changeset
|
159 * |
14566
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
160 * @see #getCurrentCallTarget() |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
161 * @return the root node of the used call target |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
162 */ |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
163 public final RootNode getCurrentRootNode() { |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
164 CallTarget target = getCurrentCallTarget(); |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
165 if (target instanceof RootCallTarget) { |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
166 return ((RootCallTarget) target).getRootNode(); |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
167 } |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
168 return null; |
6681b9eb3f4c
Truffle: API cleanup and javadoc for CallNodes.
Christian Humer <christian.humer@gmail.com>
parents:
14565
diff
changeset
|
169 } |
13803
e076c87ab175
Truffle: refactored inlining interfaces to a more compact CallNode.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
170 } |