src/hotspot/share/classfile/classFileParser.cpp
changeset 47673 6126617b8508
parent 47216 71c04702a3d5
child 47765 b7c7428eaab9
equal deleted inserted replaced
47672:50aa24ce898c 47673:6126617b8508
  5922       ls.cr();
  5922       ls.cr();
  5923     }
  5923     }
  5924 
  5924 
  5925 #if INCLUDE_CDS
  5925 #if INCLUDE_CDS
  5926     if (DumpLoadedClassList != NULL && stream->source() != NULL && classlist_file->is_open()) {
  5926     if (DumpLoadedClassList != NULL && stream->source() != NULL && classlist_file->is_open()) {
  5927       // Only dump the classes that can be stored into CDS archive.
  5927       if (!ClassLoader::has_jrt_entry()) {
  5928       // Anonymous classes such as generated LambdaForm classes are also not included.
  5928         warning("DumpLoadedClassList and CDS are not supported in exploded build");
  5929       if (SystemDictionaryShared::is_sharing_possible(_loader_data) &&
  5929         DumpLoadedClassList = NULL;
       
  5930       } else if (SystemDictionaryShared::is_sharing_possible(_loader_data) &&
  5930           _host_klass == NULL) {
  5931           _host_klass == NULL) {
       
  5932         // Only dump the classes that can be stored into CDS archive.
       
  5933         // Anonymous classes such as generated LambdaForm classes are also not included.
  5931         oop class_loader = _loader_data->class_loader();
  5934         oop class_loader = _loader_data->class_loader();
  5932         ResourceMark rm(THREAD);
  5935         ResourceMark rm(THREAD);
  5933         // For the boot and platform class loaders, check if the class is not found in the
  5936         bool skip = false;
  5934         // java runtime image. Additional check for the boot class loader is if the class
  5937         if (class_loader == NULL || SystemDictionary::is_platform_class_loader(class_loader)) {
  5935         // is not found in the boot loader's appended entries. This indicates that the class
  5938           // For the boot and platform class loaders, skip classes that are not found in the
  5936         // is not useable during run time, such as the ones found in the --patch-module entries,
  5939           // java runtime image, such as those found in the --patch-module entries.
  5937         // so it should not be included in the classlist file.
  5940           // These classes can't be loaded from the archive during runtime.
  5938         if (((class_loader == NULL && !ClassLoader::contains_append_entry(stream->source())) ||
  5941           if (!ClassLoader::is_modules_image(stream->source()) && strncmp(stream->source(), "jrt:", 4) != 0) {
  5939              SystemDictionary::is_platform_class_loader(class_loader)) &&
  5942             skip = true;
  5940             !ClassLoader::is_jrt(stream->source())) {
  5943           }
       
  5944 
       
  5945           if (class_loader == NULL && ClassLoader::contains_append_entry(stream->source())) {
       
  5946             // .. but don't skip the boot classes that are loaded from -Xbootclasspath/a
       
  5947             // as they can be loaded from the archive during runtime.
       
  5948             skip = false;
       
  5949           }
       
  5950         }
       
  5951         if (skip) {
  5941           tty->print_cr("skip writing class %s from source %s to classlist file",
  5952           tty->print_cr("skip writing class %s from source %s to classlist file",
  5942             _class_name->as_C_string(), stream->source());
  5953             _class_name->as_C_string(), stream->source());
  5943         } else {
  5954         } else {
  5944           classlist_file->print_cr("%s", _class_name->as_C_string());
  5955           classlist_file->print_cr("%s", _class_name->as_C_string());
  5945           classlist_file->flush();
  5956           classlist_file->flush();