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;)
88
89 #ifdef ASSERT
90 static void check_klass_after_loading(const Klass* k) {
91 #ifdef _LP64
92 if (k != nullptr && UseCompressedClassPointers) {
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()) ||
833 // in both hierarchies, causing most of the classes to be excluded.
834 // We sort the classes by their loaders. This way we're likely to archive
835 // all classes in the one of the two hierarchies.
836 _list.sort(compare_by_loader);
837 for (int i = 0; i < _list.length(); i++) {
838 InstanceKlass* k = _list.at(i);
839 bool i_am_first = SystemDictionaryShared::add_unregistered_class(_thread, k);
840 if (!i_am_first) {
841 SystemDictionaryShared::warn_excluded(k, "Duplicated unregistered class");
842 SystemDictionaryShared::set_excluded_locked(k);
843 }
844 }
845 }
846 };
847
848 // Returns true if the class should be excluded. This can be called by
849 // AOTConstantPoolResolver before or after we enter the CDS safepoint.
850 // When called before the safepoint, we need to link the class so that
851 // it can be checked by should_be_excluded_impl().
852 bool SystemDictionaryShared::should_be_excluded(Klass* k) {
853 assert(CDSConfig::is_dumping_archive(), "sanity");
854 assert(CDSConfig::current_thread_is_vm_or_dumper(), "sanity");
855
856 if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache(k)) {
857 // We have reached a super type that's already in the base archive. Treat it
858 // as "not excluded".
859 return false;
860 }
861
862 if (k->is_objArray_klass()) {
863 return should_be_excluded(ObjArrayKlass::cast(k)->bottom_klass());
864 } else if (!k->is_instance_klass()) {
865 assert(k->is_typeArray_klass(), "must be");
866 return false;
867 } else {
868 InstanceKlass* ik = InstanceKlass::cast(k);
869
870 if (!SafepointSynchronize::is_at_safepoint()) {
871 if (!ik->is_linked()) {
872 // should_be_excluded_impl() below doesn't link unlinked classes. We come
873 // here only when we are trying to aot-link constant pool entries, so
874 // we'd better link the class.
875 JavaThread* THREAD = JavaThread::current();
876 ik->link_class(THREAD);
877 if (HAS_PENDING_EXCEPTION) {
878 CLEAR_PENDING_EXCEPTION;
879 return true; // linking failed -- let's exclude it
880 }
881
882 // Also link any classes that were loaded for the verification of ik or its supertypes.
883 // Otherwise we might miss the verification constraints of those classes.
884 AOTMetaspace::link_all_loaded_classes(THREAD);
885 }
886
887 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
888 DumpTimeClassInfo* p = get_info_locked(ik);
889 if (p->is_excluded()) {
914
915 void SystemDictionaryShared::finish_exclusion_checks() {
916 assert_at_safepoint();
917 if (CDSConfig::is_dumping_dynamic_archive() || CDSConfig::is_dumping_preimage_static_archive()) {
918 // Do this first -- if a base class is excluded due to duplication,
919 // all of its subclasses will also be excluded.
920 ResourceMark rm;
921 UnregisteredClassesDuplicationChecker dup_checker;
922 _dumptime_table->iterate_all_live_classes(&dup_checker);
923 dup_checker.mark_duplicated_classes();
924 }
925
926 _dumptime_table->iterate_all_live_classes([&] (InstanceKlass* k, DumpTimeClassInfo& info) {
927 SystemDictionaryShared::should_be_excluded_impl(k, &info);
928 });
929
930 _dumptime_table->update_counts();
931 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
932 LambdaProxyClassDictionary::cleanup_dumptime_table();
933 }
934 }
935
936 bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) {
937 assert(!class_loading_may_happen(), "class loading must be disabled");
938 assert_lock_strong(DumpTimeTable_lock);
939 assert(CDSConfig::is_dumping_archive(), "sanity");
940 DumpTimeClassInfo* p = get_info_locked(k);
941 return p->is_excluded();
942 }
943
944 void SystemDictionaryShared::set_excluded_locked(InstanceKlass* k) {
945 assert_lock_strong(DumpTimeTable_lock);
946 assert(CDSConfig::is_dumping_archive(), "sanity");
947 DumpTimeClassInfo* info = get_info_locked(k);
948 info->set_excluded();
949 }
950
951 void SystemDictionaryShared::set_excluded(InstanceKlass* k) {
952 assert(CDSConfig::is_dumping_archive(), "sanity");
953 DumpTimeClassInfo* info = get_info(k);
986
987 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
988 LambdaProxyClassDictionary::dumptime_classes_do(it);
989 }
990 }
991
992 // Called from VerificationType::is_reference_assignable_from() before performing the assignability check of
993 // T1 must be assignable from T2
994 // Where:
995 // L is the class loader of <k>
996 // T1 is the type resolved by L using the name <name>
997 // T2 is the type resolved by L using the name <from_name>
998 //
999 // The meaning of (*skip_assignability_check):
1000 // true: is_reference_assignable_from() should SKIP the assignability check
1001 // false: is_reference_assignable_from() should COMPLETE the assignability check
1002 void SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
1003 Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object,
1004 bool* skip_assignability_check) {
1005 assert(CDSConfig::is_dumping_archive(), "sanity");
1006 DumpTimeClassInfo* info = get_info(k);
1007 info->add_verification_constraint(name, from_name, from_field_is_protected,
1008 from_is_array, from_is_object);
1009
1010 if (CDSConfig::is_dumping_classic_static_archive() && !is_builtin(k)) {
1011 // This applies ONLY to the "classic" CDS static dump, which reads the list of
1012 // unregistered classes (those intended for custom class loaders) from the classlist
1013 // and loads them using jdk.internal.misc.CDS$UnregisteredClassLoader.
1014 //
1015 // When the classlist contains an unregistered class k, the supertypes of k are also
1016 // recorded in the classlist. However, the classlist does not contain information about
1017 // any class X that's not a supertype of k but is needed in the verification of k.
1018 // As a result, CDS$UnregisteredClassLoader will not know how to resolve X.
1019 //
1020 // Therefore, we tell the verifier to refrain from resolving X. Instead, X is recorded
1021 // (symbolically) in the verification constraints of k. In the production run,
1022 // when k is loaded, we will go through its verification constraints and resolve X to complete
1023 // the is_reference_assignable_from() checks.
1024 *skip_assignability_check = true;
1025 } else {
1468 print_shared_archive(st, false);
1469 }
1470
1471 void SystemDictionaryShared::print_table_statistics(outputStream* st) {
1472 if (CDSConfig::is_using_archive()) {
1473 _static_archive.print_table_statistics("Static ", st, true);
1474 if (DynamicArchive::is_mapped()) {
1475 _dynamic_archive.print_table_statistics("Dynamic ", st, false);
1476 }
1477 }
1478 }
1479
1480 bool SystemDictionaryShared::is_dumptime_table_empty() {
1481 assert_lock_strong(DumpTimeTable_lock);
1482 _dumptime_table->update_counts();
1483 if (_dumptime_table->count_of(true) == 0 && _dumptime_table->count_of(false) == 0){
1484 return true;
1485 }
1486 return false;
1487 }
|
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 bool SystemDictionaryShared::_finished_exclusion_checks = false;
87
88 // Used by NoClassLoadingMark
89 DEBUG_ONLY(bool SystemDictionaryShared::_class_loading_may_happen = true;)
90
91 #ifdef ASSERT
92 static void check_klass_after_loading(const Klass* k) {
93 #ifdef _LP64
94 if (k != nullptr && UseCompressedClassPointers) {
95 CompressedKlassPointers::check_encodable(k);
96 }
97 #endif
98 }
99 #endif
100
101 InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
102 Symbol* class_name, Handle class_loader, TRAPS) {
103 assert(CDSConfig::is_using_archive(), "must be");
104 InstanceKlass* ik = find_builtin_class(class_name);
105
106 if (ik != nullptr && !ik->shared_loading_failed()) {
107 if ((SystemDictionary::is_system_class_loader(class_loader()) && ik->defined_by_app_loader()) ||
108 (SystemDictionary::is_platform_class_loader(class_loader()) && ik->defined_by_platform_loader())) {
109 SharedClassLoadingMark slm(THREAD, ik);
110 PackageEntry* pkg_entry = CDSProtectionDomain::get_package_entry_from_class(ik, class_loader);
111 Handle protection_domain;
112 if (!class_name->starts_with("jdk/proxy")) // java/lang/reflect/Proxy$ProxyBuilder defines the proxy classes with a null protection domain.
113 {
114 protection_domain = CDSProtectionDomain::init_security_info(class_loader, ik, pkg_entry, CHECK_NULL);
115 }
116 return load_shared_class(ik, class_loader, protection_domain, nullptr, pkg_entry, THREAD);
117 }
118 }
119 return nullptr;
120 }
121
122 // This function is called for loading only UNREGISTERED classes
123 InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
124 Handle class_loader,
125 Handle protection_domain,
126 const ClassFileStream* cfs,
127 TRAPS) {
128 if (!CDSConfig::is_using_archive()) {
129 return nullptr;
130 }
131 if (class_name == nullptr) { // don't do this for hidden classes
132 return nullptr;
133 }
134 if (class_loader.is_null() ||
135 SystemDictionary::is_system_class_loader(class_loader()) ||
838 // in both hierarchies, causing most of the classes to be excluded.
839 // We sort the classes by their loaders. This way we're likely to archive
840 // all classes in the one of the two hierarchies.
841 _list.sort(compare_by_loader);
842 for (int i = 0; i < _list.length(); i++) {
843 InstanceKlass* k = _list.at(i);
844 bool i_am_first = SystemDictionaryShared::add_unregistered_class(_thread, k);
845 if (!i_am_first) {
846 SystemDictionaryShared::warn_excluded(k, "Duplicated unregistered class");
847 SystemDictionaryShared::set_excluded_locked(k);
848 }
849 }
850 }
851 };
852
853 // Returns true if the class should be excluded. This can be called by
854 // AOTConstantPoolResolver before or after we enter the CDS safepoint.
855 // When called before the safepoint, we need to link the class so that
856 // it can be checked by should_be_excluded_impl().
857 bool SystemDictionaryShared::should_be_excluded(Klass* k) {
858 if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache(k)) {
859 // We have reached a super type that's already in the base archive. Treat it
860 // as "not excluded".
861 return false;
862 }
863
864 if (k->is_objArray_klass()) {
865 return should_be_excluded(ObjArrayKlass::cast(k)->bottom_klass());
866 } else if (!k->is_instance_klass()) {
867 assert(k->is_typeArray_klass(), "must be");
868 return false;
869 } else {
870 InstanceKlass* ik = InstanceKlass::cast(k);
871
872 if (CDSConfig::is_dumping_final_static_archive() && _finished_exclusion_checks &&
873 !SafepointSynchronize::is_at_safepoint()) {
874 // This is called from the AOT compiler.
875 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
876 DumpTimeClassInfo* p = get_info_locked(ik);
877 if (p->is_excluded()) {
878 return true;
879 } else if (!p->has_checked_exclusion()) {
880 // This is a class that was loaded after we exited the AOT safepoint. This
881 // class is not in the AOT cache, so it must be considered as "excluded"
882 return true;
883 } else {
884 return false;
885 }
886 }
887
888 assert(CDSConfig::is_dumping_archive(), "sanity");
889 assert(CDSConfig::current_thread_is_vm_or_dumper(), "sanity");
890
891 if (!SafepointSynchronize::is_at_safepoint()) {
892 if (!ik->is_linked()) {
893 // should_be_excluded_impl() below doesn't link unlinked classes. We come
894 // here only when we are trying to aot-link constant pool entries, so
895 // we'd better link the class.
896 JavaThread* THREAD = JavaThread::current();
897 ik->link_class(THREAD);
898 if (HAS_PENDING_EXCEPTION) {
899 CLEAR_PENDING_EXCEPTION;
900 return true; // linking failed -- let's exclude it
901 }
902
903 // Also link any classes that were loaded for the verification of ik or its supertypes.
904 // Otherwise we might miss the verification constraints of those classes.
905 AOTMetaspace::link_all_loaded_classes(THREAD);
906 }
907
908 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
909 DumpTimeClassInfo* p = get_info_locked(ik);
910 if (p->is_excluded()) {
935
936 void SystemDictionaryShared::finish_exclusion_checks() {
937 assert_at_safepoint();
938 if (CDSConfig::is_dumping_dynamic_archive() || CDSConfig::is_dumping_preimage_static_archive()) {
939 // Do this first -- if a base class is excluded due to duplication,
940 // all of its subclasses will also be excluded.
941 ResourceMark rm;
942 UnregisteredClassesDuplicationChecker dup_checker;
943 _dumptime_table->iterate_all_live_classes(&dup_checker);
944 dup_checker.mark_duplicated_classes();
945 }
946
947 _dumptime_table->iterate_all_live_classes([&] (InstanceKlass* k, DumpTimeClassInfo& info) {
948 SystemDictionaryShared::should_be_excluded_impl(k, &info);
949 });
950
951 _dumptime_table->update_counts();
952 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
953 LambdaProxyClassDictionary::cleanup_dumptime_table();
954 }
955 _finished_exclusion_checks = true;
956 }
957
958 bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) {
959 assert(!class_loading_may_happen(), "class loading must be disabled");
960 assert_lock_strong(DumpTimeTable_lock);
961 assert(CDSConfig::is_dumping_archive(), "sanity");
962 DumpTimeClassInfo* p = get_info_locked(k);
963 return p->is_excluded();
964 }
965
966 void SystemDictionaryShared::set_excluded_locked(InstanceKlass* k) {
967 assert_lock_strong(DumpTimeTable_lock);
968 assert(CDSConfig::is_dumping_archive(), "sanity");
969 DumpTimeClassInfo* info = get_info_locked(k);
970 info->set_excluded();
971 }
972
973 void SystemDictionaryShared::set_excluded(InstanceKlass* k) {
974 assert(CDSConfig::is_dumping_archive(), "sanity");
975 DumpTimeClassInfo* info = get_info(k);
1008
1009 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
1010 LambdaProxyClassDictionary::dumptime_classes_do(it);
1011 }
1012 }
1013
1014 // Called from VerificationType::is_reference_assignable_from() before performing the assignability check of
1015 // T1 must be assignable from T2
1016 // Where:
1017 // L is the class loader of <k>
1018 // T1 is the type resolved by L using the name <name>
1019 // T2 is the type resolved by L using the name <from_name>
1020 //
1021 // The meaning of (*skip_assignability_check):
1022 // true: is_reference_assignable_from() should SKIP the assignability check
1023 // false: is_reference_assignable_from() should COMPLETE the assignability check
1024 void SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
1025 Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object,
1026 bool* skip_assignability_check) {
1027 assert(CDSConfig::is_dumping_archive(), "sanity");
1028 if (CDSConfig::is_dumping_dynamic_archive() && k->in_aot_cache()) {
1029 // k is a new class in the static archive, but one of its supertypes is an old class, so k wasn't
1030 // verified during dump time. No need to record constraints as k won't be included in the dynamic archive.
1031 return;
1032 }
1033 if (CDSConfig::is_dumping_aot_linked_classes() && is_builtin(k)) {
1034 // There's no need to save verification constraints
1035 // TODO -- double check the logic before integrating into mainline!!
1036 return;
1037 }
1038
1039 DumpTimeClassInfo* info = get_info(k);
1040 info->add_verification_constraint(name, from_name, from_field_is_protected,
1041 from_is_array, from_is_object);
1042
1043 if (CDSConfig::is_dumping_classic_static_archive() && !is_builtin(k)) {
1044 // This applies ONLY to the "classic" CDS static dump, which reads the list of
1045 // unregistered classes (those intended for custom class loaders) from the classlist
1046 // and loads them using jdk.internal.misc.CDS$UnregisteredClassLoader.
1047 //
1048 // When the classlist contains an unregistered class k, the supertypes of k are also
1049 // recorded in the classlist. However, the classlist does not contain information about
1050 // any class X that's not a supertype of k but is needed in the verification of k.
1051 // As a result, CDS$UnregisteredClassLoader will not know how to resolve X.
1052 //
1053 // Therefore, we tell the verifier to refrain from resolving X. Instead, X is recorded
1054 // (symbolically) in the verification constraints of k. In the production run,
1055 // when k is loaded, we will go through its verification constraints and resolve X to complete
1056 // the is_reference_assignable_from() checks.
1057 *skip_assignability_check = true;
1058 } else {
1501 print_shared_archive(st, false);
1502 }
1503
1504 void SystemDictionaryShared::print_table_statistics(outputStream* st) {
1505 if (CDSConfig::is_using_archive()) {
1506 _static_archive.print_table_statistics("Static ", st, true);
1507 if (DynamicArchive::is_mapped()) {
1508 _dynamic_archive.print_table_statistics("Dynamic ", st, false);
1509 }
1510 }
1511 }
1512
1513 bool SystemDictionaryShared::is_dumptime_table_empty() {
1514 assert_lock_strong(DumpTimeTable_lock);
1515 _dumptime_table->update_counts();
1516 if (_dumptime_table->count_of(true) == 0 && _dumptime_table->count_of(false) == 0){
1517 return true;
1518 }
1519 return false;
1520 }
1521
1522 void SystemDictionaryShared::create_loader_positive_lookup_cache(TRAPS) {
1523 GrowableArray<InstanceKlass*> shared_classes_list;
1524 {
1525 // With static dumping, we have only a single Java thread (see JVM_StartThread) so
1526 // no no other threads should be loading classes. Otherwise, the code below may miss some
1527 // classes that are loaded concurrently.
1528 assert(CDSConfig::is_dumping_static_archive(), "no other threads should be loading classes");
1529
1530 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
1531 _dumptime_table->iterate_all_classes_in_builtin_loaders([&](InstanceKlass* k, DumpTimeClassInfo& info) {
1532 // FIXME -- this may not be correct before SystemDictionaryShared::finish_exclusion_checks()
1533 if (!k->is_hidden() && info.has_checked_exclusion() && !info.is_excluded()) {
1534 shared_classes_list.append(k);
1535 }
1536 }
1537 );
1538 }
1539
1540 InstanceKlass* ik = vmClasses::Class_klass();
1541 objArrayOop r = oopFactory::new_objArray(ik, shared_classes_list.length(), CHECK);
1542 objArrayHandle array_h(THREAD, r);
1543
1544 for (int i = 0; i < shared_classes_list.length(); i++) {
1545 oop mirror = shared_classes_list.at(i)->java_mirror();
1546 Handle mirror_h(THREAD, mirror);
1547 array_h->obj_at_put(i, mirror_h());
1548 }
1549
1550 TempNewSymbol method = SymbolTable::new_symbol("generatePositiveLookupCache");
1551 TempNewSymbol signature = SymbolTable::new_symbol("([Ljava/lang/Class;)V");
1552
1553 JavaCallArguments args(Handle(THREAD, SystemDictionary::java_system_loader()));
1554 args.push_oop(array_h);
1555 JavaValue result(T_VOID);
1556 JavaCalls::call_virtual(&result,
1557 vmClasses::jdk_internal_loader_ClassLoaders_AppClassLoader_klass(),
1558 method,
1559 signature,
1560 &args,
1561 CHECK);
1562
1563 if (HAS_PENDING_EXCEPTION) {
1564 Handle exc_handle(THREAD, PENDING_EXCEPTION);
1565 CLEAR_PENDING_EXCEPTION;
1566 ResourceMark rm(THREAD);
1567
1568 log_warning(cds)("Exception during AppClassLoader::generatePositiveLookupCache() call");
1569 LogStreamHandle(Debug, cds) log;
1570 if (log.is_enabled()) {
1571 java_lang_Throwable::print_stack_trace(exc_handle, &log);
1572 }
1573 return;
1574 }
1575 }
|