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