changeset 11139:6bbf7824e2d5

Merge
author jiangli
date Thu, 05 May 2016 03:04:55 +0200
parents e8f9f56b68ae c533089c14b2
children 5e008c3065e0
files
diffstat 4 files changed, 17 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classLoader.cpp	Wed May 04 23:45:10 2016 +0000
+++ b/src/share/vm/classfile/classLoader.cpp	Thu May 05 03:04:55 2016 +0200
@@ -941,6 +941,10 @@
 
 #if INCLUDE_CDS
 void ClassLoader::initialize_module_loader_map(JImageFile* jimage) {
+  if (!DumpSharedSpaces) {
+    return; // only needed for CDS dump time
+  }
+
   jlong size;
   JImageLocationRef location = (*JImageFindResource)(jimage, "java.base", get_jimage_version_string(), MODULE_LOADER_MAP, &size);
   if (location == 0) {
@@ -1085,6 +1089,7 @@
 #if INCLUDE_CDS
 s2 ClassLoader::module_to_classloader(const char* module_name) {
 
+  assert(DumpSharedSpaces, "dump time only");
   assert(_boot_modules_array != NULL, "_boot_modules_array is NULL");
   assert(_platform_modules_array != NULL, "_platform_modules_array is NULL");
 
@@ -1104,11 +1109,11 @@
 
   return APP_LOADER;
 }
-#endif
 
 s2 ClassLoader::classloader_type(Symbol* class_name, ClassPathEntry* e,
                                      int classpath_index, TRAPS) {
-#if INCLUDE_CDS
+  assert(DumpSharedSpaces, "Only used for CDS dump time");
+
   // obtain the classloader type based on the class name.
   // First obtain the package name based on the class name. Then obtain
   // the classloader type based on the package name from the jimage using
@@ -1133,10 +1138,8 @@
     loader_type = ClassLoader::BOOT_LOADER;
   }
   return loader_type;
+}
 #endif
-  return ClassLoader::BOOT_LOADER; // the classloader type is ignored in non-CDS cases
-}
-
 
 // caller needs ResourceMark
 const char* ClassLoader::file_name_for_class_name(const char* class_name,
@@ -1253,8 +1256,7 @@
     return NULL;
   }
 
-  jshort loader_type = classloader_type(name, e, classpath_index, CHECK_NULL);
-  return context.record_result(classpath_index, loader_type, e, result, THREAD);
+  return context.record_result(name, e, classpath_index, result, THREAD);
 }
 
 // Initialize the class loader's access to methods in libzip.  Parse and
--- a/src/share/vm/classfile/classLoader.hpp	Wed May 04 23:45:10 2016 +0000
+++ b/src/share/vm/classfile/classLoader.hpp	Thu May 05 03:04:55 2016 +0200
@@ -379,9 +379,9 @@
 
   static s2 module_to_classloader(const char* module_name);
   static void initialize_module_loader_map(JImageFile* jimage);
+  static s2 classloader_type(Symbol* class_name, ClassPathEntry* e,
+                             int classpath_index, TRAPS);
 #endif
-  static s2 classloader_type(Symbol* class_name, ClassPathEntry* e,
-                                 int classpath_index, TRAPS);
 
   static void  trace_class_path(const char* msg, const char* name = NULL);
 
--- a/src/share/vm/classfile/classLoaderExt.hpp	Wed May 04 23:45:10 2016 +0000
+++ b/src/share/vm/classfile/classLoaderExt.hpp	Thu May 05 03:04:55 2016 +0200
@@ -49,12 +49,14 @@
       return false;
     }
 
-    instanceKlassHandle record_result(const s2 classpath_index,
-                                      const jshort classloader_type,
-                                      const ClassPathEntry* e,
+    instanceKlassHandle record_result(Symbol* class_name,
+                                      ClassPathEntry* e,
+                                      const s2 classpath_index,
                                       instanceKlassHandle result, TRAPS) {
       if (ClassLoader::add_package(_file_name, classpath_index, THREAD)) {
         if (DumpSharedSpaces) {
+          s2 classloader_type = ClassLoader::classloader_type(
+                          class_name, e, classpath_index, CHECK_(result));
           result->set_shared_classpath_index(classpath_index);
           result->set_class_loader_type(classloader_type);
         }
--- a/src/share/vm/oops/instanceKlass.hpp	Wed May 04 23:45:10 2016 +0000
+++ b/src/share/vm/oops/instanceKlass.hpp	Thu May 05 03:04:55 2016 +0200
@@ -321,7 +321,7 @@
     return (_misc_flags & _misc_is_shared_app_class) != 0;
   }
 
-  void set_class_loader_type(jshort loader_type) {
+  void set_class_loader_type(s2 loader_type) {
     assert(( _misc_flags & loader_type_bits()) == 0,
            "Should only be called once for each class.");
     switch (loader_type) {