mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8224119: Safepoint cleanup logging logs times for things it doesn't do
Test condition before reporting times for cleanup actions. Reviewed-by: rehn, hseigel
This commit is contained in:
parent
b730805159
commit
168e5cbf66
4 changed files with 29 additions and 28 deletions
|
@ -596,16 +596,15 @@ void ClassLoaderDataGraph::purge() {
|
|||
DependencyContext::purge_dependency_contexts();
|
||||
}
|
||||
|
||||
int ClassLoaderDataGraph::resize_if_needed() {
|
||||
int ClassLoaderDataGraph::resize_dictionaries() {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
|
||||
int resized = 0;
|
||||
if (Dictionary::does_any_dictionary_needs_resizing()) {
|
||||
assert (Dictionary::does_any_dictionary_needs_resizing(), "some dictionary should need resizing");
|
||||
FOR_ALL_DICTIONARY(cld) {
|
||||
if (cld->dictionary()->resize_if_needed()) {
|
||||
resized++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return resized;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,16 +119,14 @@ class ClassLoaderDataGraph : public AllStatic {
|
|||
static GrowableArray<ClassLoaderData*>* new_clds();
|
||||
|
||||
static void set_should_purge(bool b) { _should_purge = b; }
|
||||
static void purge_if_needed() {
|
||||
// Only purge the CLDG for CMS if concurrent sweep is complete.
|
||||
if (_should_purge) {
|
||||
purge();
|
||||
static bool should_purge_and_reset() {
|
||||
bool res = _should_purge;
|
||||
// reset for next time.
|
||||
set_should_purge(false);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static int resize_if_needed();
|
||||
static int resize_dictionaries();
|
||||
|
||||
static bool has_metaspace_oom() { return _metaspace_oom; }
|
||||
static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/classLoaderDataGraph.inline.hpp"
|
||||
#include "classfile/dictionary.hpp"
|
||||
#include "classfile/stringTable.hpp"
|
||||
#include "classfile/symbolTable.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
|
@ -610,24 +611,28 @@ 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_if_needed();
|
||||
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";
|
||||
EventSafepointCleanupTask event;
|
||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
ClassLoaderDataGraph::resize_if_needed();
|
||||
ClassLoaderDataGraph::resize_dictionaries();
|
||||
|
||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||
}
|
||||
}
|
||||
|
||||
_subtasks.all_tasks_completed(_num_workers);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
|
@ -43,7 +43,6 @@ public class SafepointCleanupTest {
|
|||
output.shouldContain("deflating per-thread idle monitors");
|
||||
output.shouldContain("updating inline caches");
|
||||
output.shouldContain("compilation policy safepoint handler");
|
||||
output.shouldContain("purging class loader data graph");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue