changeset 8013:9f16f5d21ff1

Fixes for CDS, make sure -XX:+TraceClassLoadingPreorder outputs full jimage pathname for classes in the jimage so that Make Classlist tool works, and suppress module visibilitiy check when dumping to the CDS archive.
author hseigel
date Wed, 04 Mar 2015 16:29:09 -0500
parents 0b8ad3584a1c
children 808a93ac60e0
files src/share/vm/classfile/classLoader.cpp src/share/vm/classfile/systemDictionary.cpp
diffstat 2 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classLoader.cpp	Tue Mar 03 08:56:44 2015 -0800
+++ b/src/share/vm/classfile/classLoader.cpp	Wed Mar 04 16:29:09 2015 -0500
@@ -582,7 +582,7 @@
     if (UsePerfData) {
       ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
     }
-    return new ClassFileStream(buffer, (int)size, (char*)name);  // Resource allocated
+    return new ClassFileStream(buffer, (int)size, _image->name());  // Resource allocated
   }
 
   return NULL;
--- a/src/share/vm/classfile/systemDictionary.cpp	Tue Mar 03 08:56:44 2015 -0800
+++ b/src/share/vm/classfile/systemDictionary.cpp	Wed Mar 04 16:29:09 2015 -0500
@@ -1288,27 +1288,30 @@
       // java.base packages in the boot loader's PackageEntryTable.
       // No class outside of java.base is allowed to be loaded during
       // this bootstrapping window.
-      if (pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
-        // Class is either in the unnamed package or in
-        // a named package within the unnamed module.  Either
-        // case is outside of java.base, do not attempt to
-        // load the class.
-        return nh;
-      } else {
-        // Check that the class' package is defined within java.base.
-        ModuleEntry* mod_entry = pkg_entry->module();
-        Symbol* mod_entry_name = mod_entry->name();
-        if (mod_entry_name->fast_compare(vmSymbols::java_base()) != 0) {
+      if (!DumpSharedSpaces) {
+        if (pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
+          // Class is either in the unnamed package or in
+          // a named package within the unnamed module.  Either
+          // case is outside of java.base, do not attempt to
+          // load the class.
           return nh;
+        } else {
+          // Check that the class' package is defined within java.base.
+          ModuleEntry* mod_entry = pkg_entry->module();
+          Symbol* mod_entry_name = mod_entry->name();
+          if (mod_entry_name->fast_compare(vmSymbols::java_base()) != 0) {
+            return nh;
+          }
         }
       }
     } else {
+      assert(!DumpSharedSpaces, "Archive dumped after module system initialization");
       // After the module system has been initialized, check if the class'
       // package is in a module defined to the boot loader.
       if (pkg_string == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
         // Class is either in the unnamed package, in a named package
         // within a module not defined to the boot loader or in a
-        // a named package within the unnamed module.  In all cases
+        // a named package within the unnamed module.  In all cases,
         // limit visibility to search for the class only in the boot
         // loader's append path.
         search_only_bootloader_append = true;
@@ -1317,8 +1320,8 @@
 
     // Prior to bootstrapping's module initialization, never load a class outside
     // of the boot loader's module path
-    assert(Universe::is_module_initialized() ||
-           (!Universe::is_module_initialized() && !search_only_bootloader_append),
+    assert(Universe::is_module_initialized() || DumpSharedSpaces ||
+           !search_only_bootloader_append,
            "Attempt to load a class outside of boot loader's module path");
 
     // Search the shared system dictionary for classes preloaded into the