changeset 52266:73523d329966

8208061: runtime/LoadClass/TestResize.java fails with "Load factor too high" when running in CDS mode. Summary: Allow resizing for all system dictionaries except for the shared dictionary at runtime. Reviewed-by: iklam, gziemski
author jiangli
date Fri, 24 Aug 2018 15:33:28 -0400
parents b426c75da4b9
children 9d01ad46daef
files src/hotspot/share/classfile/classLoaderData.cpp src/hotspot/share/classfile/dictionary.cpp src/hotspot/share/classfile/systemDictionary.cpp
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Fri Aug 24 11:56:14 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Fri Aug 24 15:33:28 2018 -0400
@@ -655,7 +655,7 @@
     size = _default_loader_dictionary_size;
     resizable = true;
   }
-  if (!DynamicallyResizeSystemDictionaries || DumpSharedSpaces || UseSharedSpaces) {
+  if (!DynamicallyResizeSystemDictionaries || DumpSharedSpaces) {
     resizable = false;
   }
   return new Dictionary(this, size, resizable);
--- a/src/hotspot/share/classfile/dictionary.cpp	Fri Aug 24 11:56:14 2018 -0700
+++ b/src/hotspot/share/classfile/dictionary.cpp	Fri Aug 24 15:33:28 2018 -0400
@@ -592,8 +592,8 @@
   ResourceMark rm;
 
   assert(loader_data() != NULL, "loader data should not be null");
-  st->print_cr("Java dictionary (table_size=%d, classes=%d)",
-               table_size(), number_of_entries());
+  st->print_cr("Java dictionary (table_size=%d, classes=%d, resizable=%s)",
+               table_size(), number_of_entries(), BOOL_TO_STR(_resizable));
   st->print_cr("^ indicates that initiating loader is different from defining loader");
 
   for (int index = 0; index < table_size(); index++) {
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Fri Aug 24 11:56:14 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Fri Aug 24 15:33:28 2018 -0400
@@ -1160,10 +1160,12 @@
 #if INCLUDE_CDS
 void SystemDictionary::set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
                                              int number_of_entries) {
+  assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
   assert(length == _shared_dictionary_size * sizeof(HashtableBucket<mtClass>),
          "bad shared dictionary size.");
   _shared_dictionary = new Dictionary(ClassLoaderData::the_null_class_loader_data(),
-                                      _shared_dictionary_size, t, number_of_entries);
+                                      _shared_dictionary_size, t, number_of_entries,
+                                      false /* explicitly set _resizable to false */);
 }