Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ArrayTest.java @ 21038:6868faf48f02
Conditional Elimination: tryProofCondition: return true if ShortCircuitOrNode could be proven
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Sat, 18 Apr 2015 19:56:22 +0200 |
parents | 18c0f02fa4d2 |
children |
rev | line source |
---|---|
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.api.dsl.test; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import org.junit.*; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.*; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import com.oracle.truffle.api.dsl.*; |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
29 import com.oracle.truffle.api.dsl.test.ArrayTestFactory.TestNode1NodeGen; |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 import com.oracle.truffle.api.frame.*; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 import com.oracle.truffle.api.nodes.*; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 public class ArrayTest { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 @Test |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 public void testNode1() { |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
37 final TestNode1 node = TestNode1NodeGen.create(null); |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 RootNode root = new RootNode() { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 @Child TestNode1 test = node; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 @Override |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 public Object execute(VirtualFrame frame) { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 return test.executeWith(frame, frame.getArguments()[0]); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 }; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 CallTarget target = Truffle.getRuntime().createCallTarget(root); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 Assert.assertEquals(1, (int) target.call(1)); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 Assert.assertArrayEquals(new double[0], (double[]) target.call(new int[0]), 0.0d); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 Assert.assertArrayEquals(new double[0], (double[]) target.call(new double[0]), 0.0d); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 Assert.assertArrayEquals(new String[0], (String[]) target.call((Object) new String[0])); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 @TypeSystemReference(ArrayTypeSystem.class) |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 abstract static class BaseNode extends Node { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 abstract Object execute(VirtualFrame frame); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 int executeInt(VirtualFrame frame) throws UnexpectedResultException { |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
60 return ArrayTypeSystemGen.expectInteger(execute(frame)); |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 int[] executeIntArray(VirtualFrame frame) throws UnexpectedResultException { |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
64 return ArrayTypeSystemGen.expectIntArray(execute(frame)); |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 String[] executeStringArray(VirtualFrame frame) throws UnexpectedResultException { |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
68 return ArrayTypeSystemGen.expectStringArray(execute(frame)); |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 double[] executeDoubleArray(VirtualFrame frame) throws UnexpectedResultException { |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
72 return ArrayTypeSystemGen.expectDoubleArray(execute(frame)); |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
73 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
74 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
75 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 @NodeChild |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 abstract static class TestNode1 extends BaseNode { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 abstract Object executeWith(VirtualFrame frame, Object operand); |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 @Specialization |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 int doInt(int value) { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 return value; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 @Specialization |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 double[] doDoubleArray(double[] value) { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 return value; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 @Specialization |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 String[] doStringArray(String[] value) { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 return value; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 @TypeSystem({int.class, int[].class, double[].class, String[].class, Object[].class}) |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 public static class ArrayTypeSystem { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 @ImplicitCast |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
102 public static double[] castFromInt(int[] array) { |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 double[] newArray = new double[array.length]; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 for (int i = 0; i < array.length; i++) { |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 newArray[i] = array[i]; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 return newArray; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 |
18782
3ea386a1036f
Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
18772
diff
changeset
|
110 @TypeCheck(int[].class) |
3ea386a1036f
Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
18772
diff
changeset
|
111 public static boolean isIntArray2(Object array) { |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 return array instanceof int[]; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 |
18782
3ea386a1036f
Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
18772
diff
changeset
|
115 @TypeCast(int[].class) |
18755
59953a46c56f
Truffle-DSL: migrate DSL tests to use @GenerateNodeFactory.
Christian Humer <christian.humer@gmail.com>
parents:
18605
diff
changeset
|
116 public static int[] asIntArray(Object array) { |
18605
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
117 return (int[]) array; |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
118 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 } |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
121 |
58eb9bbb60c4
Truffle-DSL: fixed several bugs when using arrays as type. added arrays test.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 } |