annotate src/share/vm/oops/instanceKlassKlass.cpp @ 1972:f95d63e2154a

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