mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
7114376: Make system dictionary hashtable bucket array size configurable
7u4 new experimental flag -XX:PredictedClassLoadedCount=# Reviewed-by: dholmes, phh, dcubed
This commit is contained in:
parent
d5546e27cf
commit
ce074f86c3
8 changed files with 46 additions and 36 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -64,6 +64,9 @@ SymbolPropertyTable* SystemDictionary::_invoke_method_table = NULL;
|
|||
|
||||
|
||||
int SystemDictionary::_number_of_modifications = 0;
|
||||
int SystemDictionary::_sdgeneration = 0;
|
||||
const int SystemDictionary::_primelist[_prime_array_size] = {1009,2017,4049,5051,10103,
|
||||
20201,40423,99991};
|
||||
|
||||
oop SystemDictionary::_system_loader_lock_obj = NULL;
|
||||
|
||||
|
@ -1178,8 +1181,8 @@ void SystemDictionary::set_shared_dictionary(HashtableBucket* t, int length,
|
|||
|
||||
klassOop SystemDictionary::find_shared_class(Symbol* class_name) {
|
||||
if (shared_dictionary() != NULL) {
|
||||
unsigned int d_hash = dictionary()->compute_hash(class_name, Handle());
|
||||
int d_index = dictionary()->hash_to_index(d_hash);
|
||||
unsigned int d_hash = shared_dictionary()->compute_hash(class_name, Handle());
|
||||
int d_index = shared_dictionary()->hash_to_index(d_hash);
|
||||
return shared_dictionary()->find_shared_class(d_index, d_hash, class_name);
|
||||
} else {
|
||||
return NULL;
|
||||
|
@ -1750,7 +1753,21 @@ void SystemDictionary::placeholders_do(OopClosure* blk) {
|
|||
placeholders()->oops_do(blk);
|
||||
}
|
||||
|
||||
|
||||
// Calculate a "good" systemdictionary size based
|
||||
// on predicted or current loaded classes count
|
||||
int SystemDictionary::calculate_systemdictionary_size(int classcount) {
|
||||
int newsize = _old_default_sdsize;
|
||||
if ((classcount > 0) && !DumpSharedSpaces) {
|
||||
int desiredsize = classcount/_average_depth_goal;
|
||||
for (newsize = _primelist[_sdgeneration]; _sdgeneration < _prime_array_size -1;
|
||||
newsize = _primelist[++_sdgeneration]) {
|
||||
if (desiredsize <= newsize) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return newsize;
|
||||
}
|
||||
bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) {
|
||||
bool result = dictionary()->do_unloading(is_alive);
|
||||
constraints()->purge_loader_constraints(is_alive);
|
||||
|
@ -1873,7 +1890,8 @@ void SystemDictionary::initialize(TRAPS) {
|
|||
// Allocate arrays
|
||||
assert(dictionary() == NULL,
|
||||
"SystemDictionary should only be initialized once");
|
||||
_dictionary = new Dictionary(_nof_buckets);
|
||||
_sdgeneration = 0;
|
||||
_dictionary = new Dictionary(calculate_systemdictionary_size(PredictedLoadedClassCount));
|
||||
_placeholders = new PlaceholderTable(_nof_buckets);
|
||||
_number_of_modifications = 0;
|
||||
_loader_constraints = new LoaderConstraintTable(_loader_constraint_size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue