8209852: Counters in StringCleaningTask should be type of size_t
Summary: Converted counters to size_t type to avoid casting
Reviewed-by: coleenp
--- a/src/hotspot/share/classfile/stringTable.cpp Mon Aug 27 12:45:31 2018 -0700
+++ b/src/hotspot/share/classfile/stringTable.cpp Mon Aug 27 17:20:29 2018 -0400
@@ -395,7 +395,7 @@
};
void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f,
- int* processed, int* removed) {
+ size_t* processed, size_t* removed) {
DoNothingClosure dnc;
assert(is_alive != NULL, "No closure");
StringTableIsAliveCounter stiac(is_alive);
@@ -409,10 +409,10 @@
StringTable::the_table()->check_concurrent_work();
if (processed != NULL) {
- *processed = (int) stiac._count_total;
+ *processed = stiac._count_total;
}
if (removed != NULL) {
- *removed = (int) stiac._count;
+ *removed = stiac._count;
}
}
@@ -423,7 +423,7 @@
void StringTable::possibly_parallel_unlink(
OopStorage::ParState<false, false>* _par_state_string, BoolObjectClosure* cl,
- int* processed, int* removed)
+ size_t* processed, size_t* removed)
{
DoNothingClosure dnc;
assert(cl != NULL, "No closure");
@@ -434,8 +434,8 @@
// Accumulate the dead strings.
the_table()->add_items_count_to_clean(stiac._count);
- *processed = (int) stiac._count_total;
- *removed = (int) stiac._count;
+ *processed = stiac._count_total;
+ *removed = stiac._count;
}
void StringTable::possibly_parallel_oops_do(
--- a/src/hotspot/share/classfile/stringTable.hpp Mon Aug 27 12:45:31 2018 -0700
+++ b/src/hotspot/share/classfile/stringTable.hpp Mon Aug 27 17:20:29 2018 -0400
@@ -136,7 +136,7 @@
unlink_or_oops_do(cl);
}
static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f = NULL,
- int* processed = NULL, int* removed = NULL);
+ size_t* processed = NULL, size_t* removed = NULL);
// Serially invoke "f->do_oop" on the locations of all oops in the table.
static void oops_do(OopClosure* f);
@@ -144,7 +144,7 @@
// Possibly parallel versions of the above
static void possibly_parallel_unlink(
OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
- BoolObjectClosure* cl, int* processed, int* removed);
+ BoolObjectClosure* cl, size_t* processed, size_t* removed);
static void possibly_parallel_oops_do(
OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
OopClosure* f);
--- a/src/hotspot/share/gc/shared/parallelCleaning.cpp Mon Aug 27 12:45:31 2018 -0700
+++ b/src/hotspot/share/gc/shared/parallelCleaning.cpp Mon Aug 27 17:20:29 2018 -0400
@@ -54,8 +54,8 @@
}
void StringCleaningTask::work(uint worker_id) {
- int strings_processed = 0;
- int strings_removed = 0;
+ size_t strings_processed = 0;
+ size_t strings_removed = 0;
if (_process_strings) {
StringTable::possibly_parallel_unlink(&_par_state_string, _is_alive, &strings_processed, &strings_removed);
Atomic::add(strings_processed, &_strings_processed);
--- a/src/hotspot/share/gc/shared/parallelCleaning.hpp Mon Aug 27 12:45:31 2018 -0700
+++ b/src/hotspot/share/gc/shared/parallelCleaning.hpp Mon Aug 27 17:20:29 2018 -0400
@@ -40,9 +40,9 @@
int _initial_string_table_size;
- bool _process_strings;
- int _strings_processed;
- int _strings_removed;
+ bool _process_strings;
+ volatile size_t _strings_processed;
+ volatile size_t _strings_removed;
public:
StringCleaningTask(BoolObjectClosure* is_alive, StringDedupUnlinkOrOopsDoClosure* dedup_closure, bool process_strings);
@@ -50,8 +50,8 @@
void work(uint worker_id);
- size_t strings_processed() const { return (size_t)_strings_processed; }
- size_t strings_removed() const { return (size_t)_strings_removed; }
+ size_t strings_processed() const { return _strings_processed; }
+ size_t strings_removed() const { return _strings_removed; }
};
class CodeCacheUnloadingTask {