< prev index next >

src/hotspot/share/classfile/systemDictionaryShared.cpp

Print this page




 834     _shared_jar_manifests = oopFactory::new_objArray(
 835         SystemDictionary::Jar_Manifest_klass(), size, CHECK);
 836   }
 837 }
 838 
 839 void SystemDictionaryShared::allocate_shared_data_arrays(int size, TRAPS) {
 840   allocate_shared_protection_domain_array(size, CHECK);
 841   allocate_shared_jar_url_array(size, CHECK);
 842   allocate_shared_jar_manifest_array(size, CHECK);
 843 }
 844 
 845 // This function is called for loading only UNREGISTERED classes
 846 InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
 847                                                           Handle class_loader,
 848                                                           Handle protection_domain,
 849                                                           const ClassFileStream* cfs,
 850                                                           TRAPS) {
 851   if (!UseSharedSpaces) {
 852     return NULL;
 853   }
 854   if (class_name == NULL) {  // don't do this for anonymous classes
 855     return NULL;
 856   }
 857   if (class_loader.is_null() ||
 858       SystemDictionary::is_system_class_loader(class_loader()) ||
 859       SystemDictionary::is_platform_class_loader(class_loader())) {
 860     // Do nothing for the BUILTIN loaders.
 861     return NULL;
 862   }
 863 
 864   const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, class_name);
 865   if (record == NULL) {
 866     return NULL;
 867   }
 868 
 869   int clsfile_size  = cfs->length();
 870   int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
 871   if (!record->matches(clsfile_size, clsfile_crc32)) {
 872     return NULL;
 873   }
 874 


 991 void SystemDictionaryShared::remove_dumptime_info(InstanceKlass* k) {
 992   _dumptime_table->remove(k);
 993 }
 994 
 995 bool SystemDictionaryShared::is_jfr_event_class(InstanceKlass *k) {
 996   while (k) {
 997     if (k->name()->equals("jdk/internal/event/Event")) {
 998       return true;
 999     }
1000     k = k->java_super();
1001   }
1002   return false;
1003 }
1004 
1005 void SystemDictionaryShared::warn_excluded(InstanceKlass* k, const char* reason) {
1006   ResourceMark rm;
1007   log_warning(cds)("Skipping %s: %s", k->name()->as_C_string(), reason);
1008 }
1009 
1010 bool SystemDictionaryShared::should_be_excluded(InstanceKlass* k) {
1011   if (k->class_loader_data()->is_unsafe_anonymous()) {
1012     return true; // unsafe anonymous classes are not archived, skip
1013   }
1014   if (k->is_in_error_state()) {
1015     return true;
1016   }
1017   if (k->shared_classpath_index() < 0 && is_builtin(k)) {
1018     // These are classes loaded from unsupported locations (such as those loaded by JVMTI native
1019     // agent during dump time).
1020     warn_excluded(k, "Unsupported location");
1021     return true;
1022   }
1023   if (k->signers() != NULL) {
1024     // We cannot include signed classes in the archive because the certificates
1025     // used during dump time may be different than those used during
1026     // runtime (due to expiration, etc).
1027     warn_excluded(k, "Signed JAR");
1028     return true;
1029   }
1030   if (is_jfr_event_class(k)) {
1031     // We cannot include JFR event classes because they need runtime-specific
1032     // instrumentation in order to work with -XX:FlightRecorderOptions=retransform=false.




 834     _shared_jar_manifests = oopFactory::new_objArray(
 835         SystemDictionary::Jar_Manifest_klass(), size, CHECK);
 836   }
 837 }
 838 
 839 void SystemDictionaryShared::allocate_shared_data_arrays(int size, TRAPS) {
 840   allocate_shared_protection_domain_array(size, CHECK);
 841   allocate_shared_jar_url_array(size, CHECK);
 842   allocate_shared_jar_manifest_array(size, CHECK);
 843 }
 844 
 845 // This function is called for loading only UNREGISTERED classes
 846 InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
 847                                                           Handle class_loader,
 848                                                           Handle protection_domain,
 849                                                           const ClassFileStream* cfs,
 850                                                           TRAPS) {
 851   if (!UseSharedSpaces) {
 852     return NULL;
 853   }
 854   if (class_name == NULL) {  // don't do this for nonfindable and unsafe anonymous classes
 855     return NULL;
 856   }
 857   if (class_loader.is_null() ||
 858       SystemDictionary::is_system_class_loader(class_loader()) ||
 859       SystemDictionary::is_platform_class_loader(class_loader())) {
 860     // Do nothing for the BUILTIN loaders.
 861     return NULL;
 862   }
 863 
 864   const RunTimeSharedClassInfo* record = find_record(&_unregistered_dictionary, class_name);
 865   if (record == NULL) {
 866     return NULL;
 867   }
 868 
 869   int clsfile_size  = cfs->length();
 870   int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
 871   if (!record->matches(clsfile_size, clsfile_crc32)) {
 872     return NULL;
 873   }
 874 


 991 void SystemDictionaryShared::remove_dumptime_info(InstanceKlass* k) {
 992   _dumptime_table->remove(k);
 993 }
 994 
 995 bool SystemDictionaryShared::is_jfr_event_class(InstanceKlass *k) {
 996   while (k) {
 997     if (k->name()->equals("jdk/internal/event/Event")) {
 998       return true;
 999     }
1000     k = k->java_super();
1001   }
1002   return false;
1003 }
1004 
1005 void SystemDictionaryShared::warn_excluded(InstanceKlass* k, const char* reason) {
1006   ResourceMark rm;
1007   log_warning(cds)("Skipping %s: %s", k->name()->as_C_string(), reason);
1008 }
1009 
1010 bool SystemDictionaryShared::should_be_excluded(InstanceKlass* k) {
1011   if (k->is_nonfindable()) {
1012     return true; // nonfindable and unsafe anonymous classes are not archived, skip
1013   }
1014   if (k->is_in_error_state()) {
1015     return true;
1016   }
1017   if (k->shared_classpath_index() < 0 && is_builtin(k)) {
1018     // These are classes loaded from unsupported locations (such as those loaded by JVMTI native
1019     // agent during dump time).
1020     warn_excluded(k, "Unsupported location");
1021     return true;
1022   }
1023   if (k->signers() != NULL) {
1024     // We cannot include signed classes in the archive because the certificates
1025     // used during dump time may be different than those used during
1026     // runtime (due to expiration, etc).
1027     warn_excluded(k, "Signed JAR");
1028     return true;
1029   }
1030   if (is_jfr_event_class(k)) {
1031     // We cannot include JFR event classes because they need runtime-specific
1032     // instrumentation in order to work with -XX:FlightRecorderOptions=retransform=false.


< prev index next >