1.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Tue Jan 06 07:05:05 2009 -0800 1.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Sun Jan 11 16:58:24 2009 -0800 1.3 @@ -1230,8 +1230,14 @@ 1.4 1.5 // Constant pools are not easily reused so we allocate a new one 1.6 // each time. 1.7 + // merge_cp is created unsafe for concurrent GC processing. It 1.8 + // should be marked safe before discarding it because, even if 1.9 + // garbage. If it crosses a card boundary, it may be scanned 1.10 + // in order to find the start of the first complete object on the card. 1.11 constantPoolHandle merge_cp(THREAD, 1.12 - oopFactory::new_constantPool(merge_cp_length, THREAD)); 1.13 + oopFactory::new_constantPool(merge_cp_length, 1.14 + methodOopDesc::IsUnsafeConc, 1.15 + THREAD)); 1.16 int orig_length = old_cp->orig_length(); 1.17 if (orig_length == 0) { 1.18 // This old_cp is an actual original constant pool. We save 1.19 @@ -1274,6 +1280,7 @@ 1.20 // rewriting so we can't use the old constant pool with the new 1.21 // class. 1.22 1.23 + merge_cp()->set_is_conc_safe(true); 1.24 merge_cp = constantPoolHandle(); // toss the merged constant pool 1.25 } else if (old_cp->length() < scratch_cp->length()) { 1.26 // The old constant pool has fewer entries than the new constant 1.27 @@ -1283,6 +1290,7 @@ 1.28 // rewriting so we can't use the new constant pool with the old 1.29 // class. 1.30 1.31 + merge_cp()->set_is_conc_safe(true); 1.32 merge_cp = constantPoolHandle(); // toss the merged constant pool 1.33 } else { 1.34 // The old constant pool has more entries than the new constant 1.35 @@ -1296,6 +1304,7 @@ 1.36 set_new_constant_pool(scratch_class, merge_cp, merge_cp_length, true, 1.37 THREAD); 1.38 // drop local ref to the merged constant pool 1.39 + merge_cp()->set_is_conc_safe(true); 1.40 merge_cp = constantPoolHandle(); 1.41 } 1.42 } else { 1.43 @@ -1325,7 +1334,10 @@ 1.44 // GCed. 1.45 set_new_constant_pool(scratch_class, merge_cp, merge_cp_length, true, 1.46 THREAD); 1.47 + merge_cp()->set_is_conc_safe(true); 1.48 } 1.49 + assert(old_cp()->is_conc_safe(), "Just checking"); 1.50 + assert(scratch_cp()->is_conc_safe(), "Just checking"); 1.51 1.52 return JVMTI_ERROR_NONE; 1.53 } // end merge_cp_and_rewrite() 1.54 @@ -2314,13 +2326,16 @@ 1.55 // worst case merge situation. We want to associate the minimum 1.56 // sized constant pool with the klass to save space. 1.57 constantPoolHandle smaller_cp(THREAD, 1.58 - oopFactory::new_constantPool(scratch_cp_length, THREAD)); 1.59 + oopFactory::new_constantPool(scratch_cp_length, 1.60 + methodOopDesc::IsUnsafeConc, 1.61 + THREAD)); 1.62 // preserve orig_length() value in the smaller copy 1.63 int orig_length = scratch_cp->orig_length(); 1.64 assert(orig_length != 0, "sanity check"); 1.65 smaller_cp->set_orig_length(orig_length); 1.66 scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD); 1.67 scratch_cp = smaller_cp; 1.68 + smaller_cp()->set_is_conc_safe(true); 1.69 } 1.70 1.71 // attach new constant pool to klass 1.72 @@ -2516,6 +2531,7 @@ 1.73 1.74 rewrite_cp_refs_in_stack_map_table(method, THREAD); 1.75 } // end for each method 1.76 + assert(scratch_cp()->is_conc_safe(), "Just checking"); 1.77 } // end set_new_constant_pool() 1.78 1.79