src/hotspot/share/classfile/classLoaderData.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/hotspot/share/classfile/classLoaderData.cpp Tue Oct 10 13:48:49 2017
--- new/src/hotspot/share/classfile/classLoaderData.cpp Tue Oct 10 13:48:49 2017
*** 603,646 ****
--- 603,633 ----
return modules;
}
const int _boot_loader_dictionary_size = 1009;
const int _default_loader_dictionary_size = 107;
const int _prime_array_size = 8; // array of primes for system dictionary size
const int _average_depth_goal = 3; // goal for lookup length
const int _primelist[_prime_array_size] = {107, 1009, 2017, 4049, 5051, 10103, 20201, 40423};
// Calculate a "good" dictionary size based
// on predicted or current loaded classes count.
static int calculate_dictionary_size(int classcount) {
int newsize = _primelist[0];
if (classcount > 0 && !DumpSharedSpaces) {
int index = 0;
int desiredsize = classcount/_average_depth_goal;
for (newsize = _primelist[index]; index < _prime_array_size -1;
newsize = _primelist[++index]) {
if (desiredsize <= newsize) {
break;
}
}
}
return newsize;
}
Dictionary* ClassLoaderData::create_dictionary() {
assert(!is_anonymous(), "anonymous class loader data do 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(SystemDictionary::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 = calculate_dictionary_size(PredictedLoadedClassCount);
! size = _default_loader_dictionary_size;
+ resizable = true;
} else {
size = _default_loader_dictionary_size;
+ resizable = true;
+ }
+ if (!DynamicallyResizeSystemDictionaries || DumpSharedSpaces || UseSharedSpaces) {
+ resizable = false;
}
! return new Dictionary(this, size, resizable);
}
// Unloading support
oop ClassLoaderData::keep_alive_object() const {
assert_locked_or_safepoint(_metaspace_lock);
*** 1324,1333 ****
--- 1311,1331 ----
Metaspace::purge();
set_metaspace_oom(false);
}
}
+ int ClassLoaderDataGraph::resize_if_needed() {
+ assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
+ int resized = 0;
+ FOR_ALL_DICTIONARY(cld) {
+ if (cld->dictionary()->resize_if_needed()) {
+ resized++;
+ }
+ }
+ return resized;
+ }
+
void ClassLoaderDataGraph::post_class_unload_events() {
#if INCLUDE_TRACE
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
if (Tracing::enabled()) {
if (Tracing::is_event_enabled(TraceClassUnloadEvent)) {
src/hotspot/share/classfile/classLoaderData.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File