Mercurial > hg > graal-jvmci-8
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/oops/instanceMirrorKlass.cpp Fri Nov 22 13:42:46 2013 -0800 +++ b/src/share/vm/oops/instanceMirrorKlass.cpp Tue Nov 26 14:35:38 2013 +0100 @@ -155,7 +155,13 @@ // Follow the klass field in the mirror. Klass* klass = java_lang_Class::as_Klass(obj); if (klass != NULL) { - MarkSweep::follow_klass(klass); + // For anonymous classes we need to handle the class loader data, + // otherwise it won't be claimed and can be unloaded. + if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) { + MarkSweep::follow_class_loader(klass->class_loader_data()); + } else { + MarkSweep::follow_klass(klass); + } } else { // If klass is NULL then this a mirror for a primitive type. // We don't have to follow them, since they are handled as strong @@ -196,17 +202,6 @@ int size = oop_size(obj); InstanceKlass::oop_adjust_pointers(obj); - // Follow the klass field in the mirror. - Klass* klass = java_lang_Class::as_Klass(obj); - if (klass != NULL) { - MarkSweep::adjust_klass(klass); - } else { - // If klass is NULL then this a mirror for a primitive type. - // We don't have to follow them, since they are handled as strong - // roots in Universe::oops_do. - assert(java_lang_Class::is_primitive(obj), "Sanity check"); - } - InstanceMirrorKlass_OOP_ITERATE( \ start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj), \ MarkSweep::adjust_pointer(p), \