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()) ||
865 if (!k->is_linked()) {
866 need_to_link = true;
867 }
868 });
869 }
870 if (need_to_link) {
871 JavaThread* THREAD = JavaThread::current();
872 if (log_is_enabled(Info, aot, link)) {
873 ResourceMark rm(THREAD);
874 log_info(aot, link)("Link all loaded classes for %s", ik->external_name());
875 }
876 AOTMetaspace::link_all_loaded_classes(THREAD);
877 }
878 }
879
880 // Returns true if the class should be excluded. This can be called by
881 // AOTConstantPoolResolver before or after we enter the CDS safepoint.
882 // When called before the safepoint, we need to link the class so that
883 // it can be checked by should_be_excluded_impl().
884 bool SystemDictionaryShared::should_be_excluded(Klass* k) {
885 assert(CDSConfig::is_dumping_archive(), "sanity");
886 assert(CDSConfig::current_thread_is_vm_or_dumper(), "sanity");
887
888 if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache(k)) {
889 // We have reached a super type that's already in the base archive. Treat it
890 // as "not excluded".
891 return false;
892 }
893
894 if (k->is_objArray_klass()) {
895 return should_be_excluded(ObjArrayKlass::cast(k)->bottom_klass());
896 } else if (!k->is_instance_klass()) {
897 assert(k->is_typeArray_klass(), "must be");
898 return false;
899 } else {
900 InstanceKlass* ik = InstanceKlass::cast(k);
901
902 if (!SafepointSynchronize::is_at_safepoint()) {
903 {
904 // fast path
905 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
906 DumpTimeClassInfo* p = get_info_locked(ik);
907 if (p->has_checked_exclusion()) {
908 return p->is_excluded();
909 }
910 }
911
912 link_all_exclusion_check_candidates(ik);
913
914 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
915 DumpTimeClassInfo* p = get_info_locked(ik);
916 return should_be_excluded_impl(ik, p);
917 } else {
918 // When called within the CDS safepoint, the correctness of this function
919 // relies on the call to AOTMetaspace::link_all_loaded_classes()
920 // that happened right before we enter the CDS safepoint.
921 //
938
939 void SystemDictionaryShared::finish_exclusion_checks() {
940 assert_at_safepoint();
941 if (CDSConfig::is_dumping_dynamic_archive() || CDSConfig::is_dumping_preimage_static_archive()) {
942 // Do this first -- if a base class is excluded due to duplication,
943 // all of its subclasses will also be excluded.
944 ResourceMark rm;
945 UnregisteredClassesDuplicationChecker dup_checker;
946 _dumptime_table->iterate_all_live_classes(&dup_checker);
947 dup_checker.mark_duplicated_classes();
948 }
949
950 _dumptime_table->iterate_all_live_classes([&] (InstanceKlass* k, DumpTimeClassInfo& info) {
951 SystemDictionaryShared::should_be_excluded_impl(k, &info);
952 });
953
954 _dumptime_table->update_counts();
955 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
956 LambdaProxyClassDictionary::cleanup_dumptime_table();
957 }
958 }
959
960 bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) {
961 assert(!class_loading_may_happen(), "class loading must be disabled");
962 assert_lock_strong(DumpTimeTable_lock);
963 assert(CDSConfig::is_dumping_archive(), "sanity");
964 DumpTimeClassInfo* p = get_info_locked(k);
965 return p->is_excluded();
966 }
967
968 void SystemDictionaryShared::set_excluded_locked(InstanceKlass* k) {
969 assert_lock_strong(DumpTimeTable_lock);
970 assert(CDSConfig::is_dumping_archive(), "sanity");
971 DumpTimeClassInfo* info = get_info_locked(k);
972 info->set_excluded();
973 }
974
975 void SystemDictionaryShared::set_excluded(InstanceKlass* k) {
976 assert(CDSConfig::is_dumping_archive(), "sanity");
977 DumpTimeClassInfo* info = get_info(k);
1010
1011 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
1012 LambdaProxyClassDictionary::dumptime_classes_do(it);
1013 }
1014 }
1015
1016 // Called from VerificationType::is_reference_assignable_from() before performing the assignability check of
1017 // T1 must be assignable from T2
1018 // Where:
1019 // L is the class loader of <k>
1020 // T1 is the type resolved by L using the name <name>
1021 // T2 is the type resolved by L using the name <from_name>
1022 //
1023 // The meaning of (*skip_assignability_check):
1024 // true: is_reference_assignable_from() should SKIP the assignability check
1025 // false: is_reference_assignable_from() should COMPLETE the assignability check
1026 void SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
1027 Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object,
1028 bool* skip_assignability_check) {
1029 assert(CDSConfig::is_dumping_archive(), "sanity");
1030 DumpTimeClassInfo* info = get_info(k);
1031 info->add_verification_constraint(name, from_name, from_field_is_protected,
1032 from_is_array, from_is_object);
1033
1034 if (CDSConfig::is_dumping_classic_static_archive() && !is_builtin(k)) {
1035 // This applies ONLY to the "classic" CDS static dump, which reads the list of
1036 // unregistered classes (those intended for custom class loaders) from the classlist
1037 // and loads them using jdk.internal.misc.CDS$UnregisteredClassLoader.
1038 //
1039 // When the classlist contains an unregistered class k, the supertypes of k are also
1040 // recorded in the classlist. However, the classlist does not contain information about
1041 // any class X that's not a supertype of k but is needed in the verification of k.
1042 // As a result, CDS$UnregisteredClassLoader will not know how to resolve X.
1043 //
1044 // Therefore, we tell the verifier to refrain from resolving X. Instead, X is recorded
1045 // (symbolically) in the verification constraints of k. In the production run,
1046 // when k is loaded, we will go through its verification constraints and resolve X to complete
1047 // the is_reference_assignable_from() checks.
1048 *skip_assignability_check = true;
1049 } else {
1496 print_shared_archive(st, false);
1497 }
1498
1499 void SystemDictionaryShared::print_table_statistics(outputStream* st) {
1500 if (CDSConfig::is_using_archive()) {
1501 _static_archive.print_table_statistics("Static ", st, true);
1502 if (DynamicArchive::is_mapped()) {
1503 _dynamic_archive.print_table_statistics("Dynamic ", st, false);
1504 }
1505 }
1506 }
1507
1508 bool SystemDictionaryShared::is_dumptime_table_empty() {
1509 assert_lock_strong(DumpTimeTable_lock);
1510 _dumptime_table->update_counts();
1511 if (_dumptime_table->count_of(true) == 0 && _dumptime_table->count_of(false) == 0){
1512 return true;
1513 }
1514 return false;
1515 }
|
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()) ||
870 if (!k->is_linked()) {
871 need_to_link = true;
872 }
873 });
874 }
875 if (need_to_link) {
876 JavaThread* THREAD = JavaThread::current();
877 if (log_is_enabled(Info, aot, link)) {
878 ResourceMark rm(THREAD);
879 log_info(aot, link)("Link all loaded classes for %s", ik->external_name());
880 }
881 AOTMetaspace::link_all_loaded_classes(THREAD);
882 }
883 }
884
885 // Returns true if the class should be excluded. This can be called by
886 // AOTConstantPoolResolver before or after we enter the CDS safepoint.
887 // When called before the safepoint, we need to link the class so that
888 // it can be checked by should_be_excluded_impl().
889 bool SystemDictionaryShared::should_be_excluded(Klass* k) {
890 if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache(k)) {
891 // We have reached a super type that's already in the base archive. Treat it
892 // as "not excluded".
893 return false;
894 }
895
896 if (k->is_objArray_klass()) {
897 return should_be_excluded(ObjArrayKlass::cast(k)->bottom_klass());
898 } else if (!k->is_instance_klass()) {
899 assert(k->is_typeArray_klass(), "must be");
900 return false;
901 } else {
902 InstanceKlass* ik = InstanceKlass::cast(k);
903
904 if (CDSConfig::is_dumping_final_static_archive() && _finished_exclusion_checks &&
905 !SafepointSynchronize::is_at_safepoint()) {
906 // This is called from the AOT compiler.
907 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
908 DumpTimeClassInfo* p = get_info_locked(ik);
909 if (p->is_excluded()) {
910 return true;
911 } else if (!p->has_checked_exclusion()) {
912 // This is a class that was loaded after we exited the AOT safepoint. This
913 // class is not in the AOT cache, so it must be considered as "excluded"
914 return true;
915 } else {
916 return false;
917 }
918 }
919
920 assert(CDSConfig::is_dumping_archive(), "sanity");
921 assert(CDSConfig::current_thread_is_vm_or_dumper(), "sanity");
922
923 if (!SafepointSynchronize::is_at_safepoint()) {
924 {
925 // fast path
926 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
927 DumpTimeClassInfo* p = get_info_locked(ik);
928 if (p->has_checked_exclusion()) {
929 return p->is_excluded();
930 }
931 }
932
933 link_all_exclusion_check_candidates(ik);
934
935 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
936 DumpTimeClassInfo* p = get_info_locked(ik);
937 return should_be_excluded_impl(ik, p);
938 } else {
939 // When called within the CDS safepoint, the correctness of this function
940 // relies on the call to AOTMetaspace::link_all_loaded_classes()
941 // that happened right before we enter the CDS safepoint.
942 //
959
960 void SystemDictionaryShared::finish_exclusion_checks() {
961 assert_at_safepoint();
962 if (CDSConfig::is_dumping_dynamic_archive() || CDSConfig::is_dumping_preimage_static_archive()) {
963 // Do this first -- if a base class is excluded due to duplication,
964 // all of its subclasses will also be excluded.
965 ResourceMark rm;
966 UnregisteredClassesDuplicationChecker dup_checker;
967 _dumptime_table->iterate_all_live_classes(&dup_checker);
968 dup_checker.mark_duplicated_classes();
969 }
970
971 _dumptime_table->iterate_all_live_classes([&] (InstanceKlass* k, DumpTimeClassInfo& info) {
972 SystemDictionaryShared::should_be_excluded_impl(k, &info);
973 });
974
975 _dumptime_table->update_counts();
976 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
977 LambdaProxyClassDictionary::cleanup_dumptime_table();
978 }
979 _finished_exclusion_checks = true;
980 }
981
982 bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) {
983 assert(!class_loading_may_happen(), "class loading must be disabled");
984 assert_lock_strong(DumpTimeTable_lock);
985 assert(CDSConfig::is_dumping_archive(), "sanity");
986 DumpTimeClassInfo* p = get_info_locked(k);
987 return p->is_excluded();
988 }
989
990 void SystemDictionaryShared::set_excluded_locked(InstanceKlass* k) {
991 assert_lock_strong(DumpTimeTable_lock);
992 assert(CDSConfig::is_dumping_archive(), "sanity");
993 DumpTimeClassInfo* info = get_info_locked(k);
994 info->set_excluded();
995 }
996
997 void SystemDictionaryShared::set_excluded(InstanceKlass* k) {
998 assert(CDSConfig::is_dumping_archive(), "sanity");
999 DumpTimeClassInfo* info = get_info(k);
1032
1033 if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
1034 LambdaProxyClassDictionary::dumptime_classes_do(it);
1035 }
1036 }
1037
1038 // Called from VerificationType::is_reference_assignable_from() before performing the assignability check of
1039 // T1 must be assignable from T2
1040 // Where:
1041 // L is the class loader of <k>
1042 // T1 is the type resolved by L using the name <name>
1043 // T2 is the type resolved by L using the name <from_name>
1044 //
1045 // The meaning of (*skip_assignability_check):
1046 // true: is_reference_assignable_from() should SKIP the assignability check
1047 // false: is_reference_assignable_from() should COMPLETE the assignability check
1048 void SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
1049 Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object,
1050 bool* skip_assignability_check) {
1051 assert(CDSConfig::is_dumping_archive(), "sanity");
1052 if (CDSConfig::is_dumping_dynamic_archive() && k->in_aot_cache()) {
1053 // k is a new class in the static archive, but one of its supertypes is an old class, so k wasn't
1054 // verified during dump time. No need to record constraints as k won't be included in the dynamic archive.
1055 return;
1056 }
1057 if (CDSConfig::is_dumping_aot_linked_classes() && is_builtin(k)) {
1058 // There's no need to save verification constraints
1059 // TODO -- double check the logic before integrating into mainline!!
1060 return;
1061 }
1062
1063 DumpTimeClassInfo* info = get_info(k);
1064 info->add_verification_constraint(name, from_name, from_field_is_protected,
1065 from_is_array, from_is_object);
1066
1067 if (CDSConfig::is_dumping_classic_static_archive() && !is_builtin(k)) {
1068 // This applies ONLY to the "classic" CDS static dump, which reads the list of
1069 // unregistered classes (those intended for custom class loaders) from the classlist
1070 // and loads them using jdk.internal.misc.CDS$UnregisteredClassLoader.
1071 //
1072 // When the classlist contains an unregistered class k, the supertypes of k are also
1073 // recorded in the classlist. However, the classlist does not contain information about
1074 // any class X that's not a supertype of k but is needed in the verification of k.
1075 // As a result, CDS$UnregisteredClassLoader will not know how to resolve X.
1076 //
1077 // Therefore, we tell the verifier to refrain from resolving X. Instead, X is recorded
1078 // (symbolically) in the verification constraints of k. In the production run,
1079 // when k is loaded, we will go through its verification constraints and resolve X to complete
1080 // the is_reference_assignable_from() checks.
1081 *skip_assignability_check = true;
1082 } else {
1529 print_shared_archive(st, false);
1530 }
1531
1532 void SystemDictionaryShared::print_table_statistics(outputStream* st) {
1533 if (CDSConfig::is_using_archive()) {
1534 _static_archive.print_table_statistics("Static ", st, true);
1535 if (DynamicArchive::is_mapped()) {
1536 _dynamic_archive.print_table_statistics("Dynamic ", st, false);
1537 }
1538 }
1539 }
1540
1541 bool SystemDictionaryShared::is_dumptime_table_empty() {
1542 assert_lock_strong(DumpTimeTable_lock);
1543 _dumptime_table->update_counts();
1544 if (_dumptime_table->count_of(true) == 0 && _dumptime_table->count_of(false) == 0){
1545 return true;
1546 }
1547 return false;
1548 }
1549
1550 void SystemDictionaryShared::create_loader_positive_lookup_cache(TRAPS) {
1551 GrowableArray<InstanceKlass*> shared_classes_list;
1552 {
1553 // With static dumping, we have only a single Java thread (see JVM_StartThread) so
1554 // no no other threads should be loading classes. Otherwise, the code below may miss some
1555 // classes that are loaded concurrently.
1556 assert(CDSConfig::is_dumping_static_archive(), "no other threads should be loading classes");
1557
1558 MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
1559 _dumptime_table->iterate_all_classes_in_builtin_loaders([&](InstanceKlass* k, DumpTimeClassInfo& info) {
1560 // FIXME -- this may not be correct before SystemDictionaryShared::finish_exclusion_checks()
1561 if (!k->is_hidden() && info.has_checked_exclusion() && !info.is_excluded()) {
1562 shared_classes_list.append(k);
1563 }
1564 }
1565 );
1566 }
1567
1568 InstanceKlass* ik = vmClasses::Class_klass();
1569 objArrayOop r = oopFactory::new_objArray(ik, shared_classes_list.length(), CHECK);
1570 objArrayHandle array_h(THREAD, r);
1571
1572 for (int i = 0; i < shared_classes_list.length(); i++) {
1573 oop mirror = shared_classes_list.at(i)->java_mirror();
1574 Handle mirror_h(THREAD, mirror);
1575 array_h->obj_at_put(i, mirror_h());
1576 }
1577
1578 TempNewSymbol method = SymbolTable::new_symbol("generatePositiveLookupCache");
1579 TempNewSymbol signature = SymbolTable::new_symbol("([Ljava/lang/Class;)V");
1580
1581 JavaCallArguments args(Handle(THREAD, SystemDictionary::java_system_loader()));
1582 args.push_oop(array_h);
1583 JavaValue result(T_VOID);
1584 JavaCalls::call_virtual(&result,
1585 vmClasses::jdk_internal_loader_ClassLoaders_AppClassLoader_klass(),
1586 method,
1587 signature,
1588 &args,
1589 CHECK);
1590
1591 if (HAS_PENDING_EXCEPTION) {
1592 Handle exc_handle(THREAD, PENDING_EXCEPTION);
1593 CLEAR_PENDING_EXCEPTION;
1594 ResourceMark rm(THREAD);
1595
1596 log_warning(cds)("Exception during AppClassLoader::generatePositiveLookupCache() call");
1597 LogStreamHandle(Debug, cds) log;
1598 if (log.is_enabled()) {
1599 java_lang_Throwable::print_stack_trace(exc_handle, &log);
1600 }
1601 return;
1602 }
1603 }
|