591 assert(entry_at(offset) == e, "sanity");
592 }
593
594 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
595 const int cpci = invokedynamic_references_map.at(ref);
596 if (cpci >= 0) {
597 #ifdef ASSERT
598 // invokedynamic and invokehandle have more entries; check if they
599 // all point to the same constant pool cache entry.
600 for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
601 const int cpci_next = invokedynamic_references_map.at(ref + entry);
602 assert(cpci == cpci_next, "%d == %d", cpci, cpci_next);
603 }
604 #endif
605 entry_at(cpci)->initialize_resolved_reference_index(ref);
606 ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1; // skip extra entries
607 }
608 }
609 }
610
611 #if INCLUDE_JVMTI
612 // RedefineClasses() API support:
613 // If any entry of this ConstantPoolCache points to any of
614 // old_methods, replace it with the corresponding new_method.
615 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
616 for (int i = 0; i < length(); i++) {
617 ConstantPoolCacheEntry* entry = entry_at(i);
618 Method* old_method = entry->get_interesting_method_entry(holder);
619 if (old_method == NULL || !old_method->is_old()) {
620 continue; // skip uninteresting entries
621 }
622 if (old_method->is_deleted()) {
623 // clean up entries with deleted methods
624 entry->initialize_entry(entry->constant_pool_index());
625 continue;
626 }
627 Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
628
629 assert(new_method != NULL, "method_with_idnum() should not be NULL");
630 assert(old_method != new_method, "sanity check");
|
591 assert(entry_at(offset) == e, "sanity");
592 }
593
594 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
595 const int cpci = invokedynamic_references_map.at(ref);
596 if (cpci >= 0) {
597 #ifdef ASSERT
598 // invokedynamic and invokehandle have more entries; check if they
599 // all point to the same constant pool cache entry.
600 for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
601 const int cpci_next = invokedynamic_references_map.at(ref + entry);
602 assert(cpci == cpci_next, "%d == %d", cpci, cpci_next);
603 }
604 #endif
605 entry_at(cpci)->initialize_resolved_reference_index(ref);
606 ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1; // skip extra entries
607 }
608 }
609 }
610
611 #if INCLUDE_CDS_JAVA_HEAP
612 oop ConstantPoolCache::archived_references() {
613 assert(UseSharedSpaces, "UseSharedSpaces expected.");
614 return oopDesc::decode_heap_oop(_archived_references);
615 }
616
617 void ConstantPoolCache::set_archived_references(oop o) {
618 assert(DumpSharedSpaces, "called only during runtime");
619 _archived_references = oopDesc::encode_heap_oop(o);
620 }
621 #endif
622
623 #if INCLUDE_JVMTI
624 // RedefineClasses() API support:
625 // If any entry of this ConstantPoolCache points to any of
626 // old_methods, replace it with the corresponding new_method.
627 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
628 for (int i = 0; i < length(); i++) {
629 ConstantPoolCacheEntry* entry = entry_at(i);
630 Method* old_method = entry->get_interesting_method_entry(holder);
631 if (old_method == NULL || !old_method->is_old()) {
632 continue; // skip uninteresting entries
633 }
634 if (old_method->is_deleted()) {
635 // clean up entries with deleted methods
636 entry->initialize_entry(entry->constant_pool_index());
637 continue;
638 }
639 Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
640
641 assert(new_method != NULL, "method_with_idnum() should not be NULL");
642 assert(old_method != new_method, "sanity check");
|