comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 6152:958bb4b7be49

Merge
author asaha
date Tue, 10 Apr 2012 10:42:34 -0700
parents f7c4174b33ba
children d2a62e0f25eb 8150fa46d2ed
comparison
equal deleted inserted replaced
6151:e778c29768e6 6152:958bb4b7be49
2398 2398
2399 // Update constant pool indices in the inner classes info to use 2399 // Update constant pool indices in the inner classes info to use
2400 // new constant indices as needed. The inner classes info is a 2400 // new constant indices as needed. The inner classes info is a
2401 // quadruple: 2401 // quadruple:
2402 // (inner_class_info, outer_class_info, inner_name, inner_access_flags) 2402 // (inner_class_info, outer_class_info, inner_name, inner_access_flags)
2403 typeArrayOop inner_class_list = scratch_class->inner_classes(); 2403 InnerClassesIterator iter(scratch_class);
2404 int icl_length = (inner_class_list == NULL) ? 0 : inner_class_list->length(); 2404 for (; !iter.done(); iter.next()) {
2405 if (icl_length > 0) { 2405 int cur_index = iter.inner_class_info_index();
2406 typeArrayHandle inner_class_list_h(THREAD, inner_class_list); 2406 if (cur_index == 0) {
2407 for (int i = 0; i < icl_length; 2407 continue; // JVM spec. allows null inner class refs so skip it
2408 i += instanceKlass::inner_class_next_offset) { 2408 }
2409 int cur_index = inner_class_list_h->ushort_at(i 2409 int new_index = find_new_index(cur_index);
2410 + instanceKlass::inner_class_inner_class_info_offset); 2410 if (new_index != 0) {
2411 if (cur_index == 0) { 2411 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2412 continue; // JVM spec. allows null inner class refs so skip it 2412 ("inner_class_info change: %d to %d", cur_index, new_index));
2413 } 2413 iter.set_inner_class_info_index(new_index);
2414 int new_index = find_new_index(cur_index); 2414 }
2415 if (new_index != 0) { 2415 cur_index = iter.outer_class_info_index();
2416 RC_TRACE_WITH_THREAD(0x00080000, THREAD, 2416 new_index = find_new_index(cur_index);
2417 ("inner_class_info change: %d to %d", cur_index, new_index)); 2417 if (new_index != 0) {
2418 inner_class_list_h->ushort_at_put(i 2418 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2419 + instanceKlass::inner_class_inner_class_info_offset, new_index); 2419 ("outer_class_info change: %d to %d", cur_index, new_index));
2420 } 2420 iter.set_outer_class_info_index(new_index);
2421 cur_index = inner_class_list_h->ushort_at(i 2421 }
2422 + instanceKlass::inner_class_outer_class_info_offset); 2422 cur_index = iter.inner_name_index();
2423 new_index = find_new_index(cur_index); 2423 new_index = find_new_index(cur_index);
2424 if (new_index != 0) { 2424 if (new_index != 0) {
2425 RC_TRACE_WITH_THREAD(0x00080000, THREAD, 2425 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2426 ("outer_class_info change: %d to %d", cur_index, new_index)); 2426 ("inner_name change: %d to %d", cur_index, new_index));
2427 inner_class_list_h->ushort_at_put(i 2427 iter.set_inner_name_index(new_index);
2428 + instanceKlass::inner_class_outer_class_info_offset, new_index); 2428 }
2429 } 2429 } // end for each inner class
2430 cur_index = inner_class_list_h->ushort_at(i
2431 + instanceKlass::inner_class_inner_name_offset);
2432 new_index = find_new_index(cur_index);
2433 if (new_index != 0) {
2434 RC_TRACE_WITH_THREAD(0x00080000, THREAD,
2435 ("inner_name change: %d to %d", cur_index, new_index));
2436 inner_class_list_h->ushort_at_put(i
2437 + instanceKlass::inner_class_inner_name_offset, new_index);
2438 }
2439 } // end for each inner class
2440 } // end if we have inner classes
2441 2430
2442 // Attach each method in klass to the new constant pool and update 2431 // Attach each method in klass to the new constant pool and update
2443 // to use new constant pool indices as needed: 2432 // to use new constant pool indices as needed:
2444 objArrayHandle methods(THREAD, scratch_class->methods()); 2433 objArrayHandle methods(THREAD, scratch_class->methods());
2445 for (i = methods->length() - 1; i >= 0; i--) { 2434 for (i = methods->length() - 1; i >= 0; i--) {