897 _shared_jar_manifests = oopFactory::new_objArray(
898 SystemDictionary::Jar_Manifest_klass(), size, CHECK);
899 }
900 }
901
902 void SystemDictionaryShared::allocate_shared_data_arrays(int size, TRAPS) {
903 allocate_shared_protection_domain_array(size, CHECK);
904 allocate_shared_jar_url_array(size, CHECK);
905 allocate_shared_jar_manifest_array(size, CHECK);
906 }
907
908 // This function is called for loading only UNREGISTERED classes
909 InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
910 Handle class_loader,
911 Handle protection_domain,
912 const ClassFileStream* cfs,
913 TRAPS) {
914 if (!UseSharedSpaces) {
915 return NULL;
916 }
917 if (class_name == NULL) { // don't do this for anonymous classes
918 return NULL;
919 }
920 if (class_loader.is_null() ||
921 SystemDictionary::is_system_class_loader(class_loader()) ||
922 SystemDictionary::is_platform_class_loader(class_loader())) {
923 // Do nothing for the BUILTIN loaders.
924 return NULL;
925 }
926
927 const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, &_dynamic_unregistered_dictionary, class_name);
928 if (record == NULL) {
929 return NULL;
930 }
931
932 int clsfile_size = cfs->length();
933 int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
934
935 if (!record->matches(clsfile_size, clsfile_crc32)) {
936 return NULL;
937 }
1079 p->_verifier_constraint_flags = NULL;
1080 _dumptime_table->remove(k);
1081 }
1082
1083 bool SystemDictionaryShared::is_jfr_event_class(InstanceKlass *k) {
1084 while (k) {
1085 if (k->name()->equals("jdk/internal/event/Event")) {
1086 return true;
1087 }
1088 k = k->java_super();
1089 }
1090 return false;
1091 }
1092
1093 void SystemDictionaryShared::warn_excluded(InstanceKlass* k, const char* reason) {
1094 ResourceMark rm;
1095 log_warning(cds)("Skipping %s: %s", k->name()->as_C_string(), reason);
1096 }
1097
1098 bool SystemDictionaryShared::should_be_excluded(InstanceKlass* k) {
1099 if (k->class_loader_data()->is_unsafe_anonymous()) {
1100 warn_excluded(k, "Unsafe anonymous class");
1101 return true; // unsafe anonymous classes are not archived, skip
1102 }
1103 if (k->is_in_error_state()) {
1104 warn_excluded(k, "In error state");
1105 return true;
1106 }
1107 if (k->has_been_redefined()) {
1108 warn_excluded(k, "Has been redefined");
1109 return true;
1110 }
1111 if (k->shared_classpath_index() < 0 && is_builtin(k)) {
1112 // These are classes loaded from unsupported locations (such as those loaded by JVMTI native
1113 // agent during dump time).
1114 warn_excluded(k, "Unsupported location");
1115 return true;
1116 }
1117 if (k->signers() != NULL) {
1118 // We cannot include signed classes in the archive because the certificates
1119 // used during dump time may be different than those used during
1120 // runtime (due to expiration, etc).
1121 warn_excluded(k, "Signed JAR");
|
897 _shared_jar_manifests = oopFactory::new_objArray(
898 SystemDictionary::Jar_Manifest_klass(), size, CHECK);
899 }
900 }
901
902 void SystemDictionaryShared::allocate_shared_data_arrays(int size, TRAPS) {
903 allocate_shared_protection_domain_array(size, CHECK);
904 allocate_shared_jar_url_array(size, CHECK);
905 allocate_shared_jar_manifest_array(size, CHECK);
906 }
907
908 // This function is called for loading only UNREGISTERED classes
909 InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
910 Handle class_loader,
911 Handle protection_domain,
912 const ClassFileStream* cfs,
913 TRAPS) {
914 if (!UseSharedSpaces) {
915 return NULL;
916 }
917 if (class_name == NULL) { // don't do this for hidden and unsafe anonymous classes
918 return NULL;
919 }
920 if (class_loader.is_null() ||
921 SystemDictionary::is_system_class_loader(class_loader()) ||
922 SystemDictionary::is_platform_class_loader(class_loader())) {
923 // Do nothing for the BUILTIN loaders.
924 return NULL;
925 }
926
927 const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, &_dynamic_unregistered_dictionary, class_name);
928 if (record == NULL) {
929 return NULL;
930 }
931
932 int clsfile_size = cfs->length();
933 int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
934
935 if (!record->matches(clsfile_size, clsfile_crc32)) {
936 return NULL;
937 }
1079 p->_verifier_constraint_flags = NULL;
1080 _dumptime_table->remove(k);
1081 }
1082
1083 bool SystemDictionaryShared::is_jfr_event_class(InstanceKlass *k) {
1084 while (k) {
1085 if (k->name()->equals("jdk/internal/event/Event")) {
1086 return true;
1087 }
1088 k = k->java_super();
1089 }
1090 return false;
1091 }
1092
1093 void SystemDictionaryShared::warn_excluded(InstanceKlass* k, const char* reason) {
1094 ResourceMark rm;
1095 log_warning(cds)("Skipping %s: %s", k->name()->as_C_string(), reason);
1096 }
1097
1098 bool SystemDictionaryShared::should_be_excluded(InstanceKlass* k) {
1099 if (k->is_hidden() || k->is_unsafe_anonymous()) {
1100 warn_excluded(k, "Hidden or Unsafe anonymous class");
1101 return true; // hidden and unsafe anonymous classes are not archived, skip
1102 }
1103 if (k->is_in_error_state()) {
1104 warn_excluded(k, "In error state");
1105 return true;
1106 }
1107 if (k->has_been_redefined()) {
1108 warn_excluded(k, "Has been redefined");
1109 return true;
1110 }
1111 if (k->shared_classpath_index() < 0 && is_builtin(k)) {
1112 // These are classes loaded from unsupported locations (such as those loaded by JVMTI native
1113 // agent during dump time).
1114 warn_excluded(k, "Unsupported location");
1115 return true;
1116 }
1117 if (k->signers() != NULL) {
1118 // We cannot include signed classes in the archive because the certificates
1119 // used during dump time may be different than those used during
1120 // runtime (due to expiration, etc).
1121 warn_excluded(k, "Signed JAR");
|