src/hotspot/share/memory/filemap.cpp
changeset 51439 0517bd2a0eda
parent 51070 2f4c3cac8556
child 51477 e77d7687c831
--- a/src/hotspot/share/memory/filemap.cpp	Fri Aug 17 22:20:47 2018 +0100
+++ b/src/hotspot/share/memory/filemap.cpp	Fri Aug 17 14:50:59 2018 -0700
@@ -199,6 +199,7 @@
   ClassLoaderExt::finalize_shared_paths_misc_info();
   _app_class_paths_start_index = ClassLoaderExt::app_class_paths_start_index();
   _app_module_paths_start_index = ClassLoaderExt::app_module_paths_start_index();
+  _max_used_path_index = ClassLoaderExt::max_used_path_index();
 
   _verify_local = BytecodeVerificationLocal;
   _verify_remote = BytecodeVerificationRemote;
@@ -359,13 +360,13 @@
 
   bool has_nonempty_dir = false;
 
-  int end = _shared_path_table_size;
-  if (!ClassLoaderExt::has_platform_or_app_classes()) {
-    // only check the boot path if no app class is loaded
-    end = ClassLoaderExt::app_class_paths_start_index();
+  int last = _shared_path_table_size - 1;
+  if (last > ClassLoaderExt::max_used_path_index()) {
+     // no need to check any path beyond max_used_path_index
+     last = ClassLoaderExt::max_used_path_index();
   }
 
-  for (int i = 0; i < end; i++) {
+  for (int i = 0; i <= last; i++) {
     SharedClassPathEntry *e = shared_path(i);
     if (e->is_dir()) {
       const char* path = e->name();
@@ -467,13 +468,8 @@
 
   int module_paths_start_index = _header->_app_module_paths_start_index;
 
-  // If the shared archive contain app or platform classes, validate all entries
-  // in the shared path table. Otherwise, only validate the boot path entries (with
-  // entry index < _app_class_paths_start_index).
-  int count = _header->has_platform_or_app_classes() ?
-              _shared_path_table_size : _header->_app_class_paths_start_index;
-
-  for (int i=0; i<count; i++) {
+  // validate the path entries up to the _max_used_path_index
+  for (int i=0; i < _header->_max_used_path_index + 1; i++) {
     if (i < module_paths_start_index) {
       if (shared_path(i)->validate()) {
         log_info(class, path)("ok");