Mercurial > hg > graal-compiler
annotate src/share/vm/ci/ciInstanceKlass.hpp @ 250:6ca61c728c2d
6712835: Server compiler fails with assertion (loop_count < K,"infinite loop in PhaseIterGVN::transform")
Reviewed-by: kvn
author | never |
---|---|
date | Fri, 25 Jul 2008 11:32:56 -0700 |
parents | d1605aabd0a1 |
children | 7c57aead6d3e |
rev | line source |
---|---|
0 | 1 /* |
196 | 2 * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. |
0 | 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 // ciInstanceKlass | |
26 // | |
27 // This class represents a klassOop in the HotSpot virtual machine | |
28 // whose Klass part is an instanceKlass. It may or may not | |
29 // be loaded. | |
30 class ciInstanceKlass : public ciKlass { | |
31 CI_PACKAGE_ACCESS | |
32 friend class ciEnv; | |
33 friend class ciMethod; | |
34 friend class ciField; | |
35 friend class ciBytecodeStream; | |
36 | |
37 private: | |
38 jobject _loader; | |
39 jobject _protection_domain; | |
40 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
44
diff
changeset
|
41 bool _is_shared; |
0 | 42 bool _is_initialized; |
43 bool _is_linked; | |
44 bool _has_finalizer; | |
45 bool _has_subklass; | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
44
diff
changeset
|
46 bool _has_nonstatic_fields; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
44
diff
changeset
|
47 |
0 | 48 ciFlags _flags; |
49 jint _nonstatic_field_size; | |
44
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
50 jint _nonstatic_oop_map_size; |
0 | 51 |
52 // Lazy fields get filled in only upon request. | |
53 ciInstanceKlass* _super; | |
54 ciInstance* _java_mirror; | |
55 | |
56 ciConstantPoolCache* _field_cache; // cached map index->field | |
57 GrowableArray<ciField*>* _nonstatic_fields; | |
58 | |
59 enum { implementors_limit = instanceKlass::implementors_limit }; | |
60 ciInstanceKlass* _implementors[implementors_limit]; | |
61 jint _nof_implementors; | |
62 | |
44
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
63 GrowableArray<ciField*>* _non_static_fields; |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
64 |
0 | 65 protected: |
66 ciInstanceKlass(KlassHandle h_k); | |
67 ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain); | |
68 | |
69 instanceKlass* get_instanceKlass() const { | |
70 return (instanceKlass*)get_Klass(); | |
71 } | |
72 | |
73 oop loader(); | |
74 jobject loader_handle(); | |
75 | |
76 oop protection_domain(); | |
77 jobject protection_domain_handle(); | |
78 | |
79 const char* type_string() { return "ciInstanceKlass"; } | |
80 | |
81 void print_impl(outputStream* st); | |
82 | |
83 ciConstantPoolCache* field_cache(); | |
84 | |
85 bool is_shared() { return _is_shared; } | |
86 | |
87 bool compute_shared_is_initialized(); | |
88 bool compute_shared_is_linked(); | |
89 bool compute_shared_has_subklass(); | |
90 int compute_shared_nof_implementors(); | |
91 int compute_nonstatic_fields(); | |
92 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields); | |
93 | |
94 public: | |
95 // Has this klass been initialized? | |
96 bool is_initialized() { | |
97 if (_is_shared && !_is_initialized) { | |
98 return is_loaded() && compute_shared_is_initialized(); | |
99 } | |
100 return _is_initialized; | |
101 } | |
102 // Has this klass been linked? | |
103 bool is_linked() { | |
104 if (_is_shared && !_is_linked) { | |
105 return is_loaded() && compute_shared_is_linked(); | |
106 } | |
107 return _is_linked; | |
108 } | |
109 | |
110 // General klass information. | |
111 ciFlags flags() { | |
112 assert(is_loaded(), "must be loaded"); | |
113 return _flags; | |
114 } | |
115 bool has_finalizer() { | |
116 assert(is_loaded(), "must be loaded"); | |
117 return _has_finalizer; } | |
118 bool has_subklass() { | |
119 assert(is_loaded(), "must be loaded"); | |
120 if (_is_shared && !_has_subklass) { | |
121 if (flags().is_final()) { | |
122 return false; | |
123 } else { | |
124 return compute_shared_has_subklass(); | |
125 } | |
126 } | |
127 return _has_subklass; | |
128 } | |
129 jint size_helper() { | |
130 return (Klass::layout_helper_size_in_bytes(layout_helper()) | |
131 >> LogHeapWordSize); | |
132 } | |
133 jint nonstatic_field_size() { | |
134 assert(is_loaded(), "must be loaded"); | |
135 return _nonstatic_field_size; } | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
44
diff
changeset
|
136 jint has_nonstatic_fields() { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
44
diff
changeset
|
137 assert(is_loaded(), "must be loaded"); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
44
diff
changeset
|
138 return _has_nonstatic_fields; } |
44
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
139 jint nonstatic_oop_map_size() { |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
140 assert(is_loaded(), "must be loaded"); |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
141 return _nonstatic_oop_map_size; } |
0 | 142 ciInstanceKlass* super(); |
143 jint nof_implementors() { | |
144 assert(is_loaded(), "must be loaded"); | |
145 if (_is_shared) return compute_shared_nof_implementors(); | |
146 return _nof_implementors; | |
147 } | |
148 | |
149 ciInstanceKlass* get_canonical_holder(int offset); | |
150 ciField* get_field_by_offset(int field_offset, bool is_static); | |
44
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
151 |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
152 GrowableArray<ciField*>* non_static_fields(); |
52fed2ec0afb
6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents:
0
diff
changeset
|
153 |
0 | 154 // total number of nonstatic fields (including inherited): |
155 int nof_nonstatic_fields() { | |
156 if (_nonstatic_fields == NULL) | |
157 return compute_nonstatic_fields(); | |
158 else | |
159 return _nonstatic_fields->length(); | |
160 } | |
161 // nth nonstatic field (presented by ascending address) | |
162 ciField* nonstatic_field_at(int i) { | |
163 assert(_nonstatic_fields != NULL, ""); | |
164 return _nonstatic_fields->at(i); | |
165 } | |
166 | |
167 ciInstanceKlass* unique_concrete_subklass(); | |
168 bool has_finalizable_subclass(); | |
169 | |
170 bool contains_field_offset(int offset) { | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
44
diff
changeset
|
171 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size()); |
0 | 172 } |
173 | |
174 // Get the instance of java.lang.Class corresponding to | |
175 // this klass. This instance is used for locking of | |
176 // synchronized static methods of this klass. | |
177 ciInstance* java_mirror(); | |
178 | |
179 // Java access flags | |
180 bool is_public () { return flags().is_public(); } | |
181 bool is_final () { return flags().is_final(); } | |
182 bool is_super () { return flags().is_super(); } | |
183 bool is_interface () { return flags().is_interface(); } | |
184 bool is_abstract () { return flags().is_abstract(); } | |
185 | |
186 ciMethod* find_method(ciSymbol* name, ciSymbol* signature); | |
187 // Note: To find a method from name and type strings, use ciSymbol::make, | |
188 // but consider adding to vmSymbols.hpp instead. | |
189 | |
190 bool is_leaf_type(); | |
191 ciInstanceKlass* implementor(int n); | |
192 | |
193 // Is the defining class loader of this class the default loader? | |
194 bool uses_default_loader(); | |
195 | |
196 bool is_java_lang_Object(); | |
197 | |
198 // What kind of ciObject is this? | |
199 bool is_instance_klass() { return true; } | |
200 bool is_java_klass() { return true; } | |
201 }; |