comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 7954:8d1fb417a42d

Merge
author minqi
date Fri, 25 Jan 2013 13:47:52 -0800
parents 8b46b0196eb0 edd76a5856f7
children 9bf5f643d1cf
comparison
equal deleted inserted replaced
7951:8b46b0196eb0 7954:8d1fb417a42d
1120 ConstantPool::copy_entry_to(old_cp, old_i, *merge_cp_p, old_i, CHECK_0); 1120 ConstantPool::copy_entry_to(old_cp, old_i, *merge_cp_p, old_i, CHECK_0);
1121 break; 1121 break;
1122 } 1122 }
1123 } // end for each old_cp entry 1123 } // end for each old_cp entry
1124 1124
1125 ConstantPool::copy_operands(old_cp, *merge_cp_p, CHECK_0);
1126
1125 // We don't need to sanity check that *merge_cp_length_p is within 1127 // We don't need to sanity check that *merge_cp_length_p is within
1126 // *merge_cp_p bounds since we have the minimum on-entry check above. 1128 // *merge_cp_p bounds since we have the minimum on-entry check above.
1127 (*merge_cp_length_p) = old_i; 1129 (*merge_cp_length_p) = old_i;
1128 } 1130 }
1129 1131
1303 1305
1304 ResourceMark rm(THREAD); 1306 ResourceMark rm(THREAD);
1305 _index_map_count = 0; 1307 _index_map_count = 0;
1306 _index_map_p = new intArray(scratch_cp->length(), -1); 1308 _index_map_p = new intArray(scratch_cp->length(), -1);
1307 1309
1310 // reference to the cp holder is needed for copy_operands()
1311 merge_cp->set_pool_holder(scratch_class());
1308 bool result = merge_constant_pools(old_cp, scratch_cp, &merge_cp, 1312 bool result = merge_constant_pools(old_cp, scratch_cp, &merge_cp,
1309 &merge_cp_length, THREAD); 1313 &merge_cp_length, THREAD);
1314 merge_cp->set_pool_holder(NULL);
1315
1310 if (!result) { 1316 if (!result) {
1311 // The merge can fail due to memory allocation failure or due 1317 // The merge can fail due to memory allocation failure or due
1312 // to robustness checks. 1318 // to robustness checks.
1313 return JVMTI_ERROR_INTERNAL; 1319 return JVMTI_ERROR_INTERNAL;
1314 } 1320 }
2378 // preserve version() value in the smaller copy 2384 // preserve version() value in the smaller copy
2379 int version = scratch_cp->version(); 2385 int version = scratch_cp->version();
2380 assert(version != 0, "sanity check"); 2386 assert(version != 0, "sanity check");
2381 smaller_cp->set_version(version); 2387 smaller_cp->set_version(version);
2382 2388
2389 // attach klass to new constant pool
2390 // reference to the cp holder is needed for copy_operands()
2391 smaller_cp->set_pool_holder(scratch_class());
2392
2383 scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD); 2393 scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD);
2384 scratch_cp = smaller_cp; 2394 scratch_cp = smaller_cp;
2385 2395
2386 // attach new constant pool to klass 2396 // attach new constant pool to klass
2387 scratch_cp->set_pool_holder(scratch_class());
2388
2389 // attach klass to new constant pool
2390 scratch_class->set_constants(scratch_cp()); 2397 scratch_class->set_constants(scratch_cp());
2391 2398
2392 int i; // for portability 2399 int i; // for portability
2393 2400
2394 // update each field in klass to use new constant pool indices as needed 2401 // update each field in klass to use new constant pool indices as needed