annotate graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/NoTypeSystemTest.java @ 21559:be896a1983c0

recast all Graal native code as JVMCI code (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Thu, 28 May 2015 15:36:48 +0200
parents 476374f3fe9a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
1 /*
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
4 *
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
8 *
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
13 * accompanied this code).
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
14 *
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
18 *
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
21 * questions.
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
22 */
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
23 package com.oracle.truffle.api.dsl.test;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
24
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
25 import org.junit.*;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
26
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
27 import com.oracle.truffle.api.dsl.*;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
28 import com.oracle.truffle.api.dsl.test.NoTypeSystemTestFactory.JustFrameTestNodeGen;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
29 import com.oracle.truffle.api.dsl.test.NoTypeSystemTestFactory.NoParameterTestNodeGen;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
30 import com.oracle.truffle.api.dsl.test.NoTypeSystemTestFactory.ObjectInterfaceNodeGen;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
31 import com.oracle.truffle.api.dsl.test.NoTypeSystemTestFactory.ObjectPrimitiveTestNodeGen;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
32 import com.oracle.truffle.api.dsl.test.NoTypeSystemTestFactory.ObjectStringTestNodeGen;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
33 import com.oracle.truffle.api.dsl.test.NoTypeSystemTestFactory.PrimitiveTestNodeGen;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
34 import com.oracle.truffle.api.dsl.test.NoTypeSystemTestFactory.TypesNotInTypeSystemTestNodeGen;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
35 import com.oracle.truffle.api.frame.*;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
36 import com.oracle.truffle.api.nodes.*;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
37
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
38 public class NoTypeSystemTest {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
39
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
40 abstract static class DummyChild extends Node {
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
41 abstract Object execute();
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
42 }
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
43
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
44 abstract static class NoParameterTestNode extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
45 abstract void execute();
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
46
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
47 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
48 void s1() {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
49 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
50 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
51
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
52 @Test
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
53 public void testNoParameter() {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
54 NoParameterTestNodeGen.create().execute();
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
55 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
56
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
57 abstract static class JustFrameTestNode extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
58
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
59 abstract void execute(VirtualFrame frames);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
60
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
61 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
62 void s1(@SuppressWarnings("unused") VirtualFrame frame) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
63 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
64 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
65
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
66 @Test
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
67 public void testJustFrame() {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
68 JustFrameTestNodeGen.create().execute(null);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
69 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
70
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
71 abstract static class PrimitiveTestNode extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
72
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
73 abstract int execute(int primitive);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
74
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
75 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
76 int test(int primitive) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
77 return primitive;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
78 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
79
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
80 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
81
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
82 @Test
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
83 public void testPrimitive() {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
84 Assert.assertEquals(42, PrimitiveTestNodeGen.create().execute(42));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
85 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
86
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
87 abstract static class ObjectInterfaceNode extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
88
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
89 abstract CharSequence execute(Object operand);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
90
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
91 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
92 CharSequence s1(CharSequence operandSpecial) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
93 return operandSpecial;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
94 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
95 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
96
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
97 @Test
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
98 public void testObjectInterface() {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
99 Assert.assertEquals("42", ObjectInterfaceNodeGen.create().execute("42"));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
100 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
101
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
102 abstract static class ObjectPrimitiveTestNode extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
103
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
104 abstract int execute(Object primitive);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
105
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
106 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
107 int s1(int primitive) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
108 return primitive;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
109 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
110
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
111 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
112
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
113 @Test
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
114 public void testObjectPrimitiveTest() {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
115 Assert.assertEquals(42, ObjectPrimitiveTestNodeGen.create().execute(42));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
116 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
117
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
118 abstract static class ObjectStringTestNode extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
119
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
120 abstract String execute(Object operand);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
121
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
122 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
123 String s1(String operand) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
124 return operand;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
125 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
126 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
127
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
128 @Test
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
129 public void testObjectStringTest() {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
130 Assert.assertEquals("42", ObjectStringTestNodeGen.create().execute("42"));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
131 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
132
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
133 abstract static class TypesNotInTypeSystemTest extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
134
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
135 abstract Object execute(Object primitive);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
136
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
137 abstract int executeInt(Object primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
138
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
139 abstract double executeDouble(Object primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
140
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
141 abstract String executeString(Object primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
142
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
143 abstract int[] executeIntArray(Object primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
144
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
145 abstract void executeVoid(Object primitive);
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
146
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
147 abstract void executeChar(Object primitive);
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
148
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
149 abstract int executeInt(int primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
150
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
151 abstract double executeDouble(double primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
152
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
153 abstract String executeString(String primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
154
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
155 abstract int[] executeIntArray(int[] primitive) throws UnexpectedResultException;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
156
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
157 abstract void executeChar(char primitive);
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
158
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
159 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
160 int s1(int primitive) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
161 return primitive;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
162 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
163
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
164 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
165 double s2(double primitive) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
166 return (int) primitive;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
167 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
168
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
169 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
170 String s3(String object) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
171 return object;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
172 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
173
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
174 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
175 int[] s4(int[] object) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
176 return object;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
177 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
178
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
179 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
180 void s5(@SuppressWarnings("unused") char object) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
181 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
182
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
183 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
184
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
185 @Test
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
186 public void testTypesNotInTypeSystem() throws UnexpectedResultException {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
187 int[] someArray = {1, 2, 3};
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
188 Assert.assertEquals(42, createTypesNotInTypeSystem().execute(42));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
189 Assert.assertEquals(42d, createTypesNotInTypeSystem().execute(42d));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
190 Assert.assertEquals(someArray, createTypesNotInTypeSystem().execute(someArray));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
191 Assert.assertNull(createTypesNotInTypeSystem().execute((char) 42));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
192
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
193 Assert.assertEquals(42, createTypesNotInTypeSystem().executeInt((Object) 42));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
194 Assert.assertEquals(42d, createTypesNotInTypeSystem().executeDouble((Object) 42d), 0d);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
195 Assert.assertEquals(someArray, createTypesNotInTypeSystem().executeIntArray((Object) someArray));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
196 createTypesNotInTypeSystem().executeChar((Object) (char) 42);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
197
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
198 Assert.assertEquals(42, createTypesNotInTypeSystem().executeInt(42));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
199 Assert.assertEquals(42d, createTypesNotInTypeSystem().executeDouble(42d), 0d);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
200 Assert.assertEquals(someArray, createTypesNotInTypeSystem().executeIntArray(someArray));
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
201 createTypesNotInTypeSystem().executeChar((char) 42);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
202
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
203 try {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
204 createTypesNotInTypeSystem().executeInt("a");
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
205 Assert.fail();
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
206 } catch (UnexpectedResultException e) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
207 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
208
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
209 try {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
210 createTypesNotInTypeSystem().executeDouble("a");
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
211 Assert.fail();
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
212 } catch (UnexpectedResultException e) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
213 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
214
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
215 try {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
216 createTypesNotInTypeSystem().executeIntArray("a");
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
217 Assert.fail();
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
218 } catch (UnexpectedResultException e) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
219 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
220
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
221 createTypesNotInTypeSystem().executeChar("a");
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
222
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
223 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
224
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
225 private static TypesNotInTypeSystemTest createTypesNotInTypeSystem() {
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
226 return TestHelper.createRoot(TypesNotInTypeSystemTestNodeGen.create());
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
227 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
228
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
229 abstract static class ErrorImpossibleTypes1 extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
230
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
231 abstract int execute(int primitive);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
232
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
233 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
234 int test(int primitive) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
235 return primitive;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
236 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
237
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
238 @ExpectError("The provided return type \"Object\" does not match expected return type \"int\".%")
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
239 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
240 Object s2(int arg0) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
241 return arg0;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
242 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
243 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
244
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
245 abstract static class ErrorImpossibleTypes2 extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
246
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
247 abstract int execute(int primitive);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
248
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
249 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
250 int test(int primitive) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
251 return primitive;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
252 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
253
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
254 @ExpectError("Method signature (Object) does not match to the expected signature: %")
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
255 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
256 int s2(Object arg0) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
257 return (int) arg0;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
258 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
259 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
260
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
261 @ExpectError("Not enough child node declarations found. Please annotate the node class with addtional @NodeChild annotations or remove all execute methods that do not provide all evaluated values. "
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
262 + "The following execute methods do not provide all evaluated values for the expected signature size 1: [execute()].")
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
263 abstract static class ErrorMissingNodeChild1 extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
264
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
265 abstract int execute();
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
266
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
267 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
268 int s1(int arg0) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
269 return arg0;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
270 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
271 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
272
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
273 @ExpectError("Not enough child node declarations found. Please annotate the node class with addtional @NodeChild annotations or remove all execute methods that do not provide all evaluated values. "
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
274 + "The following execute methods do not provide all evaluated values for the expected signature size 2: [execute(int)].")
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
275 @NodeChild(type = DummyChild.class)
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
276 abstract static class ErrorMissingNodeChild2 extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
277
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
278 abstract int execute(int arg0);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
279
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
280 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
281 int s1(int arg0, int arg1) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
282 return arg0 + arg1;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
283 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
284 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
285
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
286 @ExpectError("Not enough child node declarations found. Please annotate the node class with addtional @NodeChild annotations or remove all execute methods that do not provide all evaluated values. "
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
287 + "The following execute methods do not provide all evaluated values for the expected signature size 1: [execute()].")
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
288 abstract static class ErrorMissingNodeChild3 extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
289
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
290 abstract int execute();
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
291
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
292 abstract int execute(int arg0);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
293
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
294 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
295 int s1(int arg0) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
296 return arg0;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
297 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
298
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
299 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
300
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
301 @ExpectError("Unnecessary @NodeChild declaration. All evaluated child values are provided as parameters in execute methods.")
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
302 @NodeChild(type = DummyChild.class)
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
303 abstract static class ErrorAdditionalNodeChild1 extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
304
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
305 abstract int execute(int arg0);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
306
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
307 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
308 int s1(int arg0) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
309 return arg0;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
310 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
311 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
312
20940
476374f3fe9a Truffle-DSL: generate better polymorphic execute signatures
Christian Humer <christian.humer@gmail.com>
parents: 20938
diff changeset
313 @NodeChild(type = DummyChild.class)
20938
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
314 @ExpectError("Not enough child node declarations found. Please annotate the node class with addtional @NodeChild annotations or remove all execute methods that do not provide all evaluated values. "
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
315 + "The following execute methods do not provide all evaluated values for the expected signature size 2: [execute(int)].")
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
316 abstract static class ErrorAdditionalNodeChild2 extends Node {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
317
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
318 abstract int execute(int arg0);
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
319
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
320 @Specialization
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
321 int s1(int arg0, int arg1) {
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
322 return arg0 + arg1;
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
323 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
324 }
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
325
18c0f02fa4d2 Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
326 }