comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CallTarget.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 a12017c18d5d
children f675818d9ad0
comparison
equal deleted inserted replaced
14989:a0dbb3628f2a 14991:64dcb92ee75a
22 * or visit www.oracle.com if you need additional information or have any 22 * or visit www.oracle.com if you need additional information or have any
23 * questions. 23 * questions.
24 */ 24 */
25 package com.oracle.truffle.api; 25 package com.oracle.truffle.api;
26 26
27 import com.oracle.truffle.api.frame.*;
28
29 /** 27 /**
30 * Represents the target of a call. 28 * Represents the target of a call.
31 */ 29 */
32 public abstract class CallTarget { 30 public abstract class CallTarget {
33 31
32 public static final Object[] NO_ARGUMENTS = new Object[0];
33
34 /** 34 /**
35 * Calls this target as a root method and without arguments. 35 * Calls this target as a root method..
36 * 36 *
37 * @param arguments passed arguments as an object array
37 * @return the return result of the call 38 * @return the return result of the call
38 */ 39 */
40 public abstract Object call(Object[] arguments);
41
39 public final Object call() { 42 public final Object call() {
40 return call(null, Arguments.EMPTY_ARGUMENTS); 43 return call(NO_ARGUMENTS);
41 } 44 }
42
43 /**
44 * Calls this target with a caller frame and no arguments.
45 *
46 * @param caller the caller frame
47 * @return the return result of the call
48 */
49 public final Object call(PackedFrame caller) {
50 return call(caller, Arguments.EMPTY_ARGUMENTS);
51 }
52
53 /**
54 * Calls this target as a root method passing arguments.
55 *
56 * @param arguments the arguments that should be passed to the callee
57 * @return the return result of the call
58 */
59 public final Object call(Arguments arguments) {
60 return call(null, arguments);
61 }
62
63 /**
64 * Calls this target passing a caller frame and arguments.
65 *
66 * @param caller the caller frame
67 * @param arguments the arguments that should be passed to the callee
68 * @return the return result of the call
69 */
70 public abstract Object call(PackedFrame caller, Arguments arguments);
71 } 45 }