comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunction.java @ 21490:3286fb5fea4a

Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Tue, 26 May 2015 19:11:36 +0200
parents 64c77f0577bb
children c76742cc2c6f
comparison
equal deleted inserted replaced
21489:b3f1d8b23037 21490:3286fb5fea4a
21 * questions. 21 * questions.
22 */ 22 */
23 package com.oracle.truffle.sl.runtime; 23 package com.oracle.truffle.sl.runtime;
24 24
25 import com.oracle.truffle.api.*; 25 import com.oracle.truffle.api.*;
26 import com.oracle.truffle.api.interop.*;
26 import com.oracle.truffle.api.utilities.*; 27 import com.oracle.truffle.api.utilities.*;
27 28
28 /** 29 /**
29 * Represents a SL function. On the Truffle level, a callable element is represented by a 30 * Represents a SL function. On the Truffle level, a callable element is represented by a
30 * {@link RootCallTarget call target}. This class encapsulates a call target, and adds version 31 * {@link RootCallTarget call target}. This class encapsulates a call target, and adds version
39 * <p> 40 * <p>
40 * The {@link #callTarget} can be {@code null}. To ensure that only one {@link SLFunction} instance 41 * The {@link #callTarget} can be {@code null}. To ensure that only one {@link SLFunction} instance
41 * per name exists, the {@link SLFunctionRegistry} creates an instance also when performing name 42 * per name exists, the {@link SLFunctionRegistry} creates an instance also when performing name
42 * lookup. A function that has been looked up, i.e., used, but not defined, has no call target. 43 * lookup. A function that has been looked up, i.e., used, but not defined, has no call target.
43 */ 44 */
44 public final class SLFunction { 45 public final class SLFunction implements TruffleObject {
45 46
46 /** The name of the function. */ 47 /** The name of the function. */
47 private final String name; 48 private final String name;
48 49
49 /** The current implementation of this function. */ 50 /** The current implementation of this function. */
88 */ 89 */
89 @Override 90 @Override
90 public String toString() { 91 public String toString() {
91 return name; 92 return name;
92 } 93 }
94
95 /**
96 * In case you want some of your objects to co-operate with other languages, you need to make
97 * them implement {@link TruffleObject} and provide additional {@link SLFunctionForeignAccess
98 * foreign access implementation}.
99 */
100 @Override
101 public ForeignAccessFactory getForeignAccessFactory() {
102 return SLFunctionForeignAccess.INSTANCE;
103 }
93 } 104 }