8227927: Move ParallelCleaningTask back to G1
Reviewed-by: tschatzl, kbarrett
This commit is contained in:
parent
00395fe0d0
commit
f2e1bfa38a
@ -48,6 +48,7 @@
|
|||||||
#include "gc/g1/g1HotCardCache.hpp"
|
#include "gc/g1/g1HotCardCache.hpp"
|
||||||
#include "gc/g1/g1MemoryPool.hpp"
|
#include "gc/g1/g1MemoryPool.hpp"
|
||||||
#include "gc/g1/g1OopClosures.inline.hpp"
|
#include "gc/g1/g1OopClosures.inline.hpp"
|
||||||
|
#include "gc/g1/g1ParallelCleaning.hpp"
|
||||||
#include "gc/g1/g1ParScanThreadState.inline.hpp"
|
#include "gc/g1/g1ParScanThreadState.inline.hpp"
|
||||||
#include "gc/g1/g1Policy.hpp"
|
#include "gc/g1/g1Policy.hpp"
|
||||||
#include "gc/g1/g1RedirtyCardsQueue.hpp"
|
#include "gc/g1/g1RedirtyCardsQueue.hpp"
|
||||||
@ -74,7 +75,6 @@
|
|||||||
#include "gc/shared/generationSpec.hpp"
|
#include "gc/shared/generationSpec.hpp"
|
||||||
#include "gc/shared/isGCActiveMark.hpp"
|
#include "gc/shared/isGCActiveMark.hpp"
|
||||||
#include "gc/shared/oopStorageParState.hpp"
|
#include "gc/shared/oopStorageParState.hpp"
|
||||||
#include "gc/shared/parallelCleaning.hpp"
|
|
||||||
#include "gc/shared/preservedMarks.inline.hpp"
|
#include "gc/shared/preservedMarks.inline.hpp"
|
||||||
#include "gc/shared/suspendibleThreadSet.hpp"
|
#include "gc/shared/suspendibleThreadSet.hpp"
|
||||||
#include "gc/shared/referenceProcessor.inline.hpp"
|
#include "gc/shared/referenceProcessor.inline.hpp"
|
||||||
@ -3165,7 +3165,7 @@ void G1ParEvacuateFollowersClosure::do_void() {
|
|||||||
void G1CollectedHeap::complete_cleaning(BoolObjectClosure* is_alive,
|
void G1CollectedHeap::complete_cleaning(BoolObjectClosure* is_alive,
|
||||||
bool class_unloading_occurred) {
|
bool class_unloading_occurred) {
|
||||||
uint num_workers = workers()->active_workers();
|
uint num_workers = workers()->active_workers();
|
||||||
ParallelCleaningTask unlink_task(is_alive, num_workers, class_unloading_occurred, false);
|
G1ParallelCleaningTask unlink_task(is_alive, num_workers, class_unloading_occurred, false);
|
||||||
workers()->run_task(&unlink_task);
|
workers()->run_task(&unlink_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
83
src/hotspot/share/gc/g1/g1ParallelCleaning.cpp
Normal file
83
src/hotspot/share/gc/g1/g1ParallelCleaning.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 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
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precompiled.hpp"
|
||||||
|
|
||||||
|
#include "gc/g1/g1ParallelCleaning.hpp"
|
||||||
|
#if INCLUDE_JVMCI
|
||||||
|
#include "jvmci/jvmci.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if INCLUDE_JVMCI
|
||||||
|
JVMCICleaningTask::JVMCICleaningTask() :
|
||||||
|
_cleaning_claimed(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JVMCICleaningTask::claim_cleaning_task() {
|
||||||
|
if (_cleaning_claimed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Atomic::cmpxchg(1, &_cleaning_claimed, 0) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JVMCICleaningTask::work(bool unloading_occurred) {
|
||||||
|
// One worker will clean JVMCI metadata handles.
|
||||||
|
if (unloading_occurred && EnableJVMCI && claim_cleaning_task()) {
|
||||||
|
JVMCI::do_unloading(unloading_occurred);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // INCLUDE_JVMCI
|
||||||
|
|
||||||
|
G1ParallelCleaningTask::G1ParallelCleaningTask(BoolObjectClosure* is_alive,
|
||||||
|
uint num_workers,
|
||||||
|
bool unloading_occurred,
|
||||||
|
bool resize_dedup_table) :
|
||||||
|
AbstractGangTask("G1 Parallel Cleaning"),
|
||||||
|
_unloading_occurred(unloading_occurred),
|
||||||
|
_string_dedup_task(is_alive, NULL, resize_dedup_table),
|
||||||
|
_code_cache_task(num_workers, is_alive, unloading_occurred),
|
||||||
|
JVMCI_ONLY(_jvmci_cleaning_task() COMMA)
|
||||||
|
_klass_cleaning_task() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// The parallel work done by all worker threads.
|
||||||
|
void G1ParallelCleaningTask::work(uint worker_id) {
|
||||||
|
// Clean JVMCI metadata handles.
|
||||||
|
// Execute this task first because it is serial task.
|
||||||
|
JVMCI_ONLY(_jvmci_cleaning_task.work(_unloading_occurred);)
|
||||||
|
|
||||||
|
// Do first pass of code cache cleaning.
|
||||||
|
_code_cache_task.work(worker_id);
|
||||||
|
|
||||||
|
// Clean the string dedup data structures.
|
||||||
|
_string_dedup_task.work(worker_id);
|
||||||
|
|
||||||
|
// Clean all klasses that were not unloaded.
|
||||||
|
// The weak metadata in klass doesn't need to be
|
||||||
|
// processed if there was no unloading.
|
||||||
|
if (_unloading_occurred) {
|
||||||
|
_klass_cleaning_task.work();
|
||||||
|
}
|
||||||
|
}
|
66
src/hotspot/share/gc/g1/g1ParallelCleaning.hpp
Normal file
66
src/hotspot/share/gc/g1/g1ParallelCleaning.hpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 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
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_GC_G1_G1PARALLELCLEANING_HPP
|
||||||
|
#define SHARE_GC_G1_G1PARALLELCLEANING_HPP
|
||||||
|
|
||||||
|
#include "gc/shared/parallelCleaning.hpp"
|
||||||
|
|
||||||
|
#if INCLUDE_JVMCI
|
||||||
|
class JVMCICleaningTask : public StackObj {
|
||||||
|
volatile int _cleaning_claimed;
|
||||||
|
|
||||||
|
public:
|
||||||
|
JVMCICleaningTask();
|
||||||
|
// Clean JVMCI metadata handles.
|
||||||
|
void work(bool unloading_occurred);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool claim_cleaning_task();
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Do cleanup of some weakly held data in the same parallel task.
|
||||||
|
// Assumes a non-moving context.
|
||||||
|
class G1ParallelCleaningTask : public AbstractGangTask {
|
||||||
|
private:
|
||||||
|
bool _unloading_occurred;
|
||||||
|
StringDedupCleaningTask _string_dedup_task;
|
||||||
|
CodeCacheUnloadingTask _code_cache_task;
|
||||||
|
#if INCLUDE_JVMCI
|
||||||
|
JVMCICleaningTask _jvmci_cleaning_task;
|
||||||
|
#endif
|
||||||
|
KlassCleaningTask _klass_cleaning_task;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// The constructor is run in the VMThread.
|
||||||
|
G1ParallelCleaningTask(BoolObjectClosure* is_alive,
|
||||||
|
uint num_workers,
|
||||||
|
bool unloading_occurred,
|
||||||
|
bool resize_dedup_table);
|
||||||
|
|
||||||
|
void work(uint worker_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHARE_GC_G1_G1PARALLELCLEANING_HPP
|
@ -30,9 +30,6 @@
|
|||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
#include "memory/resourceArea.hpp"
|
#include "memory/resourceArea.hpp"
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
#if INCLUDE_JVMCI
|
|
||||||
#include "jvmci/jvmci.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
StringDedupCleaningTask::StringDedupCleaningTask(BoolObjectClosure* is_alive,
|
StringDedupCleaningTask::StringDedupCleaningTask(BoolObjectClosure* is_alive,
|
||||||
OopClosure* keep_alive,
|
OopClosure* keep_alive,
|
||||||
@ -160,56 +157,3 @@ void KlassCleaningTask::work() {
|
|||||||
clean_klass(klass);
|
clean_klass(klass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INCLUDE_JVMCI
|
|
||||||
JVMCICleaningTask::JVMCICleaningTask() :
|
|
||||||
_cleaning_claimed(0) {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JVMCICleaningTask::claim_cleaning_task() {
|
|
||||||
if (_cleaning_claimed) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Atomic::cmpxchg(1, &_cleaning_claimed, 0) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JVMCICleaningTask::work(bool unloading_occurred) {
|
|
||||||
// One worker will clean JVMCI metadata handles.
|
|
||||||
if (unloading_occurred && EnableJVMCI && claim_cleaning_task()) {
|
|
||||||
JVMCI::do_unloading(unloading_occurred);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // INCLUDE_JVMCI
|
|
||||||
|
|
||||||
ParallelCleaningTask::ParallelCleaningTask(BoolObjectClosure* is_alive,
|
|
||||||
uint num_workers,
|
|
||||||
bool unloading_occurred,
|
|
||||||
bool resize_dedup_table) :
|
|
||||||
AbstractGangTask("Parallel Cleaning"),
|
|
||||||
_unloading_occurred(unloading_occurred),
|
|
||||||
_string_dedup_task(is_alive, NULL, resize_dedup_table),
|
|
||||||
_code_cache_task(num_workers, is_alive, unloading_occurred),
|
|
||||||
JVMCI_ONLY(_jvmci_cleaning_task() COMMA)
|
|
||||||
_klass_cleaning_task() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// The parallel work done by all worker threads.
|
|
||||||
void ParallelCleaningTask::work(uint worker_id) {
|
|
||||||
// Clean JVMCI metadata handles.
|
|
||||||
// Execute this task first because it is serial task.
|
|
||||||
JVMCI_ONLY(_jvmci_cleaning_task.work(_unloading_occurred);)
|
|
||||||
|
|
||||||
// Do first pass of code cache cleaning.
|
|
||||||
_code_cache_task.work(worker_id);
|
|
||||||
|
|
||||||
// Clean the string dedup data structures.
|
|
||||||
_string_dedup_task.work(worker_id);
|
|
||||||
|
|
||||||
// Clean all klasses that were not unloaded.
|
|
||||||
// The weak metadata in klass doesn't need to be
|
|
||||||
// processed if there was no unloading.
|
|
||||||
if (_unloading_occurred) {
|
|
||||||
_klass_cleaning_task.work();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
#include "gc/shared/stringdedup/stringDedup.hpp"
|
#include "gc/shared/stringdedup/stringDedup.hpp"
|
||||||
#include "gc/shared/workgroup.hpp"
|
#include "gc/shared/workgroup.hpp"
|
||||||
|
|
||||||
class ParallelCleaningTask;
|
|
||||||
|
|
||||||
class StringDedupCleaningTask : public AbstractGangTask {
|
class StringDedupCleaningTask : public AbstractGangTask {
|
||||||
StringDedupUnlinkOrOopsDoClosure _dedup_closure;
|
StringDedupUnlinkOrOopsDoClosure _dedup_closure;
|
||||||
|
|
||||||
@ -87,40 +85,4 @@ public:
|
|||||||
void work();
|
void work();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if INCLUDE_JVMCI
|
|
||||||
class JVMCICleaningTask : public StackObj {
|
|
||||||
volatile int _cleaning_claimed;
|
|
||||||
|
|
||||||
public:
|
|
||||||
JVMCICleaningTask();
|
|
||||||
// Clean JVMCI metadata handles.
|
|
||||||
void work(bool unloading_occurred);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool claim_cleaning_task();
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Do cleanup of some weakly held data in the same parallel task.
|
|
||||||
// Assumes a non-moving context.
|
|
||||||
class ParallelCleaningTask : public AbstractGangTask {
|
|
||||||
private:
|
|
||||||
bool _unloading_occurred;
|
|
||||||
StringDedupCleaningTask _string_dedup_task;
|
|
||||||
CodeCacheUnloadingTask _code_cache_task;
|
|
||||||
#if INCLUDE_JVMCI
|
|
||||||
JVMCICleaningTask _jvmci_cleaning_task;
|
|
||||||
#endif
|
|
||||||
KlassCleaningTask _klass_cleaning_task;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// The constructor is run in the VMThread.
|
|
||||||
ParallelCleaningTask(BoolObjectClosure* is_alive,
|
|
||||||
uint num_workers,
|
|
||||||
bool unloading_occurred,
|
|
||||||
bool resize_dedup_table);
|
|
||||||
|
|
||||||
void work(uint worker_id);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SHARE_GC_SHARED_PARALLELCLEANING_HPP
|
#endif // SHARE_GC_SHARED_PARALLELCLEANING_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user