8295029: runtime/cds/appcds/LotsOfClasses.java fail with jfx

Reviewed-by: iklam, ccheung, gziemski
This commit is contained in:
Coleen Phillimore 2022-10-18 20:26:15 +00:00
parent 0233ba763d
commit 37f93b6728
4 changed files with 7 additions and 19 deletions

View File

@ -604,23 +604,16 @@ const int _default_loader_dictionary_size = 107;
Dictionary* ClassLoaderData::create_dictionary() {
assert(!has_class_mirror_holder(), "class mirror holder cld does not have a dictionary");
int size;
bool resizable = false;
if (_the_null_class_loader_data == NULL) {
size = _boot_loader_dictionary_size;
resizable = true;
} else if (class_loader()->is_a(vmClasses::reflect_DelegatingClassLoader_klass())) {
size = 1; // there's only one class in relection class loader and no initiated classes
} else if (is_system_class_loader_data()) {
size = _boot_loader_dictionary_size;
resizable = true;
} else {
size = _default_loader_dictionary_size;
resizable = true;
}
if (!DynamicallyResizeSystemDictionaries || DumpSharedSpaces) {
resizable = false;
}
return new Dictionary(this, size, resizable);
return new Dictionary(this, size);
}
// Tell the GC to keep this klass alive. Needed while iterating ClassLoaderDataGraph,

View File

@ -53,8 +53,8 @@ const size_t END_SIZE = 24;
// If a chain gets to 100 something might be wrong
const size_t REHASH_LEN = 100;
Dictionary::Dictionary(ClassLoaderData* loader_data, size_t table_size, bool resizable)
: _resizable(resizable), _number_of_entries(0), _loader_data(loader_data) {
Dictionary::Dictionary(ClassLoaderData* loader_data, size_t table_size)
: _number_of_entries(0), _loader_data(loader_data) {
size_t start_size_log_2 = MAX2(ceil_log2(table_size), (size_t)2); // 2 is minimum size even though some dictionaries only have one entry
size_t current_size = ((size_t)1) << start_size_log_2;
@ -104,8 +104,7 @@ int Dictionary::table_size() const {
}
bool Dictionary::check_if_needs_resize() {
return (_resizable &&
(_number_of_entries > (_resize_load_trigger * table_size())) &&
return ((_number_of_entries > (_resize_load_trigger * table_size())) &&
!_table->is_max_size_reached());
}
@ -480,8 +479,8 @@ void DictionaryEntry::print_count(outputStream *st) {
// ----------------------------------------------------------------------------
void Dictionary::print_size(outputStream* st) const {
st->print_cr("Java dictionary (table_size=%d, classes=%d, resizable=%s)",
table_size(), _number_of_entries, BOOL_TO_STR(_resizable));
st->print_cr("Java dictionary (table_size=%d, classes=%d)",
table_size(), _number_of_entries);
}
void Dictionary::print_on(outputStream* st) const {

View File

@ -41,7 +41,6 @@ template <typename T> class GrowableArray;
class DictionaryEntry;
class Dictionary : public CHeapObj<mtClass> {
bool _resizable;
int _number_of_entries;
class Config {
@ -63,7 +62,7 @@ class Dictionary : public CHeapObj<mtClass> {
int table_size() const;
public:
Dictionary(ClassLoaderData* loader_data, size_t table_size, bool resizable = false);
Dictionary(ClassLoaderData* loader_data, size_t table_size);
~Dictionary();
void add_klass(JavaThread* current, Symbol* class_name, InstanceKlass* obj);

View File

@ -676,9 +676,6 @@ const int ObjectAlignmentInBytes = 8;
notproduct(bool, PrintClassLoaderDataGraphAtExit, false, \
"Print the class loader data graph at exit") \
\
product(bool, DynamicallyResizeSystemDictionaries, true, DIAGNOSTIC, \
"Dynamically resize system dictionaries as needed") \
\
product(bool, AllowParallelDefineClass, false, \
"Allow parallel defineClass requests for class loaders " \
"registering as parallel capable") \