< prev index next >

src/hotspot/share/classfile/systemDictionaryShared.cpp

Print this page

  48 #include "classfile/dictionary.hpp"
  49 #include "classfile/javaClasses.inline.hpp"
  50 #include "classfile/symbolTable.hpp"
  51 #include "classfile/systemDictionary.hpp"
  52 #include "classfile/systemDictionaryShared.hpp"
  53 #include "classfile/verificationType.hpp"
  54 #include "classfile/vmClasses.hpp"
  55 #include "classfile/vmSymbols.hpp"
  56 #include "jfr/jfrEvents.hpp"
  57 #include "logging/log.hpp"
  58 #include "logging/logStream.hpp"
  59 #include "memory/allocation.hpp"
  60 #include "memory/metadataFactory.hpp"
  61 #include "memory/metaspaceClosure.hpp"
  62 #include "memory/oopFactory.hpp"
  63 #include "memory/resourceArea.hpp"
  64 #include "memory/universe.hpp"
  65 #include "oops/compressedKlass.inline.hpp"
  66 #include "oops/instanceKlass.hpp"
  67 #include "oops/klass.inline.hpp"

  68 #include "oops/objArrayKlass.hpp"
  69 #include "oops/objArrayOop.inline.hpp"
  70 #include "oops/oop.inline.hpp"
  71 #include "oops/oopHandle.inline.hpp"
  72 #include "oops/typeArrayOop.inline.hpp"
  73 #include "runtime/arguments.hpp"
  74 #include "runtime/handles.inline.hpp"
  75 #include "runtime/java.hpp"
  76 #include "runtime/javaCalls.hpp"
  77 #include "runtime/mutexLocker.hpp"
  78 #include "utilities/hashTable.hpp"
  79 #include "utilities/stringUtils.hpp"
  80 
  81 SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_static_archive;
  82 SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_dynamic_archive;
  83 
  84 DumpTimeSharedClassTable* SystemDictionaryShared::_dumptime_table = nullptr;
  85 
  86 // Used by NoClassLoadingMark
  87 DEBUG_ONLY(bool SystemDictionaryShared::_class_loading_may_happen = true;)

  89 #ifdef ASSERT
  90 static void check_klass_after_loading(const Klass* k) {
  91 #ifdef _LP64
  92   if (k != nullptr && UseCompressedClassPointers && k->needs_narrow_id()) {
  93     CompressedKlassPointers::check_encodable(k);
  94   }
  95 #endif
  96 }
  97 #endif
  98 
  99 InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
 100                  Symbol* class_name, Handle class_loader, TRAPS) {
 101   assert(CDSConfig::is_using_archive(), "must be");
 102   InstanceKlass* ik = find_builtin_class(class_name);
 103 
 104   if (ik != nullptr && !ik->shared_loading_failed()) {
 105     if ((SystemDictionary::is_system_class_loader(class_loader()) && ik->defined_by_app_loader())  ||
 106         (SystemDictionary::is_platform_class_loader(class_loader()) && ik->defined_by_platform_loader())) {
 107       SharedClassLoadingMark slm(THREAD, ik);
 108       PackageEntry* pkg_entry = CDSProtectionDomain::get_package_entry_from_class(ik, class_loader);
 109       Handle protection_domain =
 110         CDSProtectionDomain::init_security_info(class_loader, ik, pkg_entry, CHECK_NULL);



 111       return load_shared_class(ik, class_loader, protection_domain, nullptr, pkg_entry, THREAD);
 112     }
 113   }
 114   return nullptr;
 115 }
 116 
 117 // This function is called for loading only UNREGISTERED classes
 118 InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
 119                                                           Handle class_loader,
 120                                                           Handle protection_domain,
 121                                                           const ClassFileStream* cfs,
 122                                                           TRAPS) {
 123   if (!CDSConfig::is_using_archive()) {
 124     return nullptr;
 125   }
 126   if (class_name == nullptr) {  // don't do this for hidden classes
 127     return nullptr;
 128   }
 129   if (class_loader.is_null() ||
 130       SystemDictionary::is_system_class_loader(class_loader()) ||

 295     // support them and make CDS more complicated.
 296     return warn_excluded(k, "JFR event class");
 297   }
 298 
 299   if (!k->is_linked()) {
 300     if (has_class_failed_verification(k)) {
 301       return warn_excluded(k, "Failed verification");
 302     } else if (CDSConfig::is_dumping_aot_linked_classes()) {
 303       // Most loaded classes should have been speculatively linked by AOTMetaspace::link_class_for_cds().
 304       // However, we do not speculatively link old classes, as they are not recorded by
 305       // SystemDictionaryShared::record_linking_constraint(). As a result, such an unlinked
 306       // class may fail to verify in AOTLinkedClassBulkLoader::init_required_classes_for_loader(),
 307       // causing the JVM to fail at bootstrap.
 308       return warn_excluded(k, "Unlinked class not supported by AOTClassLinking");
 309     } else if (CDSConfig::is_dumping_preimage_static_archive()) {
 310       // When dumping the final static archive, we will unconditionally load and link all
 311       // classes from the preimage. We don't want to get a VerifyError when linking this class.
 312       return warn_excluded(k, "Unlinked class not supported by AOTConfiguration");
 313     }
 314   } else {
 315     if (!k->can_be_verified_at_dumptime()) {
 316       // We have an old class that has been linked (e.g., it's been executed during
 317       // dump time). This class has been verified using the old verifier, which
 318       // doesn't save the verification constraints, so check_verification_constraints()
 319       // won't work at runtime.
 320       // As a result, we cannot store this class. It must be loaded and fully verified
 321       // at runtime.
 322       return warn_excluded(k, "Old class has been linked");
 323     }
 324   }
 325 
 326   if (UnregisteredClasses::check_for_exclusion(k)) {
 327     ResourceMark rm;
 328     aot_log_info(aot)("Skipping %s: used only when dumping CDS archive", k->name()->as_C_string());
 329     return true;
 330   }
 331 
 332   InstanceKlass* super = k->super();
 333   if (super != nullptr && check_for_exclusion(super, nullptr)) {
 334     ResourceMark rm;
 335     aot_log_warning(aot)("Skipping %s: super class %s is excluded", k->name()->as_C_string(), super->name()->as_C_string());

 637     // We sort the classes by their loaders. This way we're likely to archive
 638     // all classes in the one of the two hierarchies.
 639     _list.sort(compare_by_loader);
 640     for (int i = 0; i < _list.length(); i++) {
 641       InstanceKlass* k = _list.at(i);
 642       bool i_am_first = SystemDictionaryShared::add_unregistered_class(_thread, k);
 643       if (!i_am_first) {
 644         SystemDictionaryShared::warn_excluded(k, "Duplicated unregistered class");
 645         SystemDictionaryShared::set_excluded_locked(k);
 646       }
 647     }
 648   }
 649 };
 650 
 651 // Returns true if the class should be excluded. This can be called by
 652 // AOTConstantPoolResolver before or after we enter the CDS safepoint.
 653 // When called before the safepoint, we need to link the class so that
 654 // it can be checked by check_for_exclusion().
 655 bool SystemDictionaryShared::should_be_excluded(Klass* k) {
 656   assert(CDSConfig::is_dumping_archive(), "sanity");
 657   assert(CDSConfig::current_thread_is_vm_or_dumper(), "sanity");
 658 
 659   if (k->is_objArray_klass()) {
 660     return should_be_excluded(ObjArrayKlass::cast(k)->bottom_klass());
 661   }
 662 
 663   if (!k->is_instance_klass()) {
 664     return false;
 665   } else {
 666     InstanceKlass* ik = InstanceKlass::cast(k);
 667 
 668     if (CDSConfig::is_dumping_dynamic_archive() && ik->in_aot_cache()) {
 669       // ik is already part of the static archive, so it will never be considered as excluded.
 670       return false;
 671     }
 672 
 673     if (!SafepointSynchronize::is_at_safepoint()) {
 674       if (!ik->is_linked()) {
 675         // check_for_exclusion() below doesn't link unlinked classes. We come
 676         // here only when we are trying to aot-link constant pool entries, so
 677         // we'd better link the class.
 678         JavaThread* THREAD = JavaThread::current();
 679         ik->link_class(THREAD);
 680         if (HAS_PENDING_EXCEPTION) {
 681           CLEAR_PENDING_EXCEPTION;
 682           return true; // linking failed -- let's exclude it
 683         }
 684       }
 685 
 686       MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
 687       DumpTimeClassInfo* p = get_info_locked(ik);
 688       if (p->is_excluded()) {
 689         return true;
 690       }
 691       return check_for_exclusion(ik, p);
 692     } else {
 693       // No need to check for is_linked() as all eligible classes should have

 775 
 776   if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
 777     LambdaProxyClassDictionary::dumptime_classes_do(it);
 778   }
 779 }
 780 
 781 // Called from VerificationType::is_reference_assignable_from() before performing the assignability check of
 782 //     T1 must be assignable from T2
 783 // Where:
 784 //     L is the class loader of <k>
 785 //     T1 is the type resolved by L using the name <name>
 786 //     T2 is the type resolved by L using the name <from_name>
 787 //
 788 // The meaning of (*skip_assignability_check):
 789 //     true:  is_reference_assignable_from() should SKIP the assignability check
 790 //     false: is_reference_assignable_from() should COMPLETE the assignability check
 791 void SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
 792          Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object,
 793          bool* skip_assignability_check) {
 794   assert(CDSConfig::is_dumping_archive(), "sanity");











 795   DumpTimeClassInfo* info = get_info(k);
 796   info->add_verification_constraint(k, name, from_name, from_field_is_protected,
 797                                     from_is_array, from_is_object);
 798 
 799   if (CDSConfig::is_dumping_classic_static_archive() && !is_builtin(k)) {
 800     // This applies ONLY to the "classic" CDS static dump, which reads the list of
 801     // unregistered classes (those intended for custom class loaders) from the classlist
 802     // and loads them using jdk.internal.misc.CDS$UnregisteredClassLoader.
 803     //
 804     // When the classlist contains an unregistered class k, the supertypes of k are also
 805     // recorded in the classlist. However, the classlist does not contain information about
 806     // any class X that's not a supertype of k but is needed in the verification of k.
 807     // As a result, CDS$UnregisteredClassLoader will not know how to resolve X.
 808     //
 809     // Therefore, we tell the verifier to refrain from resolving X. Instead, X is recorded
 810     // (symbolically) in the verification constraints of k. In the production run,
 811     // when k is loaded, we will go through its verification constraints and resolve X to complete
 812     // the is_reference_assignable_from() checks.
 813     *skip_assignability_check = true;
 814   } else {

1241   print_shared_archive(st, false);
1242 }
1243 
1244 void SystemDictionaryShared::print_table_statistics(outputStream* st) {
1245   if (CDSConfig::is_using_archive()) {
1246     _static_archive.print_table_statistics("Static ", st, true);
1247     if (DynamicArchive::is_mapped()) {
1248       _dynamic_archive.print_table_statistics("Dynamic ", st, false);
1249     }
1250   }
1251 }
1252 
1253 bool SystemDictionaryShared::is_dumptime_table_empty() {
1254   assert_lock_strong(DumpTimeTable_lock);
1255   _dumptime_table->update_counts();
1256   if (_dumptime_table->count_of(true) == 0 && _dumptime_table->count_of(false) == 0){
1257     return true;
1258   }
1259   return false;
1260 }























































  48 #include "classfile/dictionary.hpp"
  49 #include "classfile/javaClasses.inline.hpp"
  50 #include "classfile/symbolTable.hpp"
  51 #include "classfile/systemDictionary.hpp"
  52 #include "classfile/systemDictionaryShared.hpp"
  53 #include "classfile/verificationType.hpp"
  54 #include "classfile/vmClasses.hpp"
  55 #include "classfile/vmSymbols.hpp"
  56 #include "jfr/jfrEvents.hpp"
  57 #include "logging/log.hpp"
  58 #include "logging/logStream.hpp"
  59 #include "memory/allocation.hpp"
  60 #include "memory/metadataFactory.hpp"
  61 #include "memory/metaspaceClosure.hpp"
  62 #include "memory/oopFactory.hpp"
  63 #include "memory/resourceArea.hpp"
  64 #include "memory/universe.hpp"
  65 #include "oops/compressedKlass.inline.hpp"
  66 #include "oops/instanceKlass.hpp"
  67 #include "oops/klass.inline.hpp"
  68 #include "oops/methodData.hpp"
  69 #include "oops/objArrayKlass.hpp"
  70 #include "oops/objArrayOop.inline.hpp"
  71 #include "oops/oop.inline.hpp"
  72 #include "oops/oopHandle.inline.hpp"
  73 #include "oops/typeArrayOop.inline.hpp"
  74 #include "runtime/arguments.hpp"
  75 #include "runtime/handles.inline.hpp"
  76 #include "runtime/java.hpp"
  77 #include "runtime/javaCalls.hpp"
  78 #include "runtime/mutexLocker.hpp"
  79 #include "utilities/hashTable.hpp"
  80 #include "utilities/stringUtils.hpp"
  81 
  82 SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_static_archive;
  83 SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_dynamic_archive;
  84 
  85 DumpTimeSharedClassTable* SystemDictionaryShared::_dumptime_table = nullptr;
  86 
  87 // Used by NoClassLoadingMark
  88 DEBUG_ONLY(bool SystemDictionaryShared::_class_loading_may_happen = true;)

  90 #ifdef ASSERT
  91 static void check_klass_after_loading(const Klass* k) {
  92 #ifdef _LP64
  93   if (k != nullptr && UseCompressedClassPointers && k->needs_narrow_id()) {
  94     CompressedKlassPointers::check_encodable(k);
  95   }
  96 #endif
  97 }
  98 #endif
  99 
 100 InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
 101                  Symbol* class_name, Handle class_loader, TRAPS) {
 102   assert(CDSConfig::is_using_archive(), "must be");
 103   InstanceKlass* ik = find_builtin_class(class_name);
 104 
 105   if (ik != nullptr && !ik->shared_loading_failed()) {
 106     if ((SystemDictionary::is_system_class_loader(class_loader()) && ik->defined_by_app_loader())  ||
 107         (SystemDictionary::is_platform_class_loader(class_loader()) && ik->defined_by_platform_loader())) {
 108       SharedClassLoadingMark slm(THREAD, ik);
 109       PackageEntry* pkg_entry = CDSProtectionDomain::get_package_entry_from_class(ik, class_loader);
 110       Handle protection_domain;
 111       if (!class_name->starts_with("jdk/proxy")) // java/lang/reflect/Proxy$ProxyBuilder defines the proxy classes with a null protection domain.
 112       {
 113         protection_domain = CDSProtectionDomain::init_security_info(class_loader, ik, pkg_entry, CHECK_NULL);
 114       }
 115       return load_shared_class(ik, class_loader, protection_domain, nullptr, pkg_entry, THREAD);
 116     }
 117   }
 118   return nullptr;
 119 }
 120 
 121 // This function is called for loading only UNREGISTERED classes
 122 InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
 123                                                           Handle class_loader,
 124                                                           Handle protection_domain,
 125                                                           const ClassFileStream* cfs,
 126                                                           TRAPS) {
 127   if (!CDSConfig::is_using_archive()) {
 128     return nullptr;
 129   }
 130   if (class_name == nullptr) {  // don't do this for hidden classes
 131     return nullptr;
 132   }
 133   if (class_loader.is_null() ||
 134       SystemDictionary::is_system_class_loader(class_loader()) ||

 299     // support them and make CDS more complicated.
 300     return warn_excluded(k, "JFR event class");
 301   }
 302 
 303   if (!k->is_linked()) {
 304     if (has_class_failed_verification(k)) {
 305       return warn_excluded(k, "Failed verification");
 306     } else if (CDSConfig::is_dumping_aot_linked_classes()) {
 307       // Most loaded classes should have been speculatively linked by AOTMetaspace::link_class_for_cds().
 308       // However, we do not speculatively link old classes, as they are not recorded by
 309       // SystemDictionaryShared::record_linking_constraint(). As a result, such an unlinked
 310       // class may fail to verify in AOTLinkedClassBulkLoader::init_required_classes_for_loader(),
 311       // causing the JVM to fail at bootstrap.
 312       return warn_excluded(k, "Unlinked class not supported by AOTClassLinking");
 313     } else if (CDSConfig::is_dumping_preimage_static_archive()) {
 314       // When dumping the final static archive, we will unconditionally load and link all
 315       // classes from the preimage. We don't want to get a VerifyError when linking this class.
 316       return warn_excluded(k, "Unlinked class not supported by AOTConfiguration");
 317     }
 318   } else {
 319     if (!k->can_be_verified_at_dumptime() && !CDSConfig::preserve_all_dumptime_verification_states(k)) {
 320       // We have an old class that has been linked (e.g., it's been executed during
 321       // dump time). This class has been verified using the old verifier, which
 322       // doesn't save the verification constraints, so check_verification_constraints()
 323       // won't work at runtime.
 324       // As a result, we cannot store this class. It must be loaded and fully verified
 325       // at runtime.
 326       return warn_excluded(k, "Old class has been linked");
 327     }
 328   }
 329 
 330   if (UnregisteredClasses::check_for_exclusion(k)) {
 331     ResourceMark rm;
 332     aot_log_info(aot)("Skipping %s: used only when dumping CDS archive", k->name()->as_C_string());
 333     return true;
 334   }
 335 
 336   InstanceKlass* super = k->super();
 337   if (super != nullptr && check_for_exclusion(super, nullptr)) {
 338     ResourceMark rm;
 339     aot_log_warning(aot)("Skipping %s: super class %s is excluded", k->name()->as_C_string(), super->name()->as_C_string());

 641     // We sort the classes by their loaders. This way we're likely to archive
 642     // all classes in the one of the two hierarchies.
 643     _list.sort(compare_by_loader);
 644     for (int i = 0; i < _list.length(); i++) {
 645       InstanceKlass* k = _list.at(i);
 646       bool i_am_first = SystemDictionaryShared::add_unregistered_class(_thread, k);
 647       if (!i_am_first) {
 648         SystemDictionaryShared::warn_excluded(k, "Duplicated unregistered class");
 649         SystemDictionaryShared::set_excluded_locked(k);
 650       }
 651     }
 652   }
 653 };
 654 
 655 // Returns true if the class should be excluded. This can be called by
 656 // AOTConstantPoolResolver before or after we enter the CDS safepoint.
 657 // When called before the safepoint, we need to link the class so that
 658 // it can be checked by check_for_exclusion().
 659 bool SystemDictionaryShared::should_be_excluded(Klass* k) {
 660   assert(CDSConfig::is_dumping_archive(), "sanity");

 661 
 662   if (k->is_objArray_klass()) {
 663     return should_be_excluded(ObjArrayKlass::cast(k)->bottom_klass());
 664   }
 665 
 666   if (!k->is_instance_klass()) {
 667     return false;
 668   } else {
 669     InstanceKlass* ik = InstanceKlass::cast(k);
 670 
 671     if (CDSConfig::is_dumping_dynamic_archive() && ik->in_aot_cache()) {
 672       // ik is already part of the static archive, so it will never be considered as excluded.
 673       return false;
 674     }
 675 
 676     if (!SafepointSynchronize::is_at_safepoint() && !Thread::current()->is_Compiler_thread()) {
 677       if (!ik->is_linked()) {
 678         // check_for_exclusion() below doesn't link unlinked classes. We come
 679         // here only when we are trying to aot-link constant pool entries, so
 680         // we'd better link the class.
 681         JavaThread* THREAD = JavaThread::current();
 682         ik->link_class(THREAD);
 683         if (HAS_PENDING_EXCEPTION) {
 684           CLEAR_PENDING_EXCEPTION;
 685           return true; // linking failed -- let's exclude it
 686         }
 687       }
 688 
 689       MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
 690       DumpTimeClassInfo* p = get_info_locked(ik);
 691       if (p->is_excluded()) {
 692         return true;
 693       }
 694       return check_for_exclusion(ik, p);
 695     } else {
 696       // No need to check for is_linked() as all eligible classes should have

 778 
 779   if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
 780     LambdaProxyClassDictionary::dumptime_classes_do(it);
 781   }
 782 }
 783 
 784 // Called from VerificationType::is_reference_assignable_from() before performing the assignability check of
 785 //     T1 must be assignable from T2
 786 // Where:
 787 //     L is the class loader of <k>
 788 //     T1 is the type resolved by L using the name <name>
 789 //     T2 is the type resolved by L using the name <from_name>
 790 //
 791 // The meaning of (*skip_assignability_check):
 792 //     true:  is_reference_assignable_from() should SKIP the assignability check
 793 //     false: is_reference_assignable_from() should COMPLETE the assignability check
 794 void SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
 795          Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object,
 796          bool* skip_assignability_check) {
 797   assert(CDSConfig::is_dumping_archive(), "sanity");
 798   if (CDSConfig::is_dumping_dynamic_archive() && k->in_aot_cache()) {
 799     // k is a new class in the static archive, but one of its supertypes is an old class, so k wasn't
 800     // verified during dump time. No need to record constraints as k won't be included in the dynamic archive.
 801     return;
 802   }
 803   if (CDSConfig::is_dumping_aot_linked_classes() && is_builtin(k)) {
 804     // There's no need to save verification constraints
 805     // TODO -- double check the logic before integrating into mainline!!
 806     return;
 807   }
 808 
 809   DumpTimeClassInfo* info = get_info(k);
 810   info->add_verification_constraint(k, name, from_name, from_field_is_protected,
 811                                     from_is_array, from_is_object);
 812 
 813   if (CDSConfig::is_dumping_classic_static_archive() && !is_builtin(k)) {
 814     // This applies ONLY to the "classic" CDS static dump, which reads the list of
 815     // unregistered classes (those intended for custom class loaders) from the classlist
 816     // and loads them using jdk.internal.misc.CDS$UnregisteredClassLoader.
 817     //
 818     // When the classlist contains an unregistered class k, the supertypes of k are also
 819     // recorded in the classlist. However, the classlist does not contain information about
 820     // any class X that's not a supertype of k but is needed in the verification of k.
 821     // As a result, CDS$UnregisteredClassLoader will not know how to resolve X.
 822     //
 823     // Therefore, we tell the verifier to refrain from resolving X. Instead, X is recorded
 824     // (symbolically) in the verification constraints of k. In the production run,
 825     // when k is loaded, we will go through its verification constraints and resolve X to complete
 826     // the is_reference_assignable_from() checks.
 827     *skip_assignability_check = true;
 828   } else {

1255   print_shared_archive(st, false);
1256 }
1257 
1258 void SystemDictionaryShared::print_table_statistics(outputStream* st) {
1259   if (CDSConfig::is_using_archive()) {
1260     _static_archive.print_table_statistics("Static ", st, true);
1261     if (DynamicArchive::is_mapped()) {
1262       _dynamic_archive.print_table_statistics("Dynamic ", st, false);
1263     }
1264   }
1265 }
1266 
1267 bool SystemDictionaryShared::is_dumptime_table_empty() {
1268   assert_lock_strong(DumpTimeTable_lock);
1269   _dumptime_table->update_counts();
1270   if (_dumptime_table->count_of(true) == 0 && _dumptime_table->count_of(false) == 0){
1271     return true;
1272   }
1273   return false;
1274 }
1275 
1276 void SystemDictionaryShared::create_loader_positive_lookup_cache(TRAPS) {
1277   GrowableArray<InstanceKlass*> shared_classes_list;
1278   {
1279     // With static dumping, we have only a single Java thread (see JVM_StartThread) so
1280     // no no other threads should be loading classes. Otherwise, the code below may miss some
1281     // classes that are loaded concurrently.
1282     assert(CDSConfig::is_dumping_static_archive(), "no other threads should be loading classes");
1283 
1284     MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
1285     _dumptime_table->iterate_all_classes_in_builtin_loaders([&](InstanceKlass* k, DumpTimeClassInfo& info) {
1286         if (!k->is_hidden() && !check_for_exclusion(k, &info)) {
1287           shared_classes_list.append(k);
1288         }
1289       }
1290     );
1291   }
1292 
1293   InstanceKlass* ik = vmClasses::Class_klass();
1294   objArrayOop r = oopFactory::new_objArray(ik, shared_classes_list.length(), CHECK);
1295   objArrayHandle array_h(THREAD, r);
1296 
1297   for (int i = 0; i < shared_classes_list.length(); i++) {
1298     oop mirror = shared_classes_list.at(i)->java_mirror();
1299     Handle mirror_h(THREAD, mirror);
1300     array_h->obj_at_put(i, mirror_h());
1301   }
1302 
1303   TempNewSymbol method = SymbolTable::new_symbol("generatePositiveLookupCache");
1304   TempNewSymbol signature = SymbolTable::new_symbol("([Ljava/lang/Class;)V");
1305 
1306   JavaCallArguments args(Handle(THREAD, SystemDictionary::java_system_loader()));
1307   args.push_oop(array_h);
1308   JavaValue result(T_VOID);
1309   JavaCalls::call_virtual(&result,
1310                           vmClasses::jdk_internal_loader_ClassLoaders_AppClassLoader_klass(),
1311                           method,
1312                           signature,
1313                           &args,
1314                           CHECK);
1315 
1316   if (HAS_PENDING_EXCEPTION) {
1317     Handle exc_handle(THREAD, PENDING_EXCEPTION);
1318     CLEAR_PENDING_EXCEPTION;
1319     ResourceMark rm(THREAD);
1320 
1321     log_warning(cds)("Exception during AppClassLoader::generatePositiveLookupCache() call");
1322     LogStreamHandle(Debug, cds) log;
1323     if (log.is_enabled()) {
1324       java_lang_Throwable::print_stack_trace(exc_handle, &log);
1325     }
1326     return;
1327   }
1328 }
< prev index next >