comparison src/share/vm/oops/instanceMirrorKlass.cpp @ 13417:55a0da3d420b

8027675: Full collections with Serial slower in JDK 8 compared to 7u40 Summary: Reduced the number of calls to follow_class_loader and instead marked and pushed the klass holder directly. Also removed unneeded calls to adjust_klass. Reviewed-by: coleenp, jmasa, mgerdin, tschatzl
author sjohanss
date Tue, 26 Nov 2013 14:35:38 +0100
parents db9981fd3124
children ad72068ac41e
comparison
equal deleted inserted replaced
13397:e51d73189692 13417:55a0da3d420b
153 InstanceKlass::oop_follow_contents(obj); 153 InstanceKlass::oop_follow_contents(obj);
154 154
155 // Follow the klass field in the mirror. 155 // Follow the klass field in the mirror.
156 Klass* klass = java_lang_Class::as_Klass(obj); 156 Klass* klass = java_lang_Class::as_Klass(obj);
157 if (klass != NULL) { 157 if (klass != NULL) {
158 MarkSweep::follow_klass(klass); 158 // For anonymous classes we need to handle the class loader data,
159 // otherwise it won't be claimed and can be unloaded.
160 if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
161 MarkSweep::follow_class_loader(klass->class_loader_data());
162 } else {
163 MarkSweep::follow_klass(klass);
164 }
159 } else { 165 } else {
160 // If klass is NULL then this a mirror for a primitive type. 166 // If klass is NULL then this a mirror for a primitive type.
161 // We don't have to follow them, since they are handled as strong 167 // We don't have to follow them, since they are handled as strong
162 // roots in Universe::oops_do. 168 // roots in Universe::oops_do.
163 assert(java_lang_Class::is_primitive(obj), "Sanity check"); 169 assert(java_lang_Class::is_primitive(obj), "Sanity check");
194 200
195 int InstanceMirrorKlass::oop_adjust_pointers(oop obj) { 201 int InstanceMirrorKlass::oop_adjust_pointers(oop obj) {
196 int size = oop_size(obj); 202 int size = oop_size(obj);
197 InstanceKlass::oop_adjust_pointers(obj); 203 InstanceKlass::oop_adjust_pointers(obj);
198 204
199 // Follow the klass field in the mirror.
200 Klass* klass = java_lang_Class::as_Klass(obj);
201 if (klass != NULL) {
202 MarkSweep::adjust_klass(klass);
203 } else {
204 // If klass is NULL then this a mirror for a primitive type.
205 // We don't have to follow them, since they are handled as strong
206 // roots in Universe::oops_do.
207 assert(java_lang_Class::is_primitive(obj), "Sanity check");
208 }
209
210 InstanceMirrorKlass_OOP_ITERATE( \ 205 InstanceMirrorKlass_OOP_ITERATE( \
211 start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \ 206 start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \
212 MarkSweep::adjust_pointer(p), \ 207 MarkSweep::adjust_pointer(p), \
213 assert_nothing) 208 assert_nothing)
214 return size; 209 return size;