提交 7876905b 编写于 作者: S sjohanss

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
上级 683f8520
......@@ -66,29 +66,10 @@ void MarkSweep::AdjustKlassClosure::do_klass(Klass* klass) {
klass->oops_do(&MarkSweep::adjust_pointer_closure);
}
void MarkSweep::follow_klass(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.
MarkSweep::follow_class_loader(cld);
}
void MarkSweep::adjust_klass(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.
MarkSweep::adjust_class_loader(cld);
}
void MarkSweep::follow_class_loader(ClassLoaderData* cld) {
cld->oops_do(&MarkSweep::mark_and_push_closure, &MarkSweep::follow_klass_closure, true);
}
void MarkSweep::adjust_class_loader(ClassLoaderData* cld) {
cld->oops_do(&MarkSweep::adjust_pointer_closure, &MarkSweep::adjust_klass_closure, true);
}
void MarkSweep::follow_stack() {
do {
while (!_marking_stack.is_empty()) {
......
......@@ -172,10 +172,8 @@ class MarkSweep : AllStatic {
static void follow_stack(); // Empty marking stack.
static void follow_klass(Klass* klass);
static void adjust_klass(Klass* klass);
static void follow_class_loader(ClassLoaderData* cld);
static void adjust_class_loader(ClassLoaderData* cld);
static void preserve_mark(oop p, markOop mark);
// Save the mark word so it can be restored later
......
......@@ -44,6 +44,11 @@ inline void MarkSweep::mark_object(oop obj) {
}
}
inline void MarkSweep::follow_klass(Klass* klass) {
oop op = klass->klass_holder();
MarkSweep::mark_and_push(&op);
}
template <class T> inline void MarkSweep::follow_root(T* p) {
assert(!Universe::heap()->is_in_reserved(p),
"roots shouldn't be things within the heap");
......
......@@ -2157,7 +2157,6 @@ int InstanceKlass::oop_adjust_pointers(oop obj) {
obj, \
MarkSweep::adjust_pointer(p), \
assert_is_in)
MarkSweep::adjust_klass(obj->klass());
return size;
}
......
......@@ -155,7 +155,13 @@ void InstanceMirrorKlass::oop_follow_contents(oop obj) {
// 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 InstanceMirrorKlass::oop_adjust_pointers(oop obj) {
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), \
......
......@@ -569,7 +569,6 @@ int ObjArrayKlass::oop_adjust_pointers(oop obj) {
// Get size before changing pointers.
// Don't call size() or oop_size() since that is a virtual call.
int size = a->object_size();
MarkSweep::adjust_klass(a->klass());
ObjArrayKlass_OOP_ITERATE(a, p, MarkSweep::adjust_pointer(p))
return size;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册