592 const int cpci = invokedynamic_references_map[ref]; 593 if (cpci >= 0) { 594 #ifdef ASSERT 595 // invokedynamic and invokehandle have more entries; check if they 596 // all point to the same constant pool cache entry. 597 for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { 598 const int cpci_next = invokedynamic_references_map[ref + entry]; 599 assert(cpci == cpci_next, err_msg_res("%d == %d", cpci, cpci_next)); 600 } 601 #endif 602 entry_at(cpci)->initialize_resolved_reference_index(ref); 603 ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1; // skip extra entries 604 } 605 } 606 } 607 608 #if INCLUDE_JVMTI 609 // RedefineClasses() API support: 610 // If any entry of this ConstantPoolCache points to any of 611 // old_methods, replace it with the corresponding new_method. 612 void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new_methods, 613 int methods_length, bool * trace_name_printed) { 614 615 if (methods_length == 0) { 616 // nothing to do if there are no methods 617 return; 618 } 619 620 // get shorthand for the interesting class 621 Klass* old_holder = old_methods[0]->method_holder(); 622 623 for (int i = 0; i < length(); i++) { 624 if (entry_at(i)->get_interesting_method_entry(old_holder) == NULL) { 625 // skip uninteresting methods 626 continue; 627 } 628 629 // The ConstantPoolCache contains entries for several different 630 // things, but we only care about methods. In fact, we only care 631 // about methods in the same class as the one that contains the 632 // old_methods. At this point, we have an interesting entry. 633 634 for (int j = 0; j < methods_length; j++) { 635 Method* old_method = old_methods[j]; 636 Method* new_method = new_methods[j]; 637 638 if (entry_at(i)->adjust_method_entry(old_method, new_method, 639 trace_name_printed)) { 640 // current old_method matched this entry and we updated it so 641 // break out and get to the next interesting entry if there one 642 break; 643 } 644 } 645 } 646 } 647 648 // If any entry of this ConstantPoolCache points to any of 649 // old_methods, replace it with the corresponding new_method. 650 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) { 651 for (int i = 0; i < length(); i++) { 652 ConstantPoolCacheEntry* entry = entry_at(i); 653 Method* old_method = entry->get_interesting_method_entry(holder); 654 if (old_method == NULL || !old_method->is_old()) { 655 continue; // skip uninteresting entries 656 } 657 if (old_method->is_deleted()) { 658 // clean up entries with deleted methods 659 entry->initialize_entry(entry->constant_pool_index()); 660 continue; 661 } 662 Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); 663 664 assert(new_method != NULL, "method_with_idnum() should not be NULL"); 665 assert(old_method != new_method, "sanity check"); 666 667 entry_at(i)->adjust_method_entry(old_method, new_method, trace_name_printed); 668 } 669 } | 592 const int cpci = invokedynamic_references_map[ref]; 593 if (cpci >= 0) { 594 #ifdef ASSERT 595 // invokedynamic and invokehandle have more entries; check if they 596 // all point to the same constant pool cache entry. 597 for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { 598 const int cpci_next = invokedynamic_references_map[ref + entry]; 599 assert(cpci == cpci_next, err_msg_res("%d == %d", cpci, cpci_next)); 600 } 601 #endif 602 entry_at(cpci)->initialize_resolved_reference_index(ref); 603 ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1; // skip extra entries 604 } 605 } 606 } 607 608 #if INCLUDE_JVMTI 609 // RedefineClasses() API support: 610 // If any entry of this ConstantPoolCache points to any of 611 // old_methods, replace it with the corresponding new_method. 612 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) { 613 for (int i = 0; i < length(); i++) { 614 ConstantPoolCacheEntry* entry = entry_at(i); 615 Method* old_method = entry->get_interesting_method_entry(holder); 616 if (old_method == NULL || !old_method->is_old()) { 617 continue; // skip uninteresting entries 618 } 619 if (old_method->is_deleted()) { 620 // clean up entries with deleted methods 621 entry->initialize_entry(entry->constant_pool_index()); 622 continue; 623 } 624 Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum()); 625 626 assert(new_method != NULL, "method_with_idnum() should not be NULL"); 627 assert(old_method != new_method, "sanity check"); 628 629 entry_at(i)->adjust_method_entry(old_method, new_method, trace_name_printed); 630 } 631 } |