annotate graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/runtime/SLFunctionForeignAccess.java @ 21770:c76742cc2c6f

Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Mon, 08 Jun 2015 04:50:13 +0200
parents ed234a3178af
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
1 /*
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
4 *
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
8 *
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
13 * accompanied this code).
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
14 *
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
18 *
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
21 * questions.
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
22 */
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
23 package com.oracle.truffle.sl.runtime;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
24
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
25 import com.oracle.truffle.api.CallTarget;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
26 import com.oracle.truffle.api.Truffle;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
27 import com.oracle.truffle.api.frame.VirtualFrame;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
28 import com.oracle.truffle.api.nodes.RootNode;
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
29 import com.oracle.truffle.api.interop.TruffleObject;
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
30 import com.oracle.truffle.api.interop.ForeignAccess;
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
31 import com.oracle.truffle.api.interop.Message;
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
32 import com.oracle.truffle.sl.nodes.call.SLDispatchNode;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
33 import com.oracle.truffle.sl.nodes.call.SLDispatchNodeGen;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
34 import java.math.BigInteger;
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
35 import java.util.List;
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
36
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
37 /**
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
38 * Implementation of foreign access for {@link SLFunction}.
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
39 */
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
40 final class SLFunctionForeignAccess implements ForeignAccess.Factory {
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
41 public static final ForeignAccess INSTANCE = ForeignAccess.create(new SLFunctionForeignAccess());
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
42
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
43 private SLFunctionForeignAccess() {
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
44 }
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
45
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
46 @Override
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
47 public boolean canHandle(TruffleObject o) {
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
48 return o instanceof SLFunction;
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
49 }
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
50
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
51 @Override
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
52 public CallTarget accessMessage(Message tree) {
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
53 if (Message.createExecute(0).equals(tree)) {
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
54 return Truffle.getRuntime().createCallTarget(new SLForeignCallerRootNode());
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
55 } else if (Message.IS_NULL.equals(tree)) {
21689
ed234a3178af Behavior of null-like values is now part of the TCK
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21490
diff changeset
56 return Truffle.getRuntime().createCallTarget(new SLForeignNullCheckNode());
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
57 } else {
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
58 throw new IllegalArgumentException(tree.toString() + " not supported");
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
59 }
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
60 }
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
61
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
62 private static class SLForeignCallerRootNode extends RootNode {
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
63 @Child private SLDispatchNode dispatch = SLDispatchNodeGen.create();
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
64
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
65 @Override
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
66 public Object execute(VirtualFrame frame) {
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
67 SLFunction function = (SLFunction) ForeignAccess.getReceiver(frame);
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
68 // the calling convention of interop passes the receiver of a
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
69 // function call (the this object)
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
70 // as an implicit 1st argument; we need to ignore this argument for SL
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
71 List<Object> args = ForeignAccess.getArguments(frame);
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
72 Object[] arr = args.subList(1, args.size()).toArray();
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
73 for (int i = 0; i < arr.length; i++) {
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
74 Object a = arr[i];
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
75 if (a instanceof Long) {
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
76 continue;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
77 }
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
78 if (a instanceof BigInteger) {
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
79 continue;
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
80 }
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
81 if (a instanceof Number) {
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
82 arr[i] = ((Number) a).longValue();
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
83 }
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
84 }
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
85 return dispatch.executeDispatch(frame, function, arr);
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
86 }
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
87
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
88 }
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
89
21689
ed234a3178af Behavior of null-like values is now part of the TCK
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21490
diff changeset
90 private static class SLForeignNullCheckNode extends RootNode {
ed234a3178af Behavior of null-like values is now part of the TCK
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21490
diff changeset
91 @Override
ed234a3178af Behavior of null-like values is now part of the TCK
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21490
diff changeset
92 public Object execute(VirtualFrame frame) {
21770
c76742cc2c6f Polishing inter-operability APIs: Exposing only Message, TruffleObject and ForeignAccess-related classes.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21689
diff changeset
93 Object receiver = ForeignAccess.getReceiver(frame);
21689
ed234a3178af Behavior of null-like values is now part of the TCK
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21490
diff changeset
94 return SLNull.SINGLETON == receiver;
ed234a3178af Behavior of null-like values is now part of the TCK
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21490
diff changeset
95 }
ed234a3178af Behavior of null-like values is now part of the TCK
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21490
diff changeset
96 }
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.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
97 }