8252589: Code duplication in ParallelSPCleanupTask
Reviewed-by: shade, dholmes
This commit is contained in:
parent
02049ee6c3
commit
7282d0deb5
@ -501,6 +501,23 @@ class ParallelSPCleanupTask : public AbstractGangTask {
|
||||
private:
|
||||
SubTasksDone _subtasks;
|
||||
uint _num_workers;
|
||||
|
||||
class Tracer {
|
||||
private:
|
||||
const char* _name;
|
||||
EventSafepointCleanupTask _event;
|
||||
TraceTime _timer;
|
||||
|
||||
public:
|
||||
Tracer(const char* name) :
|
||||
_name(name),
|
||||
_event(),
|
||||
_timer(name, TRACETIME_LOG(Info, safepoint, cleanup)) {}
|
||||
~Tracer() {
|
||||
post_safepoint_cleanup_task_event(_event, SafepointSynchronize::safepoint_id(), _name);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
ParallelSPCleanupTask(uint num_workers) :
|
||||
AbstractGangTask("Parallel Safepoint Cleanup"),
|
||||
@ -508,65 +525,39 @@ public:
|
||||
_num_workers(num_workers) {}
|
||||
|
||||
void work(uint worker_id) {
|
||||
uint64_t safepoint_id = SafepointSynchronize::safepoint_id();
|
||||
|
||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_DEFLATE_MONITORS)) {
|
||||
const char* name = "deflating idle monitors";
|
||||
EventSafepointCleanupTask event;
|
||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
Tracer t("deflating idle monitors");
|
||||
ObjectSynchronizer::do_safepoint_work();
|
||||
|
||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||
}
|
||||
|
||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_UPDATE_INLINE_CACHES)) {
|
||||
const char* name = "updating inline caches";
|
||||
EventSafepointCleanupTask event;
|
||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
Tracer t("updating inline caches");
|
||||
InlineCacheBuffer::update_inline_caches();
|
||||
|
||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||
}
|
||||
|
||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_COMPILATION_POLICY)) {
|
||||
const char* name = "compilation policy safepoint handler";
|
||||
EventSafepointCleanupTask event;
|
||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
Tracer t("compilation policy safepoint handler");
|
||||
CompilationPolicy::policy()->do_safepoint_work();
|
||||
|
||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||
}
|
||||
|
||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_SYMBOL_TABLE_REHASH)) {
|
||||
if (SymbolTable::needs_rehashing()) {
|
||||
const char* name = "rehashing symbol table";
|
||||
EventSafepointCleanupTask event;
|
||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
Tracer t("rehashing symbol table");
|
||||
SymbolTable::rehash_table();
|
||||
|
||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||
}
|
||||
}
|
||||
|
||||
if (_subtasks.try_claim_task(SafepointSynchronize::SAFEPOINT_CLEANUP_STRING_TABLE_REHASH)) {
|
||||
if (StringTable::needs_rehashing()) {
|
||||
const char* name = "rehashing string table";
|
||||
EventSafepointCleanupTask event;
|
||||
TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
|
||||
Tracer t("rehashing string table");
|
||||
StringTable::rehash_table();
|
||||
|
||||
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));
|
||||
Tracer t("resizing system dictionaries");
|
||||
ClassLoaderDataGraph::resize_dictionaries();
|
||||
|
||||
post_safepoint_cleanup_task_event(event, safepoint_id, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user