Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/ConstantFunction.java @ 22525:89db2519ef18
Moving implementation classes outside of the tck package to make the Javadoc of the TCK API cleaner
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 23 Dec 2015 07:43:06 +0100 |
parents | 597953a8e6f0 |
children |
rev | line source |
---|---|
21960
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
1 /* |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
4 * |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
10 * |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
16 * |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
20 * |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
23 * questions. |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
24 */ |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.tck; |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
26 |
22525
89db2519ef18
Moving implementation classes outside of the tck package to make the Javadoc of the TCK API cleaner
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22139
diff
changeset
|
27 import com.oracle.truffle.tck.impl.ObjectBinaryOperation; |
89db2519ef18
Moving implementation classes outside of the tck package to make the Javadoc of the TCK API cleaner
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22139
diff
changeset
|
28 |
22139
597953a8e6f0
Testing behavior of primitive types returned from an interop method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22135
diff
changeset
|
29 final class ConstantFunction implements ObjectBinaryOperation { |
597953a8e6f0
Testing behavior of primitive types returned from an interop method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22135
diff
changeset
|
30 private final Object constant; |
21960
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
31 |
22139
597953a8e6f0
Testing behavior of primitive types returned from an interop method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22135
diff
changeset
|
32 public ConstantFunction(Object constant) { |
597953a8e6f0
Testing behavior of primitive types returned from an interop method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22135
diff
changeset
|
33 this.constant = constant; |
21960
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
34 } |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
35 |
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
36 @Override |
22139
597953a8e6f0
Testing behavior of primitive types returned from an interop method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22135
diff
changeset
|
37 public Object compute(Object ignore1, Object ignore2) { |
597953a8e6f0
Testing behavior of primitive types returned from an interop method.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22135
diff
changeset
|
38 return constant; |
22003
5bc7f7b867ab
Making debugger always on for each TruffleVM execution. Introducing EventConsumer to process such debugger events. Requesting each RootNode to be associated with a TruffleLanguage, so debugger can find out proper context for each Node where executions gets suspended.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
21960
diff
changeset
|
39 } |
21960
a88981c5ce8b
Initial test for Java Interop: Perform callback to Math.min and Math.max via TruffleObject and Message.createExecute(2).
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
40 } |