Skip to content

Commit

Permalink
8295029: runtime/cds/appcds/LotsOfClasses.java fail with jfx
Browse files Browse the repository at this point in the history
Reviewed-by: iklam, ccheung, gziemski
  • Loading branch information
coleenp committed Oct 18, 2022
1 parent 0233ba7 commit 37f93b6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
9 changes: 1 addition & 8 deletions src/hotspot/share/classfile/classLoaderData.cpp
Expand Up @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions src/hotspot/share/classfile/dictionary.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/classfile/dictionary.hpp
Expand Up @@ -41,7 +41,6 @@ template <typename T> class GrowableArray;
class DictionaryEntry;

class Dictionary : public CHeapObj<mtClass> {
bool _resizable;
int _number_of_entries;

class Config {
Expand All @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/runtime/globals.hpp
Expand Up @@ -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") \
Expand Down

0 comments on commit 37f93b6

Please sign in to comment.