Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/NoTypeSystemTest.java @ 20938:18c0f02fa4d2
Truffle-DSL: make type systems optional.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 15:12:48 +0200 |
parents | |
children | 476374f3fe9a |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 abstract static class NoParameterTestNode extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 abstract void execute(); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 void s1() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 } |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 @Test |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 public void testNoParameter() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 NoParameterTestNodeGen.create().execute(); |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 abstract static class JustFrameTestNode extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 abstract void execute(VirtualFrame frames); |
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 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 void s1(@SuppressWarnings("unused") VirtualFrame frame) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 } |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 @Test |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 public void testJustFrame() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 JustFrameTestNodeGen.create().execute(null); |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 abstract static class PrimitiveTestNode extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 abstract int execute(int primitive); |
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 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
72 int test(int primitive) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
73 return 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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 @Test |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 public void testPrimitive() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 Assert.assertEquals(42, PrimitiveTestNodeGen.create().execute(42)); |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 abstract static class ObjectInterfaceNode extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 abstract CharSequence execute(Object operand); |
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 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 CharSequence s1(CharSequence operandSpecial) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 return operandSpecial; |
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 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 @Test |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 public void testObjectInterface() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 Assert.assertEquals("42", ObjectInterfaceNodeGen.create().execute("42")); |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 abstract static class ObjectPrimitiveTestNode extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 abstract int execute(Object primitive); |
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 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 int s1(int primitive) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 return 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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 @Test |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 public void testObjectPrimitiveTest() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 Assert.assertEquals(42, ObjectPrimitiveTestNodeGen.create().execute(42)); |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 abstract static class ObjectStringTestNode extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 abstract String execute(Object operand); |
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 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 String s1(String operand) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 return 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 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
123 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 @Test |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 public void testObjectStringTest() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 Assert.assertEquals("42", ObjectStringTestNodeGen.create().execute("42")); |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 abstract static class TypesNotInTypeSystemTest extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
131 abstract Object execute(Object primitive); |
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 int executeInt(Object primitive) throws UnexpectedResultException; |
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 double executeDouble(Object primitive) throws UnexpectedResultException; |
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 String executeString(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 int[] executeIntArray(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 void executeVoid(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 void executeChar(Object primitive) throws UnexpectedResultException; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
144 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
145 abstract int executeInt(int primitive) throws UnexpectedResultException; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
146 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
147 abstract double executeDouble(double primitive) throws UnexpectedResultException; |
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 String executeString(String 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 int[] executeIntArray(int[] 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 void executeChar(char 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 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
156 int s1(int primitive) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
157 return primitive; |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
160 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
161 double s2(double primitive) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
162 return (int) primitive; |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
165 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
166 String s3(String object) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
167 return object; |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
170 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
171 int[] s4(int[] object) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
172 return object; |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
175 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
176 void s5(@SuppressWarnings("unused") char 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 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
180 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
181 // make nodes replacable |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
182 private static <T extends Node> T createRoot(final T node) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
183 new RootNode() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
184 @Child T child = node; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
185 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
186 @Override |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
187 public Object execute(VirtualFrame frame) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
188 return null; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
189 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
190 }.adoptChildren(); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
191 return node; |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
194 @Test |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
195 public void testTypesNotInTypeSystem() throws UnexpectedResultException { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
196 int[] someArray = {1, 2, 3}; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
197 Assert.assertEquals(42, createTypesNotInTypeSystem().execute(42)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
198 Assert.assertEquals(42d, createTypesNotInTypeSystem().execute(42d)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
199 Assert.assertEquals(someArray, createTypesNotInTypeSystem().execute(someArray)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
200 Assert.assertNull(createTypesNotInTypeSystem().execute((char) 42)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
201 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
202 Assert.assertEquals(42, createTypesNotInTypeSystem().executeInt((Object) 42)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
203 Assert.assertEquals(42d, createTypesNotInTypeSystem().executeDouble((Object) 42d), 0d); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
204 Assert.assertEquals(someArray, createTypesNotInTypeSystem().executeIntArray((Object) someArray)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
205 createTypesNotInTypeSystem().executeChar((Object) (char) 42); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
206 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
207 Assert.assertEquals(42, createTypesNotInTypeSystem().executeInt(42)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
208 Assert.assertEquals(42d, createTypesNotInTypeSystem().executeDouble(42d), 0d); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
209 Assert.assertEquals(someArray, createTypesNotInTypeSystem().executeIntArray(someArray)); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
210 createTypesNotInTypeSystem().executeChar((char) 42); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
211 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
212 try { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
213 createTypesNotInTypeSystem().executeInt("a"); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
214 Assert.fail(); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
215 } catch (UnexpectedResultException e) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
216 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
217 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
218 try { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
219 createTypesNotInTypeSystem().executeDouble("a"); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
220 Assert.fail(); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
221 } catch (UnexpectedResultException e) { |
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 try { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
225 createTypesNotInTypeSystem().executeIntArray("a"); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
226 Assert.fail(); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
227 } catch (UnexpectedResultException e) { |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
230 createTypesNotInTypeSystem().executeChar("a"); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
231 |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
234 private static TypesNotInTypeSystemTest createTypesNotInTypeSystem() { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
235 return createRoot(TypesNotInTypeSystemTestNodeGen.create()); |
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 abstract static class ErrorImpossibleTypes1 extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
239 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
240 abstract int execute(int primitive); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
241 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
242 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
243 int test(int primitive) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
244 return primitive; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
245 } |
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 @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
|
248 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
249 Object s2(int arg0) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
250 return arg0; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
251 } |
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 abstract static class ErrorImpossibleTypes2 extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
255 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
256 abstract int execute(int primitive); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
257 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
258 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
259 int test(int primitive) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
260 return primitive; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
261 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
262 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
263 @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
|
264 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
265 int s2(Object arg0) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
266 return (int) arg0; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
267 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
268 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
269 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
270 @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
|
271 + "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
|
272 abstract static class ErrorMissingNodeChild1 extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
273 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
274 abstract int execute(); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
275 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
276 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
277 int s1(int arg0) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
278 return 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 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
281 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
282 @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
|
283 + "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
|
284 @NodeChild |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
285 abstract static class ErrorMissingNodeChild2 extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
286 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
287 abstract int execute(int arg0); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
288 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
289 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
290 int s1(int arg0, int arg1) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
291 return arg0 + arg1; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
292 } |
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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
295 @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
|
296 + "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
|
297 abstract static class ErrorMissingNodeChild3 extends Node { |
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 abstract int execute(); |
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 abstract int execute(int arg0); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
302 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
303 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
304 int s1(int arg0) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
305 return 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 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
308 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
309 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
310 @ExpectError("Unnecessary @NodeChild declaration. All evaluated child values are provided as parameters in execute methods.") |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
311 @NodeChild |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
312 abstract static class ErrorAdditionalNodeChild1 extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
313 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
314 abstract int execute(int arg0); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
315 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
316 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
317 int s1(int arg0) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
318 return 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 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
321 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
322 @NodeChild |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
323 @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
|
324 + "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
|
325 abstract static class ErrorAdditionalNodeChild2 extends Node { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
326 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
327 abstract int execute(int arg0); |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
328 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
329 @Specialization |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
330 int s1(int arg0, int arg1) { |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
331 return arg0 + arg1; |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
332 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
333 } |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
334 |
18c0f02fa4d2
Truffle-DSL: make type systems optional.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
335 } |