author | coleenp |
Sun, 13 Apr 2008 17:43:42 -0400 | |
changeset 360 | 21d113ecbf6a |
parent 1 | 489c9b5090e2 |
child 591 | 04d2e26e6d69 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
2 |
* Copyright 1997-2007 Sun Microsystems, Inc. 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 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 |
# include "incls/_precompiled.incl" |
|
26 |
# include "incls/_instanceKlassKlass.cpp.incl" |
|
27 |
||
28 |
klassOop instanceKlassKlass::create_klass(TRAPS) { |
|
29 |
instanceKlassKlass o; |
|
30 |
KlassHandle h_this_klass(THREAD, Universe::klassKlassObj()); |
|
31 |
KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL); |
|
32 |
// Make sure size calculation is right |
|
33 |
assert(k()->size() == align_object_size(header_size()), "wrong size for object"); |
|
34 |
java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror |
|
35 |
return k(); |
|
36 |
} |
|
37 |
||
38 |
int instanceKlassKlass::oop_size(oop obj) const { |
|
39 |
assert(obj->is_klass(), "must be klass"); |
|
40 |
return instanceKlass::cast(klassOop(obj))->object_size(); |
|
41 |
} |
|
42 |
||
43 |
bool instanceKlassKlass::oop_is_parsable(oop obj) const { |
|
44 |
assert(obj->is_klass(), "must be klass"); |
|
45 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
46 |
return (!ik->null_vtbl()) && ik->object_is_parsable(); |
|
47 |
} |
|
48 |
||
49 |
void instanceKlassKlass::iterate_c_heap_oops(instanceKlass* ik, |
|
50 |
OopClosure* closure) { |
|
51 |
if (ik->oop_map_cache() != NULL) { |
|
52 |
ik->oop_map_cache()->oop_iterate(closure); |
|
53 |
} |
|
54 |
||
55 |
if (ik->jni_ids() != NULL) { |
|
56 |
ik->jni_ids()->oops_do(closure); |
|
57 |
} |
|
58 |
} |
|
59 |
||
60 |
void instanceKlassKlass::oop_follow_contents(oop obj) { |
|
61 |
assert(obj->is_klass(),"must be a klass"); |
|
62 |
assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass"); |
|
63 |
||
64 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
65 |
ik->follow_static_fields(); |
|
66 |
{ |
|
67 |
HandleMark hm; |
|
68 |
ik->vtable()->oop_follow_contents(); |
|
69 |
ik->itable()->oop_follow_contents(); |
|
70 |
} |
|
71 |
||
72 |
MarkSweep::mark_and_push(ik->adr_array_klasses()); |
|
73 |
MarkSweep::mark_and_push(ik->adr_methods()); |
|
74 |
MarkSweep::mark_and_push(ik->adr_method_ordering()); |
|
75 |
MarkSweep::mark_and_push(ik->adr_local_interfaces()); |
|
76 |
MarkSweep::mark_and_push(ik->adr_transitive_interfaces()); |
|
77 |
MarkSweep::mark_and_push(ik->adr_fields()); |
|
78 |
MarkSweep::mark_and_push(ik->adr_constants()); |
|
79 |
MarkSweep::mark_and_push(ik->adr_class_loader()); |
|
80 |
MarkSweep::mark_and_push(ik->adr_source_file_name()); |
|
81 |
MarkSweep::mark_and_push(ik->adr_source_debug_extension()); |
|
82 |
MarkSweep::mark_and_push(ik->adr_inner_classes()); |
|
83 |
MarkSweep::mark_and_push(ik->adr_protection_domain()); |
|
84 |
MarkSweep::mark_and_push(ik->adr_signers()); |
|
85 |
MarkSweep::mark_and_push(ik->adr_generic_signature()); |
|
86 |
MarkSweep::mark_and_push(ik->adr_class_annotations()); |
|
87 |
MarkSweep::mark_and_push(ik->adr_fields_annotations()); |
|
88 |
MarkSweep::mark_and_push(ik->adr_methods_annotations()); |
|
89 |
MarkSweep::mark_and_push(ik->adr_methods_parameter_annotations()); |
|
90 |
MarkSweep::mark_and_push(ik->adr_methods_default_annotations()); |
|
91 |
||
92 |
// We do not follow adr_implementors() here. It is followed later |
|
93 |
// in instanceKlass::follow_weak_klass_links() |
|
94 |
||
95 |
klassKlass::oop_follow_contents(obj); |
|
96 |
||
97 |
iterate_c_heap_oops(ik, &MarkSweep::mark_and_push_closure); |
|
98 |
} |
|
99 |
||
100 |
#ifndef SERIALGC |
|
101 |
void instanceKlassKlass::oop_follow_contents(ParCompactionManager* cm, |
|
102 |
oop obj) { |
|
103 |
assert(obj->is_klass(),"must be a klass"); |
|
104 |
assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass"); |
|
105 |
||
106 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
107 |
ik->follow_static_fields(cm); |
|
108 |
ik->vtable()->oop_follow_contents(cm); |
|
109 |
ik->itable()->oop_follow_contents(cm); |
|
110 |
||
111 |
PSParallelCompact::mark_and_push(cm, ik->adr_array_klasses()); |
|
112 |
PSParallelCompact::mark_and_push(cm, ik->adr_methods()); |
|
113 |
PSParallelCompact::mark_and_push(cm, ik->adr_method_ordering()); |
|
114 |
PSParallelCompact::mark_and_push(cm, ik->adr_local_interfaces()); |
|
115 |
PSParallelCompact::mark_and_push(cm, ik->adr_transitive_interfaces()); |
|
116 |
PSParallelCompact::mark_and_push(cm, ik->adr_fields()); |
|
117 |
PSParallelCompact::mark_and_push(cm, ik->adr_constants()); |
|
118 |
PSParallelCompact::mark_and_push(cm, ik->adr_class_loader()); |
|
119 |
PSParallelCompact::mark_and_push(cm, ik->adr_source_file_name()); |
|
120 |
PSParallelCompact::mark_and_push(cm, ik->adr_source_debug_extension()); |
|
121 |
PSParallelCompact::mark_and_push(cm, ik->adr_inner_classes()); |
|
122 |
PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain()); |
|
123 |
PSParallelCompact::mark_and_push(cm, ik->adr_signers()); |
|
124 |
PSParallelCompact::mark_and_push(cm, ik->adr_generic_signature()); |
|
125 |
PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations()); |
|
126 |
PSParallelCompact::mark_and_push(cm, ik->adr_fields_annotations()); |
|
127 |
PSParallelCompact::mark_and_push(cm, ik->adr_methods_annotations()); |
|
128 |
PSParallelCompact::mark_and_push(cm, ik->adr_methods_parameter_annotations()); |
|
129 |
PSParallelCompact::mark_and_push(cm, ik->adr_methods_default_annotations()); |
|
130 |
||
131 |
// We do not follow adr_implementor() here. It is followed later |
|
132 |
// in instanceKlass::follow_weak_klass_links() |
|
133 |
||
134 |
klassKlass::oop_follow_contents(cm, obj); |
|
135 |
||
136 |
PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); |
|
137 |
iterate_c_heap_oops(ik, &mark_and_push_closure); |
|
138 |
} |
|
139 |
#endif // SERIALGC |
|
140 |
||
141 |
int instanceKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) { |
|
142 |
assert(obj->is_klass(),"must be a klass"); |
|
143 |
assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass"); |
|
144 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
145 |
// Get size before changing pointers. |
|
146 |
// Don't call size() or oop_size() since that is a virtual call. |
|
147 |
int size = ik->object_size(); |
|
148 |
||
149 |
ik->iterate_static_fields(blk); |
|
150 |
ik->vtable()->oop_oop_iterate(blk); |
|
151 |
ik->itable()->oop_oop_iterate(blk); |
|
152 |
||
153 |
blk->do_oop(ik->adr_array_klasses()); |
|
154 |
blk->do_oop(ik->adr_methods()); |
|
155 |
blk->do_oop(ik->adr_method_ordering()); |
|
156 |
blk->do_oop(ik->adr_local_interfaces()); |
|
157 |
blk->do_oop(ik->adr_transitive_interfaces()); |
|
158 |
blk->do_oop(ik->adr_fields()); |
|
159 |
blk->do_oop(ik->adr_constants()); |
|
160 |
blk->do_oop(ik->adr_class_loader()); |
|
161 |
blk->do_oop(ik->adr_protection_domain()); |
|
162 |
blk->do_oop(ik->adr_signers()); |
|
163 |
blk->do_oop(ik->adr_source_file_name()); |
|
164 |
blk->do_oop(ik->adr_source_debug_extension()); |
|
165 |
blk->do_oop(ik->adr_inner_classes()); |
|
166 |
for (int i = 0; i < instanceKlass::implementors_limit; i++) { |
|
167 |
blk->do_oop(&ik->adr_implementors()[i]); |
|
168 |
} |
|
169 |
blk->do_oop(ik->adr_generic_signature()); |
|
170 |
blk->do_oop(ik->adr_class_annotations()); |
|
171 |
blk->do_oop(ik->adr_fields_annotations()); |
|
172 |
blk->do_oop(ik->adr_methods_annotations()); |
|
173 |
blk->do_oop(ik->adr_methods_parameter_annotations()); |
|
174 |
blk->do_oop(ik->adr_methods_default_annotations()); |
|
175 |
||
176 |
klassKlass::oop_oop_iterate(obj, blk); |
|
177 |
||
178 |
if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk); |
|
179 |
return size; |
|
180 |
} |
|
181 |
||
182 |
int instanceKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, |
|
183 |
MemRegion mr) { |
|
184 |
assert(obj->is_klass(),"must be a klass"); |
|
185 |
assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass"); |
|
186 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
187 |
// Get size before changing pointers. |
|
188 |
// Don't call size() or oop_size() since that is a virtual call. |
|
189 |
int size = ik->object_size(); |
|
190 |
||
191 |
ik->iterate_static_fields(blk, mr); |
|
192 |
ik->vtable()->oop_oop_iterate_m(blk, mr); |
|
193 |
ik->itable()->oop_oop_iterate_m(blk, mr); |
|
194 |
||
195 |
oop* adr; |
|
196 |
adr = ik->adr_array_klasses(); |
|
197 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
198 |
adr = ik->adr_methods(); |
|
199 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
200 |
adr = ik->adr_method_ordering(); |
|
201 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
202 |
adr = ik->adr_local_interfaces(); |
|
203 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
204 |
adr = ik->adr_transitive_interfaces(); |
|
205 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
206 |
adr = ik->adr_fields(); |
|
207 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
208 |
adr = ik->adr_constants(); |
|
209 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
210 |
adr = ik->adr_class_loader(); |
|
211 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
212 |
adr = ik->adr_protection_domain(); |
|
213 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
214 |
adr = ik->adr_signers(); |
|
215 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
216 |
adr = ik->adr_source_file_name(); |
|
217 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
218 |
adr = ik->adr_source_debug_extension(); |
|
219 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
220 |
adr = ik->adr_inner_classes(); |
|
221 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
222 |
adr = ik->adr_implementors(); |
|
223 |
for (int i = 0; i < instanceKlass::implementors_limit; i++) { |
|
224 |
if (mr.contains(&adr[i])) blk->do_oop(&adr[i]); |
|
225 |
} |
|
226 |
adr = ik->adr_generic_signature(); |
|
227 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
228 |
adr = ik->adr_class_annotations(); |
|
229 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
230 |
adr = ik->adr_fields_annotations(); |
|
231 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
232 |
adr = ik->adr_methods_annotations(); |
|
233 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
234 |
adr = ik->adr_methods_parameter_annotations(); |
|
235 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
236 |
adr = ik->adr_methods_default_annotations(); |
|
237 |
if (mr.contains(adr)) blk->do_oop(adr); |
|
238 |
||
239 |
klassKlass::oop_oop_iterate_m(obj, blk, mr); |
|
240 |
||
241 |
if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk, mr); |
|
242 |
return size; |
|
243 |
} |
|
244 |
||
245 |
int instanceKlassKlass::oop_adjust_pointers(oop obj) { |
|
246 |
assert(obj->is_klass(),"must be a klass"); |
|
247 |
assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass"); |
|
248 |
||
249 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
250 |
ik->adjust_static_fields(); |
|
251 |
ik->vtable()->oop_adjust_pointers(); |
|
252 |
ik->itable()->oop_adjust_pointers(); |
|
253 |
||
254 |
MarkSweep::adjust_pointer(ik->adr_array_klasses()); |
|
255 |
MarkSweep::adjust_pointer(ik->adr_methods()); |
|
256 |
MarkSweep::adjust_pointer(ik->adr_method_ordering()); |
|
257 |
MarkSweep::adjust_pointer(ik->adr_local_interfaces()); |
|
258 |
MarkSweep::adjust_pointer(ik->adr_transitive_interfaces()); |
|
259 |
MarkSweep::adjust_pointer(ik->adr_fields()); |
|
260 |
MarkSweep::adjust_pointer(ik->adr_constants()); |
|
261 |
MarkSweep::adjust_pointer(ik->adr_class_loader()); |
|
262 |
MarkSweep::adjust_pointer(ik->adr_protection_domain()); |
|
263 |
MarkSweep::adjust_pointer(ik->adr_signers()); |
|
264 |
MarkSweep::adjust_pointer(ik->adr_source_file_name()); |
|
265 |
MarkSweep::adjust_pointer(ik->adr_source_debug_extension()); |
|
266 |
MarkSweep::adjust_pointer(ik->adr_inner_classes()); |
|
267 |
for (int i = 0; i < instanceKlass::implementors_limit; i++) { |
|
268 |
MarkSweep::adjust_pointer(&ik->adr_implementors()[i]); |
|
269 |
} |
|
270 |
MarkSweep::adjust_pointer(ik->adr_generic_signature()); |
|
271 |
MarkSweep::adjust_pointer(ik->adr_class_annotations()); |
|
272 |
MarkSweep::adjust_pointer(ik->adr_fields_annotations()); |
|
273 |
MarkSweep::adjust_pointer(ik->adr_methods_annotations()); |
|
274 |
MarkSweep::adjust_pointer(ik->adr_methods_parameter_annotations()); |
|
275 |
MarkSweep::adjust_pointer(ik->adr_methods_default_annotations()); |
|
276 |
||
277 |
iterate_c_heap_oops(ik, &MarkSweep::adjust_root_pointer_closure); |
|
278 |
||
279 |
return klassKlass::oop_adjust_pointers(obj); |
|
280 |
} |
|
281 |
||
282 |
#ifndef SERIALGC |
|
283 |
void instanceKlassKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) { |
|
284 |
assert(!pm->depth_first(), "invariant"); |
|
285 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
286 |
ik->copy_static_fields(pm); |
|
287 |
||
288 |
oop* loader_addr = ik->adr_class_loader(); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
289 |
if (PSScavenge::should_scavenge(loader_addr)) { |
1 | 290 |
pm->claim_or_forward_breadth(loader_addr); |
291 |
} |
|
292 |
||
293 |
oop* pd_addr = ik->adr_protection_domain(); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
294 |
if (PSScavenge::should_scavenge(pd_addr)) { |
1 | 295 |
pm->claim_or_forward_breadth(pd_addr); |
296 |
} |
|
297 |
||
298 |
oop* sg_addr = ik->adr_signers(); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
299 |
if (PSScavenge::should_scavenge(sg_addr)) { |
1 | 300 |
pm->claim_or_forward_breadth(sg_addr); |
301 |
} |
|
302 |
||
303 |
klassKlass::oop_copy_contents(pm, obj); |
|
304 |
} |
|
305 |
||
306 |
void instanceKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { |
|
307 |
assert(pm->depth_first(), "invariant"); |
|
308 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
309 |
ik->push_static_fields(pm); |
|
310 |
||
311 |
oop* loader_addr = ik->adr_class_loader(); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
312 |
if (PSScavenge::should_scavenge(loader_addr)) { |
1 | 313 |
pm->claim_or_forward_depth(loader_addr); |
314 |
} |
|
315 |
||
316 |
oop* pd_addr = ik->adr_protection_domain(); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
317 |
if (PSScavenge::should_scavenge(pd_addr)) { |
1 | 318 |
pm->claim_or_forward_depth(pd_addr); |
319 |
} |
|
320 |
||
321 |
oop* sg_addr = ik->adr_signers(); |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
322 |
if (PSScavenge::should_scavenge(sg_addr)) { |
1 | 323 |
pm->claim_or_forward_depth(sg_addr); |
324 |
} |
|
325 |
||
326 |
klassKlass::oop_copy_contents(pm, obj); |
|
327 |
} |
|
328 |
||
329 |
int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { |
|
330 |
assert(obj->is_klass(),"must be a klass"); |
|
331 |
assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), |
|
332 |
"must be instance klass"); |
|
333 |
||
334 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
335 |
ik->update_static_fields(); |
|
336 |
ik->vtable()->oop_update_pointers(cm); |
|
337 |
ik->itable()->oop_update_pointers(cm); |
|
338 |
||
339 |
oop* const beg_oop = ik->oop_block_beg(); |
|
340 |
oop* const end_oop = ik->oop_block_end(); |
|
341 |
for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) { |
|
342 |
PSParallelCompact::adjust_pointer(cur_oop); |
|
343 |
} |
|
344 |
||
345 |
OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure(); |
|
346 |
iterate_c_heap_oops(ik, closure); |
|
347 |
||
348 |
klassKlass::oop_update_pointers(cm, obj); |
|
349 |
return ik->object_size(); |
|
350 |
} |
|
351 |
||
352 |
int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj, |
|
353 |
HeapWord* beg_addr, |
|
354 |
HeapWord* end_addr) { |
|
355 |
assert(obj->is_klass(),"must be a klass"); |
|
356 |
assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), |
|
357 |
"must be instance klass"); |
|
358 |
||
359 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
360 |
ik->update_static_fields(beg_addr, end_addr); |
|
361 |
ik->vtable()->oop_update_pointers(cm, beg_addr, end_addr); |
|
362 |
ik->itable()->oop_update_pointers(cm, beg_addr, end_addr); |
|
363 |
||
364 |
oop* const beg_oop = MAX2((oop*)beg_addr, ik->oop_block_beg()); |
|
365 |
oop* const end_oop = MIN2((oop*)end_addr, ik->oop_block_end()); |
|
366 |
for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) { |
|
367 |
PSParallelCompact::adjust_pointer(cur_oop); |
|
368 |
} |
|
369 |
||
370 |
// The oop_map_cache, jni_ids and jni_id_map are allocated from the C heap, |
|
371 |
// and so don't lie within any 'Chunk' boundaries. Update them when the |
|
372 |
// lowest addressed oop in the instanceKlass 'oop_block' is updated. |
|
373 |
if (beg_oop == ik->oop_block_beg()) { |
|
374 |
OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure(); |
|
375 |
iterate_c_heap_oops(ik, closure); |
|
376 |
} |
|
377 |
||
378 |
klassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr); |
|
379 |
return ik->object_size(); |
|
380 |
} |
|
381 |
#endif // SERIALGC |
|
382 |
||
383 |
klassOop instanceKlassKlass::allocate_instance_klass(int vtable_len, int itable_len, int static_field_size, |
|
384 |
int nonstatic_oop_map_size, ReferenceType rt, TRAPS) { |
|
385 |
||
386 |
int size = instanceKlass::object_size(align_object_offset(vtable_len) + align_object_offset(itable_len) + static_field_size + nonstatic_oop_map_size); |
|
387 |
||
388 |
// Allocation |
|
389 |
KlassHandle h_this_klass(THREAD, as_klassOop()); |
|
390 |
KlassHandle k; |
|
391 |
if (rt == REF_NONE) { |
|
392 |
// regular klass |
|
393 |
instanceKlass o; |
|
394 |
k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL); |
|
395 |
} else { |
|
396 |
// reference klass |
|
397 |
instanceRefKlass o; |
|
398 |
k = base_create_klass(h_this_klass, size, o.vtbl_value(), CHECK_NULL); |
|
399 |
} |
|
400 |
{ |
|
401 |
No_Safepoint_Verifier no_safepoint; // until k becomes parsable |
|
402 |
instanceKlass* ik = (instanceKlass*) k()->klass_part(); |
|
403 |
assert(!k()->is_parsable(), "not expecting parsability yet."); |
|
404 |
||
405 |
// The sizes of these these three variables are used for determining the |
|
406 |
// size of the instanceKlassOop. It is critical that these are set to the right |
|
407 |
// sizes before the first GC, i.e., when we allocate the mirror. |
|
408 |
ik->set_vtable_length(vtable_len); |
|
409 |
ik->set_itable_length(itable_len); |
|
410 |
ik->set_static_field_size(static_field_size); |
|
411 |
ik->set_nonstatic_oop_map_size(nonstatic_oop_map_size); |
|
412 |
assert(k()->size() == size, "wrong size for object"); |
|
413 |
||
414 |
ik->set_array_klasses(NULL); |
|
415 |
ik->set_methods(NULL); |
|
416 |
ik->set_method_ordering(NULL); |
|
417 |
ik->set_local_interfaces(NULL); |
|
418 |
ik->set_transitive_interfaces(NULL); |
|
419 |
ik->init_implementor(); |
|
420 |
ik->set_fields(NULL); |
|
421 |
ik->set_constants(NULL); |
|
422 |
ik->set_class_loader(NULL); |
|
423 |
ik->set_protection_domain(NULL); |
|
424 |
ik->set_signers(NULL); |
|
425 |
ik->set_source_file_name(NULL); |
|
426 |
ik->set_source_debug_extension(NULL); |
|
427 |
ik->set_inner_classes(NULL); |
|
428 |
ik->set_static_oop_field_size(0); |
|
429 |
ik->set_nonstatic_field_size(0); |
|
430 |
ik->set_is_marked_dependent(false); |
|
431 |
ik->set_init_state(instanceKlass::allocated); |
|
432 |
ik->set_init_thread(NULL); |
|
433 |
ik->set_reference_type(rt); |
|
434 |
ik->set_oop_map_cache(NULL); |
|
435 |
ik->set_jni_ids(NULL); |
|
436 |
ik->set_osr_nmethods_head(NULL); |
|
437 |
ik->set_breakpoints(NULL); |
|
438 |
ik->init_previous_versions(); |
|
439 |
ik->set_generic_signature(NULL); |
|
440 |
ik->release_set_methods_jmethod_ids(NULL); |
|
441 |
ik->release_set_methods_cached_itable_indices(NULL); |
|
442 |
ik->set_class_annotations(NULL); |
|
443 |
ik->set_fields_annotations(NULL); |
|
444 |
ik->set_methods_annotations(NULL); |
|
445 |
ik->set_methods_parameter_annotations(NULL); |
|
446 |
ik->set_methods_default_annotations(NULL); |
|
447 |
ik->set_enclosing_method_indices(0, 0); |
|
448 |
ik->set_jvmti_cached_class_field_map(NULL); |
|
449 |
ik->set_initial_method_idnum(0); |
|
450 |
assert(k()->is_parsable(), "should be parsable here."); |
|
451 |
||
452 |
// initialize the non-header words to zero |
|
453 |
intptr_t* p = (intptr_t*)k(); |
|
454 |
for (int index = instanceKlass::header_size(); index < size; index++) { |
|
455 |
p[index] = NULL_WORD; |
|
456 |
} |
|
457 |
||
458 |
// To get verify to work - must be set to partial loaded before first GC point. |
|
459 |
k()->set_partially_loaded(); |
|
460 |
} |
|
461 |
||
462 |
// GC can happen here |
|
463 |
java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror |
|
464 |
return k(); |
|
465 |
} |
|
466 |
||
467 |
||
468 |
||
469 |
#ifndef PRODUCT |
|
470 |
||
471 |
// Printing |
|
472 |
||
473 |
static const char* state_names[] = { |
|
474 |
"unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error" |
|
475 |
}; |
|
476 |
||
477 |
||
478 |
void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) { |
|
479 |
assert(obj->is_klass(), "must be klass"); |
|
480 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
481 |
klassKlass::oop_print_on(obj, st); |
|
482 |
||
483 |
st->print(" - instance size: %d", ik->size_helper()); st->cr(); |
|
484 |
st->print(" - klass size: %d", ik->object_size()); st->cr(); |
|
485 |
st->print(" - access: "); ik->access_flags().print_on(st); st->cr(); |
|
486 |
st->print(" - state: "); st->print_cr(state_names[ik->_init_state]); |
|
487 |
st->print(" - name: "); ik->name()->print_value_on(st); st->cr(); |
|
488 |
st->print(" - super: "); ik->super()->print_value_on(st); st->cr(); |
|
489 |
st->print(" - sub: "); |
|
490 |
Klass* sub = ik->subklass(); |
|
491 |
int n; |
|
492 |
for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) { |
|
493 |
if (n < MaxSubklassPrintSize) { |
|
494 |
sub->as_klassOop()->print_value_on(st); |
|
495 |
st->print(" "); |
|
496 |
} |
|
497 |
} |
|
498 |
if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize); |
|
499 |
st->cr(); |
|
500 |
||
501 |
if (ik->is_interface()) { |
|
502 |
st->print_cr(" - nof implementors: %d", ik->nof_implementors()); |
|
503 |
int print_impl = 0; |
|
504 |
for (int i = 0; i < instanceKlass::implementors_limit; i++) { |
|
505 |
if (ik->implementor(i) != NULL) { |
|
506 |
if (++print_impl == 1) |
|
507 |
st->print_cr(" - implementor: "); |
|
508 |
st->print(" "); |
|
509 |
ik->implementor(i)->print_value_on(st); |
|
510 |
} |
|
511 |
} |
|
512 |
if (print_impl > 0) st->cr(); |
|
513 |
} |
|
514 |
||
515 |
st->print(" - arrays: "); ik->array_klasses()->print_value_on(st); st->cr(); |
|
516 |
st->print(" - methods: "); ik->methods()->print_value_on(st); st->cr(); |
|
517 |
if (Verbose) { |
|
518 |
objArrayOop methods = ik->methods(); |
|
519 |
for(int i = 0; i < methods->length(); i++) { |
|
520 |
tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr(); |
|
521 |
} |
|
522 |
} |
|
523 |
st->print(" - method ordering: "); ik->method_ordering()->print_value_on(st); st->cr(); |
|
524 |
st->print(" - local interfaces: "); ik->local_interfaces()->print_value_on(st); st->cr(); |
|
525 |
st->print(" - trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr(); |
|
526 |
st->print(" - constants: "); ik->constants()->print_value_on(st); st->cr(); |
|
527 |
st->print(" - class loader: "); ik->class_loader()->print_value_on(st); st->cr(); |
|
528 |
st->print(" - protection domain: "); ik->protection_domain()->print_value_on(st); st->cr(); |
|
529 |
st->print(" - signers: "); ik->signers()->print_value_on(st); st->cr(); |
|
530 |
if (ik->source_file_name() != NULL) { |
|
531 |
st->print(" - source file: "); |
|
532 |
ik->source_file_name()->print_value_on(st); |
|
533 |
st->cr(); |
|
534 |
} |
|
535 |
if (ik->source_debug_extension() != NULL) { |
|
536 |
st->print(" - source debug extension: "); |
|
537 |
ik->source_debug_extension()->print_value_on(st); |
|
538 |
st->cr(); |
|
539 |
} |
|
540 |
||
541 |
st->print_cr(" - previous version: "); |
|
542 |
{ |
|
543 |
ResourceMark rm; |
|
544 |
// PreviousVersionInfo objects returned via PreviousVersionWalker |
|
545 |
// contain a GrowableArray of handles. We have to clean up the |
|
546 |
// GrowableArray _after_ the PreviousVersionWalker destructor |
|
547 |
// has destroyed the handles. |
|
548 |
{ |
|
549 |
PreviousVersionWalker pvw(ik); |
|
550 |
for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); |
|
551 |
pv_info != NULL; pv_info = pvw.next_previous_version()) { |
|
552 |
pv_info->prev_constant_pool_handle()()->print_value_on(st); |
|
553 |
} |
|
554 |
st->cr(); |
|
555 |
} // pvw is cleaned up |
|
556 |
} // rm is cleaned up |
|
557 |
||
558 |
if (ik->generic_signature() != NULL) { |
|
559 |
st->print(" - generic signature: "); |
|
560 |
ik->generic_signature()->print_value_on(st); |
|
561 |
} |
|
562 |
st->print(" - inner classes: "); ik->inner_classes()->print_value_on(st); st->cr(); |
|
563 |
st->print(" - java mirror: "); ik->java_mirror()->print_value_on(st); st->cr(); |
|
564 |
st->print(" - vtable length %d (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable()); st->cr(); |
|
565 |
st->print(" - itable length %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr(); |
|
566 |
st->print_cr(" - static fields:"); |
|
567 |
FieldPrinter print_static_field(st); |
|
568 |
ik->do_local_static_fields(&print_static_field); |
|
569 |
st->print_cr(" - non-static fields:"); |
|
570 |
FieldPrinter print_nonstatic_field(st, obj); |
|
571 |
ik->do_nonstatic_fields(&print_nonstatic_field); |
|
572 |
||
573 |
st->print(" - static oop maps: "); |
|
574 |
if (ik->static_oop_field_size() > 0) { |
|
575 |
int first_offset = ik->offset_of_static_fields(); |
|
576 |
st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1); |
|
577 |
} |
|
578 |
st->cr(); |
|
579 |
||
580 |
st->print(" - non-static oop maps: "); |
|
581 |
OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); |
|
582 |
OopMapBlock* end_map = map + ik->nonstatic_oop_map_size(); |
|
583 |
while (map < end_map) { |
|
584 |
st->print("%d-%d ", map->offset(), map->offset() + oopSize*(map->length() - 1)); |
|
585 |
map++; |
|
586 |
} |
|
587 |
st->cr(); |
|
588 |
} |
|
589 |
||
590 |
||
591 |
void instanceKlassKlass::oop_print_value_on(oop obj, outputStream* st) { |
|
592 |
assert(obj->is_klass(), "must be klass"); |
|
593 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
594 |
ik->name()->print_value_on(st); |
|
595 |
} |
|
596 |
||
597 |
#endif // PRODUCT |
|
598 |
||
599 |
const char* instanceKlassKlass::internal_name() const { |
|
600 |
return "{instance class}"; |
|
601 |
} |
|
602 |
||
603 |
// Verification |
|
604 |
||
605 |
class VerifyFieldClosure: public OopClosure { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
606 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
607 |
template <class T> void do_oop_work(T* p) { |
1 | 608 |
guarantee(Universe::heap()->is_in(p), "should be in heap"); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
609 |
oop obj = oopDesc::load_decode_heap_oop(p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
610 |
guarantee(obj->is_oop_or_null(), "should be in heap"); |
1 | 611 |
} |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
612 |
public: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
613 |
virtual void do_oop(oop* p) { VerifyFieldClosure::do_oop_work(p); } |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
614 |
virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); } |
1 | 615 |
}; |
616 |
||
617 |
void instanceKlassKlass::oop_verify_on(oop obj, outputStream* st) { |
|
618 |
klassKlass::oop_verify_on(obj, st); |
|
619 |
if (!obj->partially_loaded()) { |
|
620 |
Thread *thread = Thread::current(); |
|
621 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
622 |
||
623 |
#ifndef PRODUCT |
|
624 |
// Avoid redundant verifies |
|
625 |
if (ik->_verify_count == Universe::verify_count()) return; |
|
626 |
ik->_verify_count = Universe::verify_count(); |
|
627 |
#endif |
|
628 |
// Verify that klass is present in SystemDictionary |
|
629 |
if (ik->is_loaded()) { |
|
630 |
symbolHandle h_name (thread, ik->name()); |
|
631 |
Handle h_loader (thread, ik->class_loader()); |
|
632 |
Handle h_obj(thread, obj); |
|
633 |
SystemDictionary::verify_obj_klass_present(h_obj, h_name, h_loader); |
|
634 |
} |
|
635 |
||
636 |
// Verify static fields |
|
637 |
VerifyFieldClosure blk; |
|
638 |
ik->iterate_static_fields(&blk); |
|
639 |
||
640 |
// Verify vtables |
|
641 |
if (ik->is_linked()) { |
|
642 |
ResourceMark rm(thread); |
|
643 |
// $$$ This used to be done only for m/s collections. Doing it |
|
644 |
// always seemed a valid generalization. (DLD -- 6/00) |
|
645 |
ik->vtable()->verify(st); |
|
646 |
} |
|
647 |
||
648 |
// Verify oop map cache |
|
649 |
if (ik->oop_map_cache() != NULL) { |
|
650 |
ik->oop_map_cache()->verify(); |
|
651 |
} |
|
652 |
||
653 |
// Verify first subklass |
|
654 |
if (ik->subklass_oop() != NULL) { |
|
655 |
guarantee(ik->subklass_oop()->is_perm(), "should be in permspace"); |
|
656 |
guarantee(ik->subklass_oop()->is_klass(), "should be klass"); |
|
657 |
} |
|
658 |
||
659 |
// Verify siblings |
|
660 |
klassOop super = ik->super(); |
|
661 |
Klass* sib = ik->next_sibling(); |
|
662 |
int sib_count = 0; |
|
663 |
while (sib != NULL) { |
|
664 |
if (sib == ik) { |
|
665 |
fatal1("subclass cycle of length %d", sib_count); |
|
666 |
} |
|
667 |
if (sib_count >= 100000) { |
|
668 |
fatal1("suspiciously long subclass list %d", sib_count); |
|
669 |
} |
|
670 |
guarantee(sib->as_klassOop()->is_klass(), "should be klass"); |
|
671 |
guarantee(sib->as_klassOop()->is_perm(), "should be in permspace"); |
|
672 |
guarantee(sib->super() == super, "siblings should have same superklass"); |
|
673 |
sib = sib->next_sibling(); |
|
674 |
} |
|
675 |
||
676 |
// Verify implementor fields |
|
677 |
bool saw_null_impl = false; |
|
678 |
for (int i = 0; i < instanceKlass::implementors_limit; i++) { |
|
679 |
klassOop im = ik->implementor(i); |
|
680 |
if (im == NULL) { saw_null_impl = true; continue; } |
|
681 |
guarantee(!saw_null_impl, "non-nulls must preceded all nulls"); |
|
682 |
guarantee(ik->is_interface(), "only interfaces should have implementor set"); |
|
683 |
guarantee(i < ik->nof_implementors(), "should only have one implementor"); |
|
684 |
guarantee(im->is_perm(), "should be in permspace"); |
|
685 |
guarantee(im->is_klass(), "should be klass"); |
|
686 |
guarantee(!Klass::cast(klassOop(im))->is_interface(), "implementors cannot be interfaces"); |
|
687 |
} |
|
688 |
||
689 |
// Verify local interfaces |
|
690 |
objArrayOop local_interfaces = ik->local_interfaces(); |
|
691 |
guarantee(local_interfaces->is_perm(), "should be in permspace"); |
|
692 |
guarantee(local_interfaces->is_objArray(), "should be obj array"); |
|
693 |
int j; |
|
694 |
for (j = 0; j < local_interfaces->length(); j++) { |
|
695 |
oop e = local_interfaces->obj_at(j); |
|
696 |
guarantee(e->is_klass() && Klass::cast(klassOop(e))->is_interface(), "invalid local interface"); |
|
697 |
} |
|
698 |
||
699 |
// Verify transitive interfaces |
|
700 |
objArrayOop transitive_interfaces = ik->transitive_interfaces(); |
|
701 |
guarantee(transitive_interfaces->is_perm(), "should be in permspace"); |
|
702 |
guarantee(transitive_interfaces->is_objArray(), "should be obj array"); |
|
703 |
for (j = 0; j < transitive_interfaces->length(); j++) { |
|
704 |
oop e = transitive_interfaces->obj_at(j); |
|
705 |
guarantee(e->is_klass() && Klass::cast(klassOop(e))->is_interface(), "invalid transitive interface"); |
|
706 |
} |
|
707 |
||
708 |
// Verify methods |
|
709 |
objArrayOop methods = ik->methods(); |
|
710 |
guarantee(methods->is_perm(), "should be in permspace"); |
|
711 |
guarantee(methods->is_objArray(), "should be obj array"); |
|
712 |
for (j = 0; j < methods->length(); j++) { |
|
713 |
guarantee(methods->obj_at(j)->is_method(), "non-method in methods array"); |
|
714 |
} |
|
715 |
for (j = 0; j < methods->length() - 1; j++) { |
|
716 |
methodOop m1 = methodOop(methods->obj_at(j)); |
|
717 |
methodOop m2 = methodOop(methods->obj_at(j + 1)); |
|
718 |
guarantee(m1->name()->fast_compare(m2->name()) <= 0, "methods not sorted correctly"); |
|
719 |
} |
|
720 |
||
721 |
// Verify method ordering |
|
722 |
typeArrayOop method_ordering = ik->method_ordering(); |
|
723 |
guarantee(method_ordering->is_perm(), "should be in permspace"); |
|
724 |
guarantee(method_ordering->is_typeArray(), "should be type array"); |
|
725 |
int length = method_ordering->length(); |
|
726 |
if (JvmtiExport::can_maintain_original_method_order()) { |
|
727 |
guarantee(length == methods->length(), "invalid method ordering length"); |
|
728 |
jlong sum = 0; |
|
729 |
for (j = 0; j < length; j++) { |
|
730 |
int original_index = method_ordering->int_at(j); |
|
731 |
guarantee(original_index >= 0 && original_index < length, "invalid method ordering index"); |
|
732 |
sum += original_index; |
|
733 |
} |
|
734 |
// Verify sum of indices 0,1,...,length-1 |
|
735 |
guarantee(sum == ((jlong)length*(length-1))/2, "invalid method ordering sum"); |
|
736 |
} else { |
|
737 |
guarantee(length == 0, "invalid method ordering length"); |
|
738 |
} |
|
739 |
||
740 |
// Verify JNI static field identifiers |
|
741 |
if (ik->jni_ids() != NULL) { |
|
742 |
ik->jni_ids()->verify(ik->as_klassOop()); |
|
743 |
} |
|
744 |
||
745 |
// Verify other fields |
|
746 |
if (ik->array_klasses() != NULL) { |
|
747 |
guarantee(ik->array_klasses()->is_perm(), "should be in permspace"); |
|
748 |
guarantee(ik->array_klasses()->is_klass(), "should be klass"); |
|
749 |
} |
|
750 |
guarantee(ik->fields()->is_perm(), "should be in permspace"); |
|
751 |
guarantee(ik->fields()->is_typeArray(), "should be type array"); |
|
752 |
guarantee(ik->constants()->is_perm(), "should be in permspace"); |
|
753 |
guarantee(ik->constants()->is_constantPool(), "should be constant pool"); |
|
754 |
guarantee(ik->inner_classes()->is_perm(), "should be in permspace"); |
|
755 |
guarantee(ik->inner_classes()->is_typeArray(), "should be type array"); |
|
756 |
if (ik->source_file_name() != NULL) { |
|
757 |
guarantee(ik->source_file_name()->is_perm(), "should be in permspace"); |
|
758 |
guarantee(ik->source_file_name()->is_symbol(), "should be symbol"); |
|
759 |
} |
|
760 |
if (ik->source_debug_extension() != NULL) { |
|
761 |
guarantee(ik->source_debug_extension()->is_perm(), "should be in permspace"); |
|
762 |
guarantee(ik->source_debug_extension()->is_symbol(), "should be symbol"); |
|
763 |
} |
|
764 |
if (ik->protection_domain() != NULL) { |
|
765 |
guarantee(ik->protection_domain()->is_oop(), "should be oop"); |
|
766 |
} |
|
767 |
if (ik->signers() != NULL) { |
|
768 |
guarantee(ik->signers()->is_objArray(), "should be obj array"); |
|
769 |
} |
|
770 |
if (ik->generic_signature() != NULL) { |
|
771 |
guarantee(ik->generic_signature()->is_perm(), "should be in permspace"); |
|
772 |
guarantee(ik->generic_signature()->is_symbol(), "should be symbol"); |
|
773 |
} |
|
774 |
if (ik->class_annotations() != NULL) { |
|
775 |
guarantee(ik->class_annotations()->is_typeArray(), "should be type array"); |
|
776 |
} |
|
777 |
if (ik->fields_annotations() != NULL) { |
|
778 |
guarantee(ik->fields_annotations()->is_objArray(), "should be obj array"); |
|
779 |
} |
|
780 |
if (ik->methods_annotations() != NULL) { |
|
781 |
guarantee(ik->methods_annotations()->is_objArray(), "should be obj array"); |
|
782 |
} |
|
783 |
if (ik->methods_parameter_annotations() != NULL) { |
|
784 |
guarantee(ik->methods_parameter_annotations()->is_objArray(), "should be obj array"); |
|
785 |
} |
|
786 |
if (ik->methods_default_annotations() != NULL) { |
|
787 |
guarantee(ik->methods_default_annotations()->is_objArray(), "should be obj array"); |
|
788 |
} |
|
789 |
} |
|
790 |
} |
|
791 |
||
792 |
||
793 |
bool instanceKlassKlass::oop_partially_loaded(oop obj) const { |
|
794 |
assert(obj->is_klass(), "object must be klass"); |
|
795 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
796 |
assert(ik->oop_is_instance(), "object must be instanceKlass"); |
|
797 |
return ik->transitive_interfaces() == (objArrayOop) obj; // Check whether transitive_interfaces points to self |
|
798 |
} |
|
799 |
||
800 |
||
801 |
// The transitive_interfaces is the last field set when loading an object. |
|
802 |
void instanceKlassKlass::oop_set_partially_loaded(oop obj) { |
|
803 |
assert(obj->is_klass(), "object must be klass"); |
|
804 |
instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
|
805 |
// Set the layout helper to a place-holder value, until fuller initialization. |
|
806 |
// (This allows asserts in oop_is_instance to succeed.) |
|
807 |
ik->set_layout_helper(Klass::instance_layout_helper(0, true)); |
|
808 |
assert(ik->oop_is_instance(), "object must be instanceKlass"); |
|
809 |
assert(ik->transitive_interfaces() == NULL, "just checking"); |
|
810 |
ik->set_transitive_interfaces((objArrayOop) obj); // Temporarily set transitive_interfaces to point to self |
|
811 |
} |