--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Tue Jan 06 07:05:05 2009 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Sun Jan 11 16:58:24 2009 -0800
@@ -1230,8 +1230,14 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
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()