Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.max.cri/src/com/sun/cri/ri/RiResolvedType.java @ 3733:e233f5660da4
Added Java files from Maxine project.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sat, 17 Dec 2011 19:59:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3732:3e2e8b8abdaf | 3733:e233f5660da4 |
---|---|
1 /* | |
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.sun.cri.ri; | |
24 | |
25 import java.lang.annotation.*; | |
26 import java.lang.reflect.*; | |
27 | |
28 import com.sun.cri.ci.*; | |
29 | |
30 /** | |
31 * Represents a resolved in the compiler-runtime interface. Types include primitives, objects, {@code void}, | |
32 * and arrays thereof. Types, like fields and methods, are resolved through {@link RiConstantPool constant pools}, and | |
33 * their actual implementation is provided by the {@link RiRuntime runtime} to the compiler. | |
34 */ | |
35 public interface RiResolvedType extends RiType { | |
36 | |
37 /** | |
38 * Gets the encoding of (that is, a constant representing the value of) the specified part of this type. | |
39 * @param r the part of the this type | |
40 * @return a constant representing a reference to the specified part of this type | |
41 */ | |
42 CiConstant getEncoding(Representation r); | |
43 | |
44 /** | |
45 * Checks whether this type has any subclasses so far. Any decisions | |
46 * based on this information require the registration of a dependency, since | |
47 * this information may change. | |
48 * @return {@code true} if this class has subclasses | |
49 */ | |
50 boolean hasSubclass(); | |
51 | |
52 /** | |
53 * Checks whether this type has a finalizer method. | |
54 * @return {@code true} if this class has a finalizer | |
55 */ | |
56 boolean hasFinalizer(); | |
57 | |
58 /** | |
59 * Checks whether this type has any finalizable subclasses so far. Any decisions | |
60 * based on this information require the registration of a dependency, since | |
61 * this information may change. | |
62 * @return {@code true} if this class has any subclasses with finalizers | |
63 */ | |
64 boolean hasFinalizableSubclass(); | |
65 | |
66 /** | |
67 * Checks whether this type is an interface. | |
68 * @return {@code true} if this type is an interface | |
69 */ | |
70 boolean isInterface(); | |
71 | |
72 /** | |
73 * Checks whether this type is an instance class. | |
74 * @return {@code true} if this type is an instance class | |
75 */ | |
76 boolean isInstanceClass(); | |
77 | |
78 /** | |
79 * Checks whether this type is an array class. | |
80 * @return {@code true} if this type is an array class | |
81 */ | |
82 boolean isArrayClass(); | |
83 | |
84 /** | |
85 * Gets the access flags for this type. Only the flags specified in the JVM specification | |
86 * will be included in the returned mask. The utility methods in the {@link Modifier} class | |
87 * should be used to query the returned mask for the presence/absence of individual flags. | |
88 * @return the mask of JVM defined class access flags defined for this type | |
89 */ | |
90 int accessFlags(); | |
91 | |
92 /** | |
93 * Checks whether this type is initialized. | |
94 * @return {@code true} if this type is initialized | |
95 */ | |
96 boolean isInitialized(); | |
97 | |
98 /** | |
99 * Checks whether this type is a subtype of another type. | |
100 * @param other the type to test | |
101 * @return {@code true} if this type a subtype of the specified type | |
102 */ | |
103 boolean isSubtypeOf(RiResolvedType other); | |
104 | |
105 /** | |
106 * Checks whether the specified object is an instance of this type. | |
107 * @param obj the object to test | |
108 * @return {@code true} if the object is an instance of this type | |
109 */ | |
110 boolean isInstance(CiConstant obj); | |
111 | |
112 /** | |
113 * Attempts to get an exact type for this type. Final classes, | |
114 * arrays of final classes, and primitive types all have exact types. | |
115 * @return the exact type of this type, if it exists; {@code null} otherwise | |
116 */ | |
117 RiResolvedType exactType(); | |
118 | |
119 /** | |
120 * Gets the super type of this type or {@code null} if no such type exists. | |
121 */ | |
122 RiResolvedType superType(); | |
123 | |
124 /** | |
125 * Attempts to get the unique concrete subtype of this type. | |
126 * @return the exact type of this type, if it exists; {@code null} otherwise | |
127 */ | |
128 RiResolvedType uniqueConcreteSubtype(); | |
129 | |
130 /** | |
131 * For array types, gets the type of the components. | |
132 * @return the component type of this array type | |
133 */ | |
134 RiResolvedType componentType(); | |
135 | |
136 /** | |
137 * Gets the type representing an array with elements of this type. | |
138 * @return a new compiler interface type representing an array of this type | |
139 */ | |
140 RiResolvedType arrayOf(); | |
141 | |
142 /** | |
143 * Resolves the method implementation for virtual dispatches on objects | |
144 * of this dynamic type. | |
145 * @param method the method to select the implementation of | |
146 * @return the method implementation that would be selected at runtime | |
147 */ | |
148 RiResolvedMethod resolveMethodImpl(RiResolvedMethod method); | |
149 | |
150 /** | |
151 * Given an RiMethod a, returns a concrete RiMethod b that is the only possible | |
152 * unique target for a virtual call on a(). Returns {@code null} if either no | |
153 * such concrete method or more than one such method exists. Returns the method a | |
154 * if a is a concrete method that is not overridden. If the compiler uses the | |
155 * result of this method for its compilation, it must register an assumption | |
156 * (see {@link CiAssumptions}), because dynamic class loading can invalidate | |
157 * the result of this method. | |
158 * @param method the method a for which a unique concrete target is searched | |
159 * @return the unique concrete target or {@code null} if no such target exists | |
160 * or assumptions are not supported by this runtime | |
161 */ | |
162 RiResolvedMethod uniqueConcreteMethod(RiResolvedMethod method); | |
163 | |
164 /** | |
165 * Returns the instance fields declared in this class sorted by field offset. | |
166 * @return an array of instance fields | |
167 */ | |
168 RiResolvedField[] declaredFields(); | |
169 | |
170 /** | |
171 * Returns this type's annotation of a specified type. | |
172 * | |
173 * @param annotationClass the Class object corresponding to the annotation type | |
174 * @return the annotation of type {@code annotationClass} for this type if present, else null | |
175 */ | |
176 <T extends Annotation> T getAnnotation(Class<T> annotationClass); | |
177 | |
178 /** | |
179 * Returns the java.lang.Class object representing this RiType instance or {@code null} if none exists. | |
180 * @return the java.lang.Class object | |
181 */ | |
182 Class<?> toJava(); | |
183 } |