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