< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page

497     if (clean_alive_klasses && current->is_instance_klass()) {
498       InstanceKlass* ik = InstanceKlass::cast(current);
499       ik->clean_weak_instanceklass_links();
500 
501       // JVMTI RedefineClasses creates previous versions that are not in
502       // the class hierarchy, so process them here.
503       while ((ik = ik->previous_versions()) != nullptr) {
504         ik->clean_weak_instanceklass_links();
505       }
506     }
507   }
508 }
509 
510 void Klass::metaspace_pointers_do(MetaspaceClosure* it) {
511   if (log_is_enabled(Trace, cds)) {
512     ResourceMark rm;
513     log_trace(cds)("Iter(Klass): %p (%s)", this, external_name());
514   }
515 
516   it->push(&_name);
517   it->push(&_secondary_super_cache);
518   it->push(&_secondary_supers);
519   for (int i = 0; i < _primary_super_limit; i++) {
520     it->push(&_primary_supers[i]);
521   }
522   it->push(&_super);
523   if (!CDSConfig::is_dumping_archive()) {
524     // If dumping archive, these may point to excluded classes. There's no need
525     // to follow these pointers anyway, as they will be set to null in
526     // remove_unshareable_info().
527     it->push((Klass**)&_subklass);
528     it->push((Klass**)&_next_sibling);
529     it->push(&_next_link);
530   }
531 
532   vtableEntry* vt = start_of_vtable();
533   for (int i=0; i<vtable_length(); i++) {
534     it->push(vt[i].method_addr());
535   }
536 }
537 
538 #if INCLUDE_CDS
539 void Klass::remove_unshareable_info() {
540   assert(CDSConfig::is_dumping_archive(),
541           "only called during CDS dump time");
542   JFR_ONLY(REMOVE_ID(this);)
543   if (log_is_enabled(Trace, cds, unshareable)) {
544     ResourceMark rm;
545     log_trace(cds, unshareable)("remove: %s", external_name());
546   }
547 





548   set_subklass(nullptr);
549   set_next_sibling(nullptr);
550   set_next_link(nullptr);
551 
552   // Null out class_loader_data because we don't share that yet.
553   set_class_loader_data(nullptr);
554   set_is_shared();
555 }
556 
557 void Klass::remove_java_mirror() {
558   assert(CDSConfig::is_dumping_archive(), "sanity");
559   if (log_is_enabled(Trace, cds, unshareable)) {
560     ResourceMark rm;
561     log_trace(cds, unshareable)("remove java_mirror: %s", external_name());
562   }
563   // Just null out the mirror.  The class_loader_data() no longer exists.
564   clear_java_mirror_handle();
565 }
566 
567 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {

497     if (clean_alive_klasses && current->is_instance_klass()) {
498       InstanceKlass* ik = InstanceKlass::cast(current);
499       ik->clean_weak_instanceklass_links();
500 
501       // JVMTI RedefineClasses creates previous versions that are not in
502       // the class hierarchy, so process them here.
503       while ((ik = ik->previous_versions()) != nullptr) {
504         ik->clean_weak_instanceklass_links();
505       }
506     }
507   }
508 }
509 
510 void Klass::metaspace_pointers_do(MetaspaceClosure* it) {
511   if (log_is_enabled(Trace, cds)) {
512     ResourceMark rm;
513     log_trace(cds)("Iter(Klass): %p (%s)", this, external_name());
514   }
515 
516   it->push(&_name);

517   it->push(&_secondary_supers);
518   for (int i = 0; i < _primary_super_limit; i++) {
519     it->push(&_primary_supers[i]);
520   }
521   it->push(&_super);
522   if (!CDSConfig::is_dumping_archive()) {
523     // If dumping archive, these may point to excluded classes. There's no need
524     // to follow these pointers anyway, as they will be set to null in
525     // remove_unshareable_info().
526     it->push((Klass**)&_subklass);
527     it->push((Klass**)&_next_sibling);
528     it->push(&_next_link);
529   }
530 
531   vtableEntry* vt = start_of_vtable();
532   for (int i=0; i<vtable_length(); i++) {
533     it->push(vt[i].method_addr());
534   }
535 }
536 
537 #if INCLUDE_CDS
538 void Klass::remove_unshareable_info() {
539   assert(CDSConfig::is_dumping_archive(),
540           "only called during CDS dump time");
541   JFR_ONLY(REMOVE_ID(this);)
542   if (log_is_enabled(Trace, cds, unshareable)) {
543     ResourceMark rm;
544     log_trace(cds, unshareable)("remove: %s", external_name());
545   }
546 
547   // _secondary_super_cache may be updated by an is_subtype_of() call
548   // while ArchiveBuilder is copying metaspace objects. Let's reset it to
549   // null and let it be repopulated at runtime.
550   set_secondary_super_cache(nullptr);
551 
552   set_subklass(nullptr);
553   set_next_sibling(nullptr);
554   set_next_link(nullptr);
555 
556   // Null out class_loader_data because we don't share that yet.
557   set_class_loader_data(nullptr);
558   set_is_shared();
559 }
560 
561 void Klass::remove_java_mirror() {
562   assert(CDSConfig::is_dumping_archive(), "sanity");
563   if (log_is_enabled(Trace, cds, unshareable)) {
564     ResourceMark rm;
565     log_trace(cds, unshareable)("remove java_mirror: %s", external_name());
566   }
567   // Just null out the mirror.  The class_loader_data() no longer exists.
568   clear_java_mirror_handle();
569 }
570 
571 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
< prev index next >