Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/CallNode.java @ 14991:64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 06 Apr 2014 17:46:24 +0200 |
parents | 1422f0bd55e3 |
children | f675818d9ad0 |
comparison
equal
deleted
inserted
replaced
14989:a0dbb3628f2a | 14991:64dcb92ee75a |
---|---|
23 * questions. | 23 * questions. |
24 */ | 24 */ |
25 package com.oracle.truffle.api.nodes; | 25 package com.oracle.truffle.api.nodes; |
26 | 26 |
27 import com.oracle.truffle.api.*; | 27 import com.oracle.truffle.api.*; |
28 import com.oracle.truffle.api.frame.*; | |
29 | 28 |
30 /** | 29 /** |
31 * Represents a call to a {@link CallTarget} in the Truffle AST. Addtionally to calling the | 30 * Represents a call to a {@link CallTarget} in the Truffle AST. Addtionally to calling the |
32 * {@link CallTarget} this {@link Node} enables the runtime system to implement further | 31 * {@link CallTarget} this {@link Node} enables the runtime system to implement further |
33 * optimizations. Optimizations that can possibly applied to a {@link CallNode} are inlining and | 32 * optimizations. Optimizations that can possibly applied to a {@link CallNode} are inlining and |
34 * splitting. Inlining inlines this call site into the call graph of the parent {@link CallTarget}. | 33 * splitting. Inlining inlines this call site into the call graph of the parent {@link CallTarget}. |
35 * Splitting duplicates the {@link CallTarget} using {@link RootNode#split()} to collect call site | 34 * Splitting duplicates the {@link CallTarget} using {@link RootNode#split()} to collect call site |
36 * sensitive profiling information. | 35 * sensitive profiling information. |
37 * | 36 * |
38 * Please note: This class is not intended to be subclassed by guest language implementations. | 37 * Please note: This class is not intended to be subclassed by guest language implementations. |
39 * | 38 * |
40 * @see TruffleRuntime#createCallNode(CallTarget) | 39 * @see TruffleRuntime#createCallNode(CallTarget) |
41 * @see #inline() | 40 * @see #inline() |
42 * @see #split() | 41 * @see #split() |
43 */ | 42 */ |
44 public abstract class CallNode extends Node { | 43 public abstract class CallNode extends Node { |
49 this.callTarget = callTarget; | 48 this.callTarget = callTarget; |
50 } | 49 } |
51 | 50 |
52 /** | 51 /** |
53 * Calls the inner {@link CallTarget} returned by {@link #getCurrentCallTarget()}. | 52 * Calls the inner {@link CallTarget} returned by {@link #getCurrentCallTarget()}. |
54 * | 53 * |
55 * @param caller the caller frame | |
56 * @param arguments the arguments that should be passed to the callee | 54 * @param arguments the arguments that should be passed to the callee |
57 * @return the return result of the call | 55 * @return the return result of the call |
58 */ | 56 */ |
59 public abstract Object call(PackedFrame caller, Arguments arguments); | 57 public abstract Object call(Object[] arguments); |
60 | 58 |
61 /** | 59 /** |
62 * Returns the originally supplied {@link CallTarget} when this call node was created. Please | 60 * Returns the originally supplied {@link CallTarget} when this call node was created. Please |
63 * note that the returned {@link CallTarget} is not necessarily the {@link CallTarget} that is | 61 * note that the returned {@link CallTarget} is not necessarily the {@link CallTarget} that is |
64 * called. For that use {@link #getCurrentCallTarget()} instead. | 62 * called. For that use {@link #getCurrentCallTarget()} instead. |
65 * | 63 * |
66 * @return the {@link CallTarget} provided. | 64 * @return the {@link CallTarget} provided. |
67 */ | 65 */ |
68 public CallTarget getCallTarget() { | 66 public CallTarget getCallTarget() { |
69 return callTarget; | 67 return callTarget; |
70 } | 68 } |
71 | 69 |
72 /** | 70 /** |
73 * Returns <code>true</code> if the underlying runtime system supports inlining for the | 71 * Returns <code>true</code> if the underlying runtime system supports inlining for the |
74 * {@link CallTarget} in this {@link CallNode}. | 72 * {@link CallTarget} in this {@link CallNode}. |
75 * | 73 * |
76 * @return true if inlining is supported. | 74 * @return true if inlining is supported. |
77 */ | 75 */ |
78 public abstract boolean isInlinable(); | 76 public abstract boolean isInlinable(); |
79 | 77 |
80 /** | 78 /** |
81 * Returns <code>true</code> if the {@link CallTarget} in this {@link CallNode} is inlined. A | 79 * Returns <code>true</code> if the {@link CallTarget} in this {@link CallNode} is inlined. A |
82 * {@link CallNode} can either be inlined manually by invoking {@link #inline()} or by the | 80 * {@link CallNode} can either be inlined manually by invoking {@link #inline()} or by the |
83 * runtime system which may at any point decide to inline. | 81 * runtime system which may at any point decide to inline. |
84 * | 82 * |
85 * @return true if this method was inlined else false. | 83 * @return true if this method was inlined else false. |
86 */ | 84 */ |
87 public abstract boolean isInlined(); | 85 public abstract boolean isInlined(); |
88 | 86 |
89 /** | 87 /** |
94 | 92 |
95 /** | 93 /** |
96 * Returns <code>true</code> if this {@link CallNode} can be split. A {@link CallNode} can only | 94 * Returns <code>true</code> if this {@link CallNode} can be split. A {@link CallNode} can only |
97 * be split if the runtime system supports splitting and if the {@link RootNode} contained the | 95 * be split if the runtime system supports splitting and if the {@link RootNode} contained the |
98 * {@link CallTarget} returns <code>true</code> for {@link RootNode#isSplittable()}. | 96 * {@link CallTarget} returns <code>true</code> for {@link RootNode#isSplittable()}. |
99 * | 97 * |
100 * @return <code>true</code> if the target can be split | 98 * @return <code>true</code> if the target can be split |
101 */ | 99 */ |
102 public abstract boolean isSplittable(); | 100 public abstract boolean isSplittable(); |
103 | 101 |
104 /** | 102 /** |
107 */ | 105 */ |
108 public abstract boolean split(); | 106 public abstract boolean split(); |
109 | 107 |
110 /** | 108 /** |
111 * Returns <code>true</code> if the target of the {@link CallNode} was split. | 109 * Returns <code>true</code> if the target of the {@link CallNode} was split. |
112 * | 110 * |
113 * @return if the target was split | 111 * @return if the target was split |
114 */ | 112 */ |
115 public final boolean isSplit() { | 113 public final boolean isSplit() { |
116 return getSplitCallTarget() != null; | 114 return getSplitCallTarget() != null; |
117 } | 115 } |
118 | 116 |
119 /** | 117 /** |
120 * Returns the splitted {@link CallTarget} if this method is split. | 118 * Returns the splitted {@link CallTarget} if this method is split. |
121 * | 119 * |
122 * @return the split {@link CallTarget} | 120 * @return the split {@link CallTarget} |
123 */ | 121 */ |
124 public abstract CallTarget getSplitCallTarget(); | 122 public abstract CallTarget getSplitCallTarget(); |
125 | 123 |
126 /** | 124 /** |
127 * Returns the used call target when {@link #call(PackedFrame, Arguments)} is invoked. If the | 125 * Returns the used call target when {@link #call(Object[])} is invoked. If the |
128 * {@link CallTarget} was split this method returns the {@link CallTarget} returned by | 126 * {@link CallTarget} was split this method returns the {@link CallTarget} returned by |
129 * {@link #getSplitCallTarget()}. | 127 * {@link #getSplitCallTarget()}. |
130 * | 128 * |
131 * @return the used {@link CallTarget} when node is called | 129 * @return the used {@link CallTarget} when node is called |
132 */ | 130 */ |
133 public CallTarget getCurrentCallTarget() { | 131 public CallTarget getCurrentCallTarget() { |
134 CallTarget split = getSplitCallTarget(); | 132 CallTarget split = getSplitCallTarget(); |
135 if (split != null) { | 133 if (split != null) { |
141 | 139 |
142 /** | 140 /** |
143 * Returns the {@link RootNode} associated with {@link CallTarget} returned by | 141 * Returns the {@link RootNode} associated with {@link CallTarget} returned by |
144 * {@link #getCurrentCallTarget()}. If the stored {@link CallTarget} does not contain a | 142 * {@link #getCurrentCallTarget()}. If the stored {@link CallTarget} does not contain a |
145 * {@link RootNode} this method returns <code>null</code>. | 143 * {@link RootNode} this method returns <code>null</code>. |
146 * | 144 * |
147 * @see #getCurrentCallTarget() | 145 * @see #getCurrentCallTarget() |
148 * @return the root node of the used call target | 146 * @return the root node of the used call target |
149 */ | 147 */ |
150 public final RootNode getCurrentRootNode() { | 148 public final RootNode getCurrentRootNode() { |
151 CallTarget target = getCurrentCallTarget(); | 149 CallTarget target = getCurrentCallTarget(); |