757 for (int i=0; i<length(); i++) {
758 entry_at(i)->verify_just_initialized(f2_used[i]);
759 })
760 } else {
761 for (int i=0; i<length(); i++) {
762 entry_at(i)->reinitialize(f2_used[i]);
763 }
764 }
765 }
766
767 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
768 assert(!is_shared(), "shared caches are not deallocated");
769 data->remove_handle(_resolved_references);
770 set_resolved_references(OopHandle());
771 MetadataFactory::free_array<u2>(data, _reference_map);
772 set_reference_map(NULL);
773 }
774
775 #if INCLUDE_CDS_JAVA_HEAP
776 oop ConstantPoolCache::archived_references() {
777 if (CompressedOops::is_null(_archived_references)) {
778 return NULL;
779 }
780 return HeapShared::materialize_archived_object(_archived_references);
781 }
782
783 void ConstantPoolCache::set_archived_references(oop o) {
784 assert(DumpSharedSpaces, "called only during runtime");
785 _archived_references = CompressedOops::encode(o);
786 }
787 #endif
788
789 #if INCLUDE_JVMTI
790 // RedefineClasses() API support:
791 // If any entry of this ConstantPoolCache points to any of
792 // old_methods, replace it with the corresponding new_method.
793 void ConstantPoolCache::adjust_method_entries(bool * trace_name_printed) {
794 for (int i = 0; i < length(); i++) {
795 ConstantPoolCacheEntry* entry = entry_at(i);
796 Method* old_method = entry->get_interesting_method_entry();
797 if (old_method == NULL || !old_method->is_old()) {
798 continue; // skip uninteresting entries
799 }
800 if (old_method->is_deleted()) {
801 // clean up entries with deleted methods
802 entry->initialize_entry(entry->constant_pool_index());
803 continue;
804 }
805 Method* new_method = old_method->get_new_method();
|
757 for (int i=0; i<length(); i++) {
758 entry_at(i)->verify_just_initialized(f2_used[i]);
759 })
760 } else {
761 for (int i=0; i<length(); i++) {
762 entry_at(i)->reinitialize(f2_used[i]);
763 }
764 }
765 }
766
767 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
768 assert(!is_shared(), "shared caches are not deallocated");
769 data->remove_handle(_resolved_references);
770 set_resolved_references(OopHandle());
771 MetadataFactory::free_array<u2>(data, _reference_map);
772 set_reference_map(NULL);
773 }
774
775 #if INCLUDE_CDS_JAVA_HEAP
776 oop ConstantPoolCache::archived_references() {
777 if (_archived_references_index < 0) {
778 return NULL;
779 }
780 return HeapShared::get_root(_archived_references_index);
781 }
782
783 void ConstantPoolCache::clear_archived_references() {
784 if (_archived_references_index >= 0) {
785 HeapShared::clear_root(_archived_references_index);
786 _archived_references_index = -1;
787 }
788 }
789
790 void ConstantPoolCache::set_archived_references(oop o) {
791 assert(DumpSharedSpaces, "called only during runtime");
792 _archived_references_index = HeapShared::append_root(o);
793 }
794 #endif
795
796 #if INCLUDE_JVMTI
797 // RedefineClasses() API support:
798 // If any entry of this ConstantPoolCache points to any of
799 // old_methods, replace it with the corresponding new_method.
800 void ConstantPoolCache::adjust_method_entries(bool * trace_name_printed) {
801 for (int i = 0; i < length(); i++) {
802 ConstantPoolCacheEntry* entry = entry_at(i);
803 Method* old_method = entry->get_interesting_method_entry();
804 if (old_method == NULL || !old_method->is_old()) {
805 continue; // skip uninteresting entries
806 }
807 if (old_method->is_deleted()) {
808 // clean up entries with deleted methods
809 entry->initialize_entry(entry->constant_pool_index());
810 continue;
811 }
812 Method* new_method = old_method->get_new_method();
|