Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 7969:1eae78177059
Merge
author | jiangli |
---|---|
date | Fri, 01 Feb 2013 15:25:37 -0500 |
parents | 8d1fb417a42d |
children | 9bf5f643d1cf |
comparison
equal
deleted
inserted
replaced
7968:44c5fcd9cb25 | 7969:1eae78177059 |
---|---|
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 |
3102 | 3109 |
3103 oop the_class_mirror = JNIHandles::resolve_non_null(the_jclass); | 3110 oop the_class_mirror = JNIHandles::resolve_non_null(the_jclass); |
3104 Klass* the_class_oop = java_lang_Class::as_Klass(the_class_mirror); | 3111 Klass* the_class_oop = java_lang_Class::as_Klass(the_class_mirror); |
3105 instanceKlassHandle the_class = instanceKlassHandle(THREAD, the_class_oop); | 3112 instanceKlassHandle the_class = instanceKlassHandle(THREAD, the_class_oop); |
3106 | 3113 |
3107 #ifndef JVMTI_KERNEL | |
3108 // Remove all breakpoints in methods of this class | 3114 // Remove all breakpoints in methods of this class |
3109 JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints(); | 3115 JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints(); |
3110 jvmti_breakpoints.clearall_in_class_at_safepoint(the_class_oop); | 3116 jvmti_breakpoints.clearall_in_class_at_safepoint(the_class_oop); |
3111 #endif // !JVMTI_KERNEL | |
3112 | 3117 |
3113 if (the_class_oop == Universe::reflect_invoke_cache()->klass()) { | 3118 if (the_class_oop == Universe::reflect_invoke_cache()->klass()) { |
3114 // We are redefining java.lang.reflect.Method. Method.invoke() is | 3119 // We are redefining java.lang.reflect.Method. Method.invoke() is |
3115 // cached and users of the cache care about each active version of | 3120 // cached and users of the cache care about each active version of |
3116 // the method so we have to track this previous version. | 3121 // the method so we have to track this previous version. |