提交 d212a8bb 编写于 作者: S sjohanss

8028993: Full collections with ParallelScavenge slower in JDK 8 compared to 7u40

Summary: Reducing the number of calls to follow_class_loader to speed up the marking phase. Also removed some unnecessary calls to adjust_klass.
Reviewed-by: stefank, jmasa, mgerdin
上级 40625323
...@@ -2433,20 +2433,6 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm, ...@@ -2433,20 +2433,6 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm,
_gc_tracer.report_object_count_after_gc(is_alive_closure()); _gc_tracer.report_object_count_after_gc(is_alive_closure());
} }
void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) {
ClassLoaderData* cld = klass->class_loader_data();
// The actual processing of the klass is done when we
// traverse the list of Klasses in the class loader data.
PSParallelCompact::follow_class_loader(cm, cld);
}
void PSParallelCompact::adjust_klass(ParCompactionManager* cm, Klass* klass) {
ClassLoaderData* cld = klass->class_loader_data();
// The actual processing of the klass is done when we
// traverse the list of Klasses in the class loader data.
PSParallelCompact::adjust_class_loader(cm, cld);
}
void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, void PSParallelCompact::follow_class_loader(ParCompactionManager* cm,
ClassLoaderData* cld) { ClassLoaderData* cld) {
PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
...@@ -2455,13 +2441,6 @@ void PSParallelCompact::follow_class_loader(ParCompactionManager* cm, ...@@ -2455,13 +2441,6 @@ void PSParallelCompact::follow_class_loader(ParCompactionManager* cm,
cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true); cld->oops_do(&mark_and_push_closure, &follow_klass_closure, true);
} }
void PSParallelCompact::adjust_class_loader(ParCompactionManager* cm,
ClassLoaderData* cld) {
cld->oops_do(PSParallelCompact::adjust_pointer_closure(),
PSParallelCompact::adjust_klass_closure(),
true);
}
// This should be moved to the shared markSweep code! // This should be moved to the shared markSweep code!
class PSAlwaysTrueClosure: public BoolObjectClosure { class PSAlwaysTrueClosure: public BoolObjectClosure {
public: public:
......
...@@ -1200,13 +1200,10 @@ class PSParallelCompact : AllStatic { ...@@ -1200,13 +1200,10 @@ class PSParallelCompact : AllStatic {
T* p); T* p);
template <class T> static inline void adjust_pointer(T* p); template <class T> static inline void adjust_pointer(T* p);
static void follow_klass(ParCompactionManager* cm, Klass* klass); static inline void follow_klass(ParCompactionManager* cm, Klass* klass);
static void adjust_klass(ParCompactionManager* cm, Klass* klass);
static void follow_class_loader(ParCompactionManager* cm, static void follow_class_loader(ParCompactionManager* cm,
ClassLoaderData* klass); ClassLoaderData* klass);
static void adjust_class_loader(ParCompactionManager* cm,
ClassLoaderData* klass);
// Compaction support. // Compaction support.
// Return true if p is in the range [beg_addr, end_addr). // Return true if p is in the range [beg_addr, end_addr).
...@@ -1380,6 +1377,11 @@ inline void PSParallelCompact::adjust_pointer(T* p) { ...@@ -1380,6 +1377,11 @@ inline void PSParallelCompact::adjust_pointer(T* p) {
} }
} }
inline void PSParallelCompact::follow_klass(ParCompactionManager* cm, Klass* klass) {
oop holder = klass->klass_holder();
PSParallelCompact::mark_and_push(cm, &holder);
}
template <class T> template <class T>
inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) { inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) {
mark_and_push(_compaction_manager, p); mark_and_push(_compaction_manager, p);
......
...@@ -150,10 +150,6 @@ void InstanceClassLoaderKlass::oop_push_contents(PSPromotionManager* pm, oop obj ...@@ -150,10 +150,6 @@ void InstanceClassLoaderKlass::oop_push_contents(PSPromotionManager* pm, oop obj
int InstanceClassLoaderKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { int InstanceClassLoaderKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
InstanceKlass::oop_update_pointers(cm, obj); InstanceKlass::oop_update_pointers(cm, obj);
ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj);
if (loader_data != NULL) {
PSParallelCompact::adjust_class_loader(cm, loader_data);
}
return size_helper(); return size_helper();
} }
#endif // INCLUDE_ALL_GCS #endif // INCLUDE_ALL_GCS
......
...@@ -2199,7 +2199,6 @@ int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { ...@@ -2199,7 +2199,6 @@ int InstanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
obj, \ obj, \
PSParallelCompact::adjust_pointer(p), \ PSParallelCompact::adjust_pointer(p), \
assert_is_in) assert_is_in)
obj->update_header(cm);
return size; return size;
} }
......
...@@ -155,8 +155,13 @@ void InstanceMirrorKlass::oop_follow_contents(oop obj) { ...@@ -155,8 +155,13 @@ void InstanceMirrorKlass::oop_follow_contents(oop obj) {
// Follow the klass field in the mirror. // Follow the klass field in the mirror.
Klass* klass = java_lang_Class::as_Klass(obj); Klass* klass = java_lang_Class::as_Klass(obj);
if (klass != NULL) { if (klass != NULL) {
// For anonymous classes we need to handle the class loader data, // An anonymous class doesn't have its own class loader, so the call
// otherwise it won't be claimed and can be unloaded. // to follow_klass will mark and push its java mirror instead of the
// class loader. When handling the java mirror for an anonymous class
// we need to make sure its class loader data is claimed, this is done
// by calling follow_class_loader explicitly. For non-anonymous classes
// the call to follow_class_loader is made when the class loader itself
// is handled.
if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) { if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
MarkSweep::follow_class_loader(klass->class_loader_data()); MarkSweep::follow_class_loader(klass->class_loader_data());
} else { } else {
...@@ -183,7 +188,18 @@ void InstanceMirrorKlass::oop_follow_contents(ParCompactionManager* cm, ...@@ -183,7 +188,18 @@ void InstanceMirrorKlass::oop_follow_contents(ParCompactionManager* cm,
// Follow the klass field in the mirror. // Follow the klass field in the mirror.
Klass* klass = java_lang_Class::as_Klass(obj); Klass* klass = java_lang_Class::as_Klass(obj);
if (klass != NULL) { if (klass != NULL) {
PSParallelCompact::follow_klass(cm, klass); // An anonymous class doesn't have its own class loader, so the call
// to follow_klass will mark and push its java mirror instead of the
// class loader. When handling the java mirror for an anonymous class
// we need to make sure its class loader data is claimed, this is done
// by calling follow_class_loader explicitly. For non-anonymous classes
// the call to follow_class_loader is made when the class loader itself
// is handled.
if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) {
PSParallelCompact::follow_class_loader(cm, klass->class_loader_data());
} else {
PSParallelCompact::follow_klass(cm, klass);
}
} else { } else {
// If klass is NULL then this a mirror for a primitive type. // 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 // We don't have to follow them, since they are handled as strong
...@@ -332,17 +348,6 @@ int InstanceMirrorKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) ...@@ -332,17 +348,6 @@ int InstanceMirrorKlass::oop_update_pointers(ParCompactionManager* cm, oop obj)
int size = oop_size(obj); int size = oop_size(obj);
InstanceKlass::oop_update_pointers(cm, obj); InstanceKlass::oop_update_pointers(cm, obj);
// Follow the klass field in the mirror.
Klass* klass = java_lang_Class::as_Klass(obj);
if (klass != NULL) {
PSParallelCompact::adjust_klass(cm, 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( \ InstanceMirrorKlass_OOP_ITERATE( \
start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\ start_of_static_fields(obj), java_lang_Class::static_oop_field_count(obj),\
PSParallelCompact::adjust_pointer(p), \ PSParallelCompact::adjust_pointer(p), \
......
...@@ -587,7 +587,6 @@ int ObjArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) { ...@@ -587,7 +587,6 @@ int ObjArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
assert (obj->is_objArray(), "obj must be obj array"); assert (obj->is_objArray(), "obj must be obj array");
objArrayOop a = objArrayOop(obj); objArrayOop a = objArrayOop(obj);
int size = a->object_size(); int size = a->object_size();
a->update_header(cm);
ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p)) ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p))
return size; return size;
} }
......
...@@ -328,11 +328,6 @@ class oopDesc { ...@@ -328,11 +328,6 @@ class oopDesc {
// return the size of this oop. This is used by the MarkSweep collector. // return the size of this oop. This is used by the MarkSweep collector.
int adjust_pointers(); int adjust_pointers();
#if INCLUDE_ALL_GCS
// Parallel old
void update_header(ParCompactionManager* cm);
#endif // INCLUDE_ALL_GCS
// mark-sweep support // mark-sweep support
void follow_body(int begin, int end); void follow_body(int begin, int end);
......
...@@ -80,8 +80,4 @@ inline oop oopDesc::forward_to_atomic(oop p) { ...@@ -80,8 +80,4 @@ inline oop oopDesc::forward_to_atomic(oop p) {
return forwardee(); return forwardee();
} }
inline void oopDesc::update_header(ParCompactionManager* cm) {
PSParallelCompact::adjust_klass(cm, klass());
}
#endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册