< prev index next >

src/hotspot/share/classfile/systemDictionaryShared.cpp

Print this page

  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "cds/aotClassFilter.hpp"
  26 #include "cds/aotClassLocation.hpp"
  27 #include "cds/aotLogging.hpp"
  28 #include "cds/archiveBuilder.hpp"
  29 #include "cds/archiveUtils.hpp"
  30 #include "cds/cdsConfig.hpp"
  31 #include "cds/cdsProtectionDomain.hpp"
  32 #include "cds/classListParser.hpp"
  33 #include "cds/classListWriter.hpp"
  34 #include "cds/dumpTimeClassInfo.inline.hpp"
  35 #include "cds/dynamicArchive.hpp"
  36 #include "cds/filemap.hpp"
  37 #include "cds/heapShared.hpp"

  38 #include "cds/lambdaProxyClassDictionary.hpp"
  39 #include "cds/lambdaFormInvokers.inline.hpp"
  40 #include "cds/metaspaceShared.hpp"
  41 #include "cds/runTimeClassInfo.hpp"
  42 #include "cds/unregisteredClasses.hpp"
  43 #include "classfile/classFileStream.hpp"
  44 #include "classfile/classLoader.hpp"
  45 #include "classfile/classLoaderData.inline.hpp"
  46 #include "classfile/classLoaderDataGraph.hpp"
  47 #include "classfile/classLoaderExt.hpp"
  48 #include "classfile/dictionary.hpp"
  49 #include "classfile/javaClasses.hpp"
  50 #include "classfile/javaClasses.inline.hpp"
  51 #include "classfile/symbolTable.hpp"
  52 #include "classfile/systemDictionary.hpp"
  53 #include "classfile/systemDictionaryShared.hpp"
  54 #include "classfile/verificationType.hpp"
  55 #include "classfile/vmClasses.hpp"
  56 #include "classfile/vmSymbols.hpp"
  57 #include "jfr/jfrEvents.hpp"
  58 #include "logging/log.hpp"
  59 #include "logging/logStream.hpp"
  60 #include "memory/allocation.hpp"
  61 #include "memory/metadataFactory.hpp"
  62 #include "memory/metaspaceClosure.hpp"
  63 #include "memory/oopFactory.hpp"
  64 #include "memory/resourceArea.hpp"
  65 #include "memory/universe.hpp"
  66 #include "oops/compressedKlass.inline.hpp"
  67 #include "oops/instanceKlass.hpp"
  68 #include "oops/klass.inline.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/resourceHash.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         CDSProtectionDomain::init_security_info(class_loader, ik, pkg_entry, CHECK_NULL);



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

 277         aot_log_info(aot)("Skipping %s because it is dynamically generated", k->name()->as_C_string());
 278         return true; // exclude without warning
 279       }
 280     } else {
 281       // These are classes loaded from unsupported locations (such as those loaded by JVMTI native
 282       // agent during dump time).
 283       return warn_excluded(k, "Unsupported location");
 284     }
 285   }
 286   if (k->signers() != nullptr) {
 287     // We cannot include signed classes in the archive because the certificates
 288     // used during dump time may be different than those used during
 289     // runtime (due to expiration, etc).
 290     return warn_excluded(k, "Signed JAR");
 291   }
 292   if (is_jfr_event_class(k)) {
 293     // We cannot include JFR event classes because they need runtime-specific
 294     // instrumentation in order to work with -XX:FlightRecorderOptions:retransform=false.
 295     // There are only a small number of these classes, so it's not worthwhile to
 296     // support them and make CDS more complicated.
 297     return warn_excluded(k, "JFR event class");


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

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











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

1229   print_shared_archive(st, false);
1230 }
1231 
1232 void SystemDictionaryShared::print_table_statistics(outputStream* st) {
1233   if (CDSConfig::is_using_archive()) {
1234     _static_archive.print_table_statistics("Static ", st, true);
1235     if (DynamicArchive::is_mapped()) {
1236       _dynamic_archive.print_table_statistics("Dynamic ", st, false);
1237     }
1238   }
1239 }
1240 
1241 bool SystemDictionaryShared::is_dumptime_table_empty() {
1242   assert_lock_strong(DumpTimeTable_lock);
1243   _dumptime_table->update_counts();
1244   if (_dumptime_table->count_of(true) == 0 && _dumptime_table->count_of(false) == 0){
1245     return true;
1246   }
1247   return false;
1248 }























































  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "cds/aotClassFilter.hpp"
  26 #include "cds/aotClassLocation.hpp"
  27 #include "cds/aotLogging.hpp"
  28 #include "cds/archiveBuilder.hpp"
  29 #include "cds/archiveUtils.hpp"
  30 #include "cds/cdsConfig.hpp"
  31 #include "cds/cdsProtectionDomain.hpp"
  32 #include "cds/classListParser.hpp"
  33 #include "cds/classListWriter.hpp"
  34 #include "cds/dumpTimeClassInfo.inline.hpp"
  35 #include "cds/dynamicArchive.hpp"
  36 #include "cds/filemap.hpp"
  37 #include "cds/heapShared.hpp"
  38 #include "cds/lambdaFormInvokers.inline.hpp"
  39 #include "cds/lambdaProxyClassDictionary.hpp"
  40 #include "cds/lambdaFormInvokers.inline.hpp"
  41 #include "cds/metaspaceShared.hpp"
  42 #include "cds/runTimeClassInfo.hpp"
  43 #include "cds/unregisteredClasses.hpp"
  44 #include "classfile/classFileStream.hpp"
  45 #include "classfile/classLoader.hpp"
  46 #include "classfile/classLoaderData.inline.hpp"
  47 #include "classfile/classLoaderDataGraph.hpp"
  48 #include "classfile/classLoaderExt.hpp"
  49 #include "classfile/dictionary.hpp"
  50 #include "classfile/javaClasses.hpp"
  51 #include "classfile/javaClasses.inline.hpp"
  52 #include "classfile/symbolTable.hpp"
  53 #include "classfile/systemDictionary.hpp"
  54 #include "classfile/systemDictionaryShared.hpp"
  55 #include "classfile/verificationType.hpp"
  56 #include "classfile/vmClasses.hpp"
  57 #include "classfile/vmSymbols.hpp"
  58 #include "jfr/jfrEvents.hpp"
  59 #include "logging/log.hpp"
  60 #include "logging/logStream.hpp"
  61 #include "memory/allocation.hpp"
  62 #include "memory/metadataFactory.hpp"
  63 #include "memory/metaspaceClosure.hpp"
  64 #include "memory/oopFactory.hpp"
  65 #include "memory/resourceArea.hpp"
  66 #include "memory/universe.hpp"
  67 #include "oops/compressedKlass.inline.hpp"
  68 #include "oops/instanceKlass.hpp"
  69 #include "oops/klass.inline.hpp"
  70 #include "oops/methodData.hpp"
  71 #include "oops/objArrayKlass.hpp"
  72 #include "oops/objArrayOop.inline.hpp"
  73 #include "oops/oop.inline.hpp"
  74 #include "oops/oopHandle.inline.hpp"
  75 #include "oops/typeArrayOop.inline.hpp"
  76 #include "runtime/arguments.hpp"
  77 #include "runtime/handles.inline.hpp"
  78 #include "runtime/java.hpp"
  79 #include "runtime/javaCalls.hpp"
  80 #include "runtime/mutexLocker.hpp"
  81 #include "utilities/resourceHash.hpp"
  82 #include "utilities/stringUtils.hpp"
  83 
  84 SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_static_archive;
  85 SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_dynamic_archive;
  86 
  87 DumpTimeSharedClassTable* SystemDictionaryShared::_dumptime_table = nullptr;
  88 
  89 // Used by NoClassLoadingMark
  90 DEBUG_ONLY(bool SystemDictionaryShared::_class_loading_may_happen = true;)

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

 282         aot_log_info(aot)("Skipping %s because it is dynamically generated", k->name()->as_C_string());
 283         return true; // exclude without warning
 284       }
 285     } else {
 286       // These are classes loaded from unsupported locations (such as those loaded by JVMTI native
 287       // agent during dump time).
 288       return warn_excluded(k, "Unsupported location");
 289     }
 290   }
 291   if (k->signers() != nullptr) {
 292     // We cannot include signed classes in the archive because the certificates
 293     // used during dump time may be different than those used during
 294     // runtime (due to expiration, etc).
 295     return warn_excluded(k, "Signed JAR");
 296   }
 297   if (is_jfr_event_class(k)) {
 298     // We cannot include JFR event classes because they need runtime-specific
 299     // instrumentation in order to work with -XX:FlightRecorderOptions:retransform=false.
 300     // There are only a small number of these classes, so it's not worthwhile to
 301     // support them and make CDS more complicated.
 302     if (!CDSConfig::is_dumping_reflection_data()) { // FIXME: !!! HACK !!!
 303       return warn_excluded(k, "JFR event class");
 304     }
 305   }
 306 
 307   if (!k->is_linked()) {
 308     if (has_class_failed_verification(k)) {
 309       return warn_excluded(k, "Failed verification");
 310     } else if (CDSConfig::is_dumping_aot_linked_classes()) {
 311       // Most loaded classes should have been speculatively linked by MetaspaceShared::link_class_for_cds().
 312       // However, we do not speculatively link old classes, as they are not recorded by
 313       // SystemDictionaryShared::record_linking_constraint(). As a result, such an unlinked
 314       // class may fail to verify in AOTLinkedClassBulkLoader::init_required_classes_for_loader(),
 315       // causing the JVM to fail at bootstrap.
 316       return warn_excluded(k, "Unlinked class not supported by AOTClassLinking");
 317     } else if (CDSConfig::is_dumping_preimage_static_archive()) {
 318       // When dumping the final static archive, we will unconditionally load and link all
 319       // classes from the preimage. We don't want to get a VerifyError when linking this class.
 320       return warn_excluded(k, "Unlinked class not supported by AOTConfiguration");
 321     }
 322   } else {
 323     if (!k->can_be_verified_at_dumptime() && !CDSConfig::preserve_all_dumptime_verification_states(k)) {
 324       // We have an old class that has been linked (e.g., it's been executed during
 325       // dump time). This class has been verified using the old verifier, which
 326       // doesn't save the verification constraints, so check_verification_constraints()
 327       // won't work at runtime.
 328       // As a result, we cannot store this class. It must be loaded and fully verified
 329       // at runtime.
 330       return warn_excluded(k, "Old class has been linked");
 331     }
 332   }
 333 
 334   if (UnregisteredClasses::check_for_exclusion(k)) {
 335     ResourceMark rm;
 336     aot_log_info(aot)("Skipping %s: used only when dumping CDS archive", k->name()->as_C_string());
 337     return true;
 338   }
 339 
 340   InstanceKlass* super = k->java_super();
 341   if (super != nullptr && check_for_exclusion(super, nullptr)) {
 342     ResourceMark rm;
 343     aot_log_warning(aot)("Skipping %s: super class %s is excluded", k->name()->as_C_string(), super->name()->as_C_string());

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

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