8234531: Remove CMS code from CLDG and safepoint cleanup
Reviewed-by: coleenp, zgu
This commit is contained in:
parent
b468726bdc
commit
1b3fd96d2a
@ -186,10 +186,7 @@ void ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces() {
|
|||||||
// GC root of class loader data created.
|
// GC root of class loader data created.
|
||||||
ClassLoaderData* volatile ClassLoaderDataGraph::_head = NULL;
|
ClassLoaderData* volatile ClassLoaderDataGraph::_head = NULL;
|
||||||
ClassLoaderData* ClassLoaderDataGraph::_unloading = 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::_should_clean_deallocate_lists = false;
|
||||||
bool ClassLoaderDataGraph::_safepoint_cleanup_needed = false;
|
bool ClassLoaderDataGraph::_safepoint_cleanup_needed = false;
|
||||||
bool ClassLoaderDataGraph::_metaspace_oom = false;
|
bool ClassLoaderDataGraph::_metaspace_oom = false;
|
||||||
@ -249,9 +246,7 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_unsafe_anonymo
|
|||||||
|
|
||||||
void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
|
void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
|
||||||
assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
|
assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
|
||||||
// Only walk the head until any clds not purged from prior unloading
|
for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
|
||||||
// (CMS doesn't purge right away).
|
|
||||||
for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
|
|
||||||
assert(cld->is_unloading(), "invariant");
|
assert(cld->is_unloading(), "invariant");
|
||||||
cl->do_cld(cld);
|
cl->do_cld(cld);
|
||||||
}
|
}
|
||||||
@ -381,9 +376,7 @@ void ClassLoaderDataGraph::modules_do(void f(ModuleEntry*)) {
|
|||||||
|
|
||||||
void ClassLoaderDataGraph::modules_unloading_do(void f(ModuleEntry*)) {
|
void ClassLoaderDataGraph::modules_unloading_do(void f(ModuleEntry*)) {
|
||||||
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
||||||
// Only walk the head until any clds not purged from prior unloading
|
for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
|
||||||
// (CMS doesn't purge right away).
|
|
||||||
for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
|
|
||||||
assert(cld->is_unloading(), "invariant");
|
assert(cld->is_unloading(), "invariant");
|
||||||
cld->modules_do(f);
|
cld->modules_do(f);
|
||||||
}
|
}
|
||||||
@ -399,9 +392,7 @@ void ClassLoaderDataGraph::packages_do(void f(PackageEntry*)) {
|
|||||||
|
|
||||||
void ClassLoaderDataGraph::packages_unloading_do(void f(PackageEntry*)) {
|
void ClassLoaderDataGraph::packages_unloading_do(void f(PackageEntry*)) {
|
||||||
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
||||||
// Only walk the head until any clds not purged from prior unloading
|
for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
|
||||||
// (CMS doesn't purge right away).
|
|
||||||
for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
|
|
||||||
assert(cld->is_unloading(), "invariant");
|
assert(cld->is_unloading(), "invariant");
|
||||||
cld->packages_do(f);
|
cld->packages_do(f);
|
||||||
}
|
}
|
||||||
@ -424,9 +415,7 @@ void ClassLoaderDataGraph::unlocked_loaded_classes_do(KlassClosure* klass_closur
|
|||||||
|
|
||||||
void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
|
void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
|
||||||
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
||||||
// Only walk the head until any clds not purged from prior unloading
|
for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
|
||||||
// (CMS doesn't purge right away).
|
|
||||||
for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
|
|
||||||
assert(cld->is_unloading(), "invariant");
|
assert(cld->is_unloading(), "invariant");
|
||||||
cld->classes_do(f);
|
cld->classes_do(f);
|
||||||
}
|
}
|
||||||
@ -476,32 +465,6 @@ void ClassLoaderDataGraph::print_table_statistics(outputStream* st) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
#ifndef PRODUCT
|
||||||
bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
|
bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
|
||||||
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
|
||||||
@ -544,10 +507,6 @@ bool ClassLoaderDataGraph::do_unloading() {
|
|||||||
uint loaders_processed = 0;
|
uint loaders_processed = 0;
|
||||||
uint loaders_removed = 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;
|
data = _head;
|
||||||
while (data != NULL) {
|
while (data != NULL) {
|
||||||
if (data->is_alive()) {
|
if (data->is_alive()) {
|
||||||
|
@ -43,10 +43,6 @@ class ClassLoaderDataGraph : public AllStatic {
|
|||||||
// All CLDs (except the null CLD) can be reached by walking _head->_next->...
|
// All CLDs (except the null CLD) can be reached by walking _head->_next->...
|
||||||
static ClassLoaderData* volatile _head;
|
static ClassLoaderData* volatile _head;
|
||||||
static ClassLoaderData* _unloading;
|
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
|
// Set if there's anything to purge in the deallocate lists or previous versions
|
||||||
// during a safepoint after class unloading in a full GC.
|
// during a safepoint after class unloading in a full GC.
|
||||||
@ -115,18 +111,6 @@ class ClassLoaderDataGraph : public AllStatic {
|
|||||||
static void print_dictionary(outputStream* st);
|
static void print_dictionary(outputStream* st);
|
||||||
static void print_table_statistics(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 int resize_dictionaries();
|
||||||
|
|
||||||
static bool has_metaspace_oom() { return _metaspace_oom; }
|
static bool has_metaspace_oom() { return _metaspace_oom; }
|
||||||
|
@ -620,19 +620,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
|
||||||
if (Dictionary::does_any_dictionary_needs_resizing()) {
|
if (Dictionary::does_any_dictionary_needs_resizing()) {
|
||||||
const char* name = "resizing system dictionaries";
|
const char* name = "resizing system dictionaries";
|
||||||
|
@ -75,7 +75,6 @@ class SafepointSynchronize : AllStatic {
|
|||||||
SAFEPOINT_CLEANUP_COMPILATION_POLICY,
|
SAFEPOINT_CLEANUP_COMPILATION_POLICY,
|
||||||
SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH,
|
SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH,
|
||||||
SAFEPOINT_CLEANUP_STRING_TABLE_REHASH,
|
SAFEPOINT_CLEANUP_STRING_TABLE_REHASH,
|
||||||
SAFEPOINT_CLEANUP_CLD_PURGE,
|
|
||||||
SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE,
|
SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE,
|
||||||
SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP,
|
SAFEPOINT_CLEANUP_REQUEST_OOPSTORAGE_CLEANUP,
|
||||||
// Leave this one last.
|
// Leave this one last.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user