annotate graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TypeUniverse.java @ 15145:df2ef5204f2b

Remove AbstractBeginNode, move the framestate from AbstractBeginNode to BeginStateSplitNode. This required some changes to loop transformations: when peeling don't create duplicates for the exit proxies.
author Gilles Duboscq <duboscq@ssw.jku.at>
date Mon, 14 Apr 2014 15:21:27 +0200
parents 288c23143d47
children 9619ba4daf4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.api.meta.test;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import java.io.*;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 import java.lang.reflect.*;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 import java.util.*;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28 import java.util.Queue;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30 import org.junit.*;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32 import sun.misc.*;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34 import com.oracle.graal.api.meta.*;
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
35 import com.oracle.graal.api.replacements.*;
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 import com.oracle.graal.api.runtime.*;
12488
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
37 import com.oracle.graal.phases.util.*;
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
38 import com.oracle.graal.runtime.*;
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 /**
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 * Context for type related api.meta tests.
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 */
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43 public class TypeUniverse {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45 public final Unsafe unsafe;
13183
0266ac3b26c0 JDK8: added support for default methods as well as interfaces containing static and private methods
Doug Simon <doug.simon@oracle.com>
parents: 12488
diff changeset
46 public static final double JAVA_VERSION = Double.valueOf(System.getProperty("java.specification.version"));
12488
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
47
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
48 public final MetaAccessProvider metaAccess;
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
49 public final ConstantReflectionProvider constantReflection;
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
50 public final SnippetReflectionProvider snippetReflection;
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
51 public final Collection<Class<?>> classes = new HashSet<>();
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52 public final Map<Class<?>, Class<?>> arrayClasses = new HashMap<>();
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53 public final List<Constant> constants = new ArrayList<>();
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
55 public TypeUniverse() {
12488
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
56 Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders();
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
57 metaAccess = providers.getMetaAccess();
1a4dc163cd0a abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents: 12052
diff changeset
58 constantReflection = providers.getConstantReflection();
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
59 snippetReflection = Graal.getRequiredCapability(SnippetReflectionProvider.class);
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
60 Unsafe theUnsafe = null;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
61 try {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62 theUnsafe = Unsafe.getUnsafe();
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
63 } catch (Exception e) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
64 try {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
65 Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
66 theUnsafeField.setAccessible(true);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
67 theUnsafe = (Unsafe) theUnsafeField.get(null);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
68 } catch (Exception e1) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
69 throw (InternalError) new InternalError("unable to initialize unsafe").initCause(e1);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
70 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
71 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
72 unsafe = theUnsafe;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
73
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
74 Class<?>[] initialClasses = {void.class, boolean.class, byte.class, short.class, char.class, int.class, float.class, long.class, double.class, Object.class, Class.class, ClassLoader.class,
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
75 String.class, Serializable.class, Cloneable.class, Test.class, TestMetaAccessProvider.class, List.class, Collection.class, Map.class, Queue.class, HashMap.class,
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
76 LinkedHashMap.class, IdentityHashMap.class, AbstractCollection.class, AbstractList.class, ArrayList.class};
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
77 for (Class<?> c : initialClasses) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
78 addClass(c);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
79 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
80 for (Field f : Constant.class.getDeclaredFields()) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
81 int mods = f.getModifiers();
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
82 if (f.getType() == Constant.class && Modifier.isPublic(mods) && Modifier.isStatic(mods) && Modifier.isFinal(mods)) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
83 try {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
84 Constant c = (Constant) f.get(null);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
85 if (c != null) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
86 constants.add(c);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
88 } catch (Exception e) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
89 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
90 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91 }
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
92 for (Class<?> c : classes) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
93 if (c != void.class && !c.isArray()) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
94 constants.add(snippetReflection.forObject(Array.newInstance(c, 42)));
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
96 }
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
97 constants.add(snippetReflection.forObject(new ArrayList<>()));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
98 constants.add(snippetReflection.forObject(new IdentityHashMap<>()));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
99 constants.add(snippetReflection.forObject(new LinkedHashMap<>()));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
100 constants.add(snippetReflection.forObject(new TreeMap<>()));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
101 constants.add(snippetReflection.forObject(new ArrayDeque<>()));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
102 constants.add(snippetReflection.forObject(new LinkedList<>()));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
103 constants.add(snippetReflection.forObject("a string"));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
104 constants.add(snippetReflection.forObject(42));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
105 constants.add(snippetReflection.forObject(String.class));
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13183
diff changeset
106 constants.add(snippetReflection.forObject(String[].class));
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
107 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
108
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
109 public synchronized Class<?> getArrayClass(Class<?> componentType) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
110 Class<?> arrayClass = arrayClasses.get(componentType);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
111 if (arrayClass == null) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
112 arrayClass = Array.newInstance(componentType, 0).getClass();
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
113 arrayClasses.put(componentType, arrayClass);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
114 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
115 return arrayClass;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
116 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
117
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
118 public static int dimensions(Class<?> c) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
119 if (c.getComponentType() != null) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
120 return 1 + dimensions(c.getComponentType());
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
121 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
122 return 0;
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
123 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
124
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
125 private void addClass(Class<?> c) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
126 if (classes.add(c)) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
127 if (c.getSuperclass() != null) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
128 addClass(c.getSuperclass());
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
129 }
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
130 for (Class<?> sc : c.getInterfaces()) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
131 addClass(sc);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
132 }
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
133 for (Class<?> dc : c.getDeclaredClasses()) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134 addClass(dc);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
135 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
136 for (Method m : c.getDeclaredMethods()) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
137 addClass(m.getReturnType());
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 15018
diff changeset
138 for (Class<?> p : m.getParameterTypes()) {
9806
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
139 addClass(p);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
140 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
141 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
142
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
143 if (c != void.class && dimensions(c) < 2) {
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
144 Class<?> arrayClass = Array.newInstance(c, 0).getClass();
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
145 arrayClasses.put(c, arrayClass);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 addClass(arrayClass);
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
147 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
148 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
149 }
21b8cd853b2b cleaned up api.meta tests (GRAAL-59)
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
150 }