< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page
@@ -34,10 +34,11 @@
  #include "classfile/classLoadInfo.hpp"
  #include "classfile/dictionary.hpp"
  #include "classfile/javaClasses.inline.hpp"
  #include "classfile/klassFactory.hpp"
  #include "classfile/loaderConstraints.hpp"
+ #include "classfile/modules.hpp"
  #include "classfile/packageEntry.hpp"
  #include "classfile/placeholders.hpp"
  #include "classfile/protectionDomainCache.hpp"
  #include "classfile/resolutionErrors.hpp"
  #include "classfile/stringTable.hpp"

@@ -158,10 +159,14 @@
      DEBUG_ONLY(
        oop system_loader = get_system_class_loader_impl(CHECK);
        assert(_java_system_loader.resolve() == system_loader, "must be");
      )
    }
+ 
+   if (CDSConfig::is_dumping_final_static_archive()) {
+     AOTLinkedClassBulkLoader::load_non_javabase_classes(THREAD);
+   }
  }
  
  oop SystemDictionary::get_system_class_loader_impl(TRAPS) {
    JavaValue result(T_OBJECT);
    InstanceKlass* class_loader_klass = vmClasses::ClassLoader_klass();

@@ -1016,11 +1021,15 @@
    ModuleEntry* mod_entry = (pkg_entry == nullptr) ? nullptr : pkg_entry->module();
    bool should_be_in_named_module = (mod_entry != nullptr && mod_entry->is_named());
    bool was_archived_from_named_module = scp_entry->in_named_module();
    bool visible;
  
-   if (was_archived_from_named_module) {
+   if (mod_entry != nullptr && mod_entry->location() == nullptr && mod_entry->is_named()) {
+     // Archived module for dynamic proxies. It's always visible.
+     assert(Modules::is_dynamic_proxy_module(mod_entry), "must be");
+     visible = true;
+   } else if (was_archived_from_named_module) {
      if (should_be_in_named_module) {
        // Is the module loaded from the same location as during dump time?
        visible = mod_entry->shared_path_index() == scp_index;
        if (visible) {
          assert(!mod_entry->is_patched(), "cannot load archived classes for patched module");

@@ -1200,15 +1209,32 @@
  
    // For boot loader, ensure that GetSystemPackage knows that a class in this
    // package was loaded.
    if (loader_data->is_the_null_class_loader_data()) {
      s2 path_index = ik->shared_classpath_index();
-     ik->set_classpath_index(path_index);
+     if (path_index >= 0) { // FIXME ... for lambda form classes
+       ik->set_classpath_index(path_index);
+ 
+       if (CDSConfig::is_dumping_final_static_archive()) {
+         if (path_index > ClassLoaderExt::max_used_path_index()) {
+           ClassLoaderExt::set_max_used_path_index(path_index);
+         }
+       }
+     }
    }
  
    // notify a class loaded from shared object
    ClassLoadingService::notify_class_loaded(ik, true /* shared class */);
+ 
+   if (CDSConfig::is_dumping_final_static_archive()) {
+     SystemDictionaryShared::init_dumptime_info(ik);
+     if (SystemDictionary::is_platform_class_loader(loader_data->class_loader())) {
+       ClassLoaderExt::set_has_platform_classes();
+     } else if (SystemDictionary::is_system_class_loader(loader_data->class_loader())) {
+       ClassLoaderExt::set_has_app_classes();
+     }
+   }
  }
  
  #endif // INCLUDE_CDS
  
  InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Handle class_loader, TRAPS) {

@@ -1279,22 +1305,22 @@
      InstanceKlass* k = nullptr;
  
  #if INCLUDE_CDS
      if (CDSConfig::is_using_archive())
      {
-       PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time());
+       PerfTraceElapsedTime vmtimer(ClassLoader::perf_shared_classload_time());
        InstanceKlass* ik = SystemDictionaryShared::find_builtin_class(class_name);
        if (ik != nullptr && ik->is_shared_boot_class() && !ik->shared_loading_failed()) {
          SharedClassLoadingMark slm(THREAD, ik);
          k = load_shared_class(ik, class_loader, Handle(), nullptr,  pkg_entry, CHECK_NULL);
        }
      }
  #endif
  
      if (k == nullptr) {
        // Use VM class loader
-       PerfTraceTime vmtimer(ClassLoader::perf_sys_classload_time());
+       PerfTraceElapsedTime vmtimer(ClassLoader::perf_sys_classload_time());
        k = ClassLoader::load_class(class_name, pkg_entry, search_only_bootloader_append, CHECK_NULL);
      }
  
      // find_or_define_instance_class may return a different InstanceKlass
      if (k != nullptr) {
< prev index next >