6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"

The CMS concurrent precleaning and concurrent marking phases should work around classes that are undergoing redefinition.

Reviewed-by: ysr, dcubed
This commit is contained in:
Jon Masamitsu 2009-01-11 16:58:24 -08:00
parent 3474623106
commit c2ff9781c7
18 changed files with 161 additions and 19 deletions

View file

@ -1230,8 +1230,14 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite(
// Constant pools are not easily reused so we allocate a new one
// each time.
// merge_cp is created unsafe for concurrent GC processing. It
// should be marked safe before discarding it because, even if
// garbage. If it crosses a card boundary, it may be scanned
// in order to find the start of the first complete object on the card.
constantPoolHandle merge_cp(THREAD,
oopFactory::new_constantPool(merge_cp_length, THREAD));
oopFactory::new_constantPool(merge_cp_length,
methodOopDesc::IsUnsafeConc,
THREAD));
int orig_length = old_cp->orig_length();
if (orig_length == 0) {
// This old_cp is an actual original constant pool. We save
@ -1274,6 +1280,7 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite(
// rewriting so we can't use the old constant pool with the new
// class.
merge_cp()->set_is_conc_safe(true);
merge_cp = constantPoolHandle(); // toss the merged constant pool
} else if (old_cp->length() < scratch_cp->length()) {
// The old constant pool has fewer entries than the new constant
@ -1283,6 +1290,7 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite(
// rewriting so we can't use the new constant pool with the old
// class.
merge_cp()->set_is_conc_safe(true);
merge_cp = constantPoolHandle(); // toss the merged constant pool
} else {
// The old constant pool has more entries than the new constant
@ -1296,6 +1304,7 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite(
set_new_constant_pool(scratch_class, merge_cp, merge_cp_length, true,
THREAD);
// drop local ref to the merged constant pool
merge_cp()->set_is_conc_safe(true);
merge_cp = constantPoolHandle();
}
} else {
@ -1325,7 +1334,10 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite(
// GCed.
set_new_constant_pool(scratch_class, merge_cp, merge_cp_length, true,
THREAD);
merge_cp()->set_is_conc_safe(true);
}
assert(old_cp()->is_conc_safe(), "Just checking");
assert(scratch_cp()->is_conc_safe(), "Just checking");
return JVMTI_ERROR_NONE;
} // end merge_cp_and_rewrite()
@ -2314,13 +2326,16 @@ void VM_RedefineClasses::set_new_constant_pool(
// worst case merge situation. We want to associate the minimum
// sized constant pool with the klass to save space.
constantPoolHandle smaller_cp(THREAD,
oopFactory::new_constantPool(scratch_cp_length, THREAD));
oopFactory::new_constantPool(scratch_cp_length,
methodOopDesc::IsUnsafeConc,
THREAD));
// preserve orig_length() value in the smaller copy
int orig_length = scratch_cp->orig_length();
assert(orig_length != 0, "sanity check");
smaller_cp->set_orig_length(orig_length);
scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD);
scratch_cp = smaller_cp;
smaller_cp()->set_is_conc_safe(true);
}
// attach new constant pool to klass
@ -2516,6 +2531,7 @@ void VM_RedefineClasses::set_new_constant_pool(
rewrite_cp_refs_in_stack_map_table(method, THREAD);
} // end for each method
assert(scratch_cp()->is_conc_safe(), "Just checking");
} // end set_new_constant_pool()