< prev index next >
src/hotspot/share/classfile/stringTable.cpp
Print this page
rev 50539 : [mq]: 8204613-stringtable-unclean-fix
*** 196,216 ****
size_t StringTable::item_added() {
return Atomic::add((size_t)1, &(the_table()->_items));
}
! size_t StringTable::items_to_clean(size_t ncl) {
! size_t total = Atomic::add((size_t)ncl, &(the_table()->_uncleaned_items));
log_trace(stringtable)(
"Uncleaned items:" SIZE_FORMAT " added: " SIZE_FORMAT " total:" SIZE_FORMAT,
! the_table()->_uncleaned_items, ncl, total);
return total;
}
void StringTable::item_removed() {
Atomic::add((size_t)-1, &(the_table()->_items));
- Atomic::add((size_t)-1, &(the_table()->_uncleaned_items));
}
double StringTable::get_load_factor() {
return (_items*1.0)/_current_size;
}
--- 196,215 ----
size_t StringTable::item_added() {
return Atomic::add((size_t)1, &(the_table()->_items));
}
! size_t StringTable::add_items_to_clean(size_t ndead) {
! size_t total = Atomic::add((size_t)ndead, &(the_table()->_uncleaned_items));
log_trace(stringtable)(
"Uncleaned items:" SIZE_FORMAT " added: " SIZE_FORMAT " total:" SIZE_FORMAT,
! the_table()->_uncleaned_items, ndead, total);
return total;
}
void StringTable::item_removed() {
Atomic::add((size_t)-1, &(the_table()->_items));
}
double StringTable::get_load_factor() {
return (_items*1.0)/_current_size;
}
*** 403,414 ****
StringTableIsAliveCounter stiac(is_alive);
OopClosure* tmp = f != NULL ? f : &dnc;
StringTable::the_table()->_weak_handles->weak_oops_do(&stiac, tmp);
! StringTable::the_table()->items_to_clean(stiac._count);
StringTable::the_table()->check_concurrent_work();
if (processed != NULL) {
*processed = (int) stiac._count_total;
}
if (removed != NULL) {
*removed = (int) stiac._count;
--- 402,416 ----
StringTableIsAliveCounter stiac(is_alive);
OopClosure* tmp = f != NULL ? f : &dnc;
StringTable::the_table()->_weak_handles->weak_oops_do(&stiac, tmp);
! // This is the serial case without ParState.
! // Just set the correct number and check for a cleaning phase.
! the_table()->_uncleaned_items = stiac._count;
StringTable::the_table()->check_concurrent_work();
+
if (processed != NULL) {
*processed = (int) stiac._count_total;
}
if (removed != NULL) {
*removed = (int) stiac._count;
*** 428,439 ****
assert(cl != NULL, "No closure");
StringTableIsAliveCounter stiac(cl);
_par_state_string->weak_oops_do(&stiac, &dnc);
! StringTable::the_table()->items_to_clean(stiac._count);
! StringTable::the_table()->check_concurrent_work();
*processed = (int) stiac._count_total;
*removed = (int) stiac._count;
}
void StringTable::possibly_parallel_oops_do(
--- 430,442 ----
assert(cl != NULL, "No closure");
StringTableIsAliveCounter stiac(cl);
_par_state_string->weak_oops_do(&stiac, &dnc);
! // Accumulate the dead strings.
! the_table()->add_items_to_clean(stiac._count);
!
*processed = (int) stiac._count_total;
*removed = (int) stiac._count;
}
void StringTable::possibly_parallel_oops_do(
*** 465,478 ****
_current_size = table_size(jt);
log_debug(stringtable)("Grown to size:" SIZE_FORMAT, _current_size);
}
struct StringTableDoDelete : StackObj {
- long _count;
- StringTableDoDelete() : _count(0) {}
void operator()(WeakHandle<vm_string_table_data>* val) {
! ++_count;
}
};
struct StringTableDeleteCheck : StackObj {
long _count;
--- 468,479 ----
_current_size = table_size(jt);
log_debug(stringtable)("Grown to size:" SIZE_FORMAT, _current_size);
}
struct StringTableDoDelete : StackObj {
void operator()(WeakHandle<vm_string_table_data>* val) {
! /* do nothing */
}
};
struct StringTableDeleteCheck : StackObj {
long _count;
*** 522,531 ****
--- 523,533 ----
void StringTable::check_concurrent_work() {
if (_has_work) {
return;
}
+
double load_factor = StringTable::get_load_factor();
double dead_factor = StringTable::get_dead_factor();
// We should clean/resize if we have more dead than alive,
// more items than preferred load factor or
// more dead items than water mark.
< prev index next >