8234531: Remove CMS code from CLDG and safepoint cleanup
Reviewed-by: coleenp, zgu
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp Mon Nov 25 15:00:32 2019 +0100
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp Mon Nov 25 15:21:44 2019 +0000
@@ -186,10 +186,7 @@
// GC root of class loader data created.
ClassLoaderData* volatile ClassLoaderDataGraph::_head = NULL;
ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
-ClassLoaderData* ClassLoaderDataGraph::_saved_unloading = NULL;
-ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
-bool ClassLoaderDataGraph::_should_purge = false;
bool ClassLoaderDataGraph::_should_clean_deallocate_lists = false;
bool ClassLoaderDataGraph::_safepoint_cleanup_needed = false;
bool ClassLoaderDataGraph::_metaspace_oom = false;
@@ -249,9 +246,7 @@
void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
- // Only walk the head until any clds not purged from prior unloading
- // (CMS doesn't purge right away).
- for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+ for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
assert(cld->is_unloading(), "invariant");
cl->do_cld(cld);
}
@@ -381,9 +376,7 @@
void ClassLoaderDataGraph::modules_unloading_do(void f(ModuleEntry*)) {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
- // Only walk the head until any clds not purged from prior unloading
- // (CMS doesn't purge right away).
- for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+ for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
assert(cld->is_unloading(), "invariant");
cld->modules_do(f);
}
@@ -399,9 +392,7 @@
void ClassLoaderDataGraph::packages_unloading_do(void f(PackageEntry*)) {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
- // Only walk the head until any clds not purged from prior unloading
- // (CMS doesn't purge right away).
- for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+ for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
assert(cld->is_unloading(), "invariant");
cld->packages_do(f);
}
@@ -424,9 +415,7 @@
void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
- // Only walk the head until any clds not purged from prior unloading
- // (CMS doesn't purge right away).
- for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
+ for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
assert(cld->is_unloading(), "invariant");
cld->classes_do(f);
}
@@ -476,32 +465,6 @@
}
}
-GrowableArray<ClassLoaderData*>* ClassLoaderDataGraph::new_clds() {
- assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
- assert(_head == NULL || _saved_head != NULL, "remember_new_clds(true) not called?");
-
- GrowableArray<ClassLoaderData*>* array = new GrowableArray<ClassLoaderData*>();
-
- // The CLDs in [_head, _saved_head] were all added during last call to remember_new_clds(true);
- ClassLoaderData* curr = _head;
- while (curr != _saved_head) {
- if (!curr->claimed(ClassLoaderData::_claim_strong)) {
- array->push(curr);
- LogTarget(Debug, class, loader, data) lt;
- if (lt.is_enabled()) {
- LogStream ls(lt);
- ls.print("found new CLD: ");
- curr->print_value_on(&ls);
- ls.cr();
- }
- }
-
- curr = curr->_next;
- }
-
- return array;
-}
-
#ifndef PRODUCT
bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
@@ -544,10 +507,6 @@
uint loaders_processed = 0;
uint loaders_removed = 0;
- // Save previous _unloading pointer for CMS which may add to unloading list before
- // purging and we don't want to rewalk the previously unloaded class loader data.
- _saved_unloading = _unloading;
-
data = _head;
while (data != NULL) {
if (data->is_alive()) {
--- a/src/hotspot/share/classfile/classLoaderDataGraph.hpp Mon Nov 25 15:00:32 2019 +0100
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.hpp Mon Nov 25 15:21:44 2019 +0000
@@ -43,10 +43,6 @@
// All CLDs (except the null CLD) can be reached by walking _head->_next->...
static ClassLoaderData* volatile _head;
static ClassLoaderData* _unloading;
- // CMS support.
- static ClassLoaderData* _saved_head;
- static ClassLoaderData* _saved_unloading;
- static bool _should_purge;
// Set if there's anything to purge in the deallocate lists or previous versions
// during a safepoint after class unloading in a full GC.
@@ -115,18 +111,6 @@
static void print_dictionary(outputStream* st);
static void print_table_statistics(outputStream* st);
- // CMS support.
- static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
- static GrowableArray<ClassLoaderData*>* new_clds();
-
- static void set_should_purge(bool b) { _should_purge = b; }
- static bool should_purge_and_reset() {
- bool res = _should_purge;
- // reset for next time.
- set_should_purge(false);
- return res;
- }
-
static int resize_dictionaries();
static bool has_metaspace_oom() { return _metaspace_oom; }
--- a/src/hotspot/share/runtime/safepoint.cpp Mon Nov 25 15:00:32 2019 +0100
+++ b/src/hotspot/share/runtime/safepoint.cpp Mon Nov 25 15:21:44 2019 +0000
@@ -620,19 +620,6 @@
}
}
- if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_CLD_PURGE)) {
- if (ClassLoaderDataGraph::should_purge_and_reset()) {
- // CMS delays purging the CLDG until the beginning of the next safepoint and to
- // make sure concurrent sweep is done
- const char* name = "purging class loader data graph";
- EventSafepointCleanupTask event;
- TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
- ClassLoaderDataGraph::purge();
-
- post_safepoint_cleanup_task_event(event, safepoint_id, name);
- }
- }
-
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
if (Dictionary::does_any_dictionary_needs_resizing()) {
const char* name = "resizing system dictionaries";
--- a/src/hotspot/share/runtime/safepoint.hpp Mon Nov 25 15:00:32 2019 +0100
+++ b/src/hotspot/share/runtime/safepoint.hpp Mon Nov 25 15:21:44 2019 +0000
@@ -75,7 +75,6 @@
SAFEPOINT_CLEANUP_COMPILATION_POLICY,
SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH,
SAFEPOINT_CLEANUP_STRING_TABLE_REHASH,
- SAFEPOINT_CLEANUP_CLD_PURGE,
SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE,
SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP,
// Leave this one last.