mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8255837: Shenandoah: Remove ShenandoahConcurrentRoots class
Reviewed-by: rkennke
This commit is contained in:
parent
53f1b93881
commit
22bfa5b0ac
16 changed files with 41 additions and 165 deletions
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
|
#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
|
||||||
#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
|
#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
|
||||||
#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
|
#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
|
||||||
|
@ -35,7 +34,7 @@
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
|
|
||||||
void ShenandoahIUMode::initialize_flags() const {
|
void ShenandoahIUMode::initialize_flags() const {
|
||||||
if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) {
|
if (ClassUnloading) {
|
||||||
FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true);
|
FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true);
|
||||||
FLAG_SET_DEFAULT(VerifyBeforeExit, false);
|
FLAG_SET_DEFAULT(VerifyBeforeExit, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
|
#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp"
|
||||||
#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
|
#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp"
|
||||||
#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
|
#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp"
|
||||||
|
@ -35,7 +34,7 @@
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
|
|
||||||
void ShenandoahSATBMode::initialize_flags() const {
|
void ShenandoahSATBMode::initialize_flags() const {
|
||||||
if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) {
|
if (ClassUnloading) {
|
||||||
FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true);
|
FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true);
|
||||||
FLAG_SET_DEFAULT(VerifyBeforeExit, false);
|
FLAG_SET_DEFAULT(VerifyBeforeExit, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved.
|
* Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -27,7 +27,6 @@
|
||||||
#include "code/icBuffer.hpp"
|
#include "code/icBuffer.hpp"
|
||||||
#include "code/nmethod.hpp"
|
#include "code/nmethod.hpp"
|
||||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahCodeRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahEvacOOMHandler.inline.hpp"
|
#include "gc/shenandoah/shenandoahEvacOOMHandler.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
||||||
|
@ -289,8 +288,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShenandoahCodeRoots::unlink(WorkGang* workers, bool unloading_occurred) {
|
void ShenandoahCodeRoots::unlink(WorkGang* workers, bool unloading_occurred) {
|
||||||
assert(ShenandoahConcurrentRoots::should_do_concurrent_class_unloading(),
|
assert(ShenandoahHeap::heap()->unload_classes(), "Only when running concurrent class unloading");
|
||||||
"Only when running concurrent class unloading");
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ICRefillVerifier verifier;
|
ICRefillVerifier verifier;
|
||||||
|
@ -345,8 +343,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void ShenandoahCodeRoots::purge(WorkGang* workers) {
|
void ShenandoahCodeRoots::purge(WorkGang* workers) {
|
||||||
assert(ShenandoahConcurrentRoots::should_do_concurrent_class_unloading(),
|
assert(ShenandoahHeap::heap()->unload_classes(), "Only when running concurrent class unloading");
|
||||||
"Only when running concurrent class unloading");
|
|
||||||
|
|
||||||
ShenandoahNMethodPurgeTask task;
|
ShenandoahNMethodPurgeTask task;
|
||||||
workers->run_task(&task);
|
workers->run_task(&task);
|
||||||
|
|
|
@ -101,8 +101,8 @@ bool ShenandoahConcurrentGC::collect(GCCause::Cause cause) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform concurrent class unloading
|
// Perform concurrent class unloading
|
||||||
if (heap->is_concurrent_weak_root_in_progress() &&
|
if (heap->unload_classes() &&
|
||||||
ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
|
heap->is_concurrent_weak_root_in_progress()) {
|
||||||
entry_class_unloading();
|
entry_class_unloading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ void ShenandoahConcurrentGC::op_init_mark() {
|
||||||
// Arm nmethods for concurrent marking. When a nmethod is about to be executed,
|
// Arm nmethods for concurrent marking. When a nmethod is about to be executed,
|
||||||
// we need to make sure that all its metadata are marked. alternative is to remark
|
// we need to make sure that all its metadata are marked. alternative is to remark
|
||||||
// thread roots at final mark pause, but it can be potential latency killer.
|
// thread roots at final mark pause, but it can be potential latency killer.
|
||||||
if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
|
if (heap->unload_classes()) {
|
||||||
ShenandoahCodeRoots::arm_nmethods();
|
ShenandoahCodeRoots::arm_nmethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +695,6 @@ private:
|
||||||
ShenandoahConcurrentNMethodIterator _nmethod_itr;
|
ShenandoahConcurrentNMethodIterator _nmethod_itr;
|
||||||
ShenandoahConcurrentStringDedupRoots _dedup_roots;
|
ShenandoahConcurrentStringDedupRoots _dedup_roots;
|
||||||
ShenandoahPhaseTimings::Phase _phase;
|
ShenandoahPhaseTimings::Phase _phase;
|
||||||
bool _concurrent_class_unloading;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShenandoahConcurrentWeakRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
|
ShenandoahConcurrentWeakRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
|
||||||
|
@ -704,9 +703,8 @@ public:
|
||||||
_cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers()),
|
_cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers()),
|
||||||
_nmethod_itr(ShenandoahCodeRoots::table()),
|
_nmethod_itr(ShenandoahCodeRoots::table()),
|
||||||
_dedup_roots(phase),
|
_dedup_roots(phase),
|
||||||
_phase(phase),
|
_phase(phase) {
|
||||||
_concurrent_class_unloading(ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
|
if (ShenandoahHeap::heap()->unload_classes()) {
|
||||||
if (_concurrent_class_unloading) {
|
|
||||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||||
_nmethod_itr.nmethods_do_begin();
|
_nmethod_itr.nmethods_do_begin();
|
||||||
}
|
}
|
||||||
|
@ -717,7 +715,7 @@ public:
|
||||||
~ShenandoahConcurrentWeakRootsEvacUpdateTask() {
|
~ShenandoahConcurrentWeakRootsEvacUpdateTask() {
|
||||||
_dedup_roots.epilogue();
|
_dedup_roots.epilogue();
|
||||||
|
|
||||||
if (_concurrent_class_unloading) {
|
if (ShenandoahHeap::heap()->unload_classes()) {
|
||||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||||
_nmethod_itr.nmethods_do_end();
|
_nmethod_itr.nmethods_do_end();
|
||||||
}
|
}
|
||||||
|
@ -743,7 +741,7 @@ public:
|
||||||
// If we are going to perform concurrent class unloading later on, we need to
|
// If we are going to perform concurrent class unloading later on, we need to
|
||||||
// cleanup the weak oops in CLD and determinate nmethod's unloading state, so that we
|
// cleanup the weak oops in CLD and determinate nmethod's unloading state, so that we
|
||||||
// can cleanup immediate garbage sooner.
|
// can cleanup immediate garbage sooner.
|
||||||
if (_concurrent_class_unloading) {
|
if (ShenandoahHeap::heap()->unload_classes()) {
|
||||||
// Applies ShenandoahIsCLDAlive closure to CLDs, native barrier will either NULL the
|
// Applies ShenandoahIsCLDAlive closure to CLDs, native barrier will either NULL the
|
||||||
// CLD's holder or evacuate it.
|
// CLD's holder or evacuate it.
|
||||||
{
|
{
|
||||||
|
@ -781,7 +779,7 @@ void ShenandoahConcurrentGC::op_weak_roots() {
|
||||||
heap->rendezvous_threads();
|
heap->rendezvous_threads();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
|
if (!ShenandoahHeap::heap()->unload_classes()) {
|
||||||
heap->set_concurrent_weak_root_in_progress(false);
|
heap->set_concurrent_weak_root_in_progress(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -789,7 +787,7 @@ void ShenandoahConcurrentGC::op_weak_roots() {
|
||||||
void ShenandoahConcurrentGC::op_class_unloading() {
|
void ShenandoahConcurrentGC::op_class_unloading() {
|
||||||
ShenandoahHeap* const heap = ShenandoahHeap::heap();
|
ShenandoahHeap* const heap = ShenandoahHeap::heap();
|
||||||
assert (heap->is_concurrent_weak_root_in_progress() &&
|
assert (heap->is_concurrent_weak_root_in_progress() &&
|
||||||
ShenandoahConcurrentRoots::should_do_concurrent_class_unloading(),
|
heap->unload_classes(),
|
||||||
"Checked by caller");
|
"Checked by caller");
|
||||||
heap->do_class_unloading();
|
heap->do_class_unloading();
|
||||||
heap->set_concurrent_weak_root_in_progress(false);
|
heap->set_concurrent_weak_root_in_progress(false);
|
||||||
|
@ -823,7 +821,6 @@ private:
|
||||||
ShenandoahVMRoots<true /*concurrent*/> _vm_roots;
|
ShenandoahVMRoots<true /*concurrent*/> _vm_roots;
|
||||||
ShenandoahClassLoaderDataRoots<true /*concurrent*/, false /*single threaded*/> _cld_roots;
|
ShenandoahClassLoaderDataRoots<true /*concurrent*/, false /*single threaded*/> _cld_roots;
|
||||||
ShenandoahConcurrentNMethodIterator _nmethod_itr;
|
ShenandoahConcurrentNMethodIterator _nmethod_itr;
|
||||||
bool _process_codecache;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShenandoahConcurrentRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
|
ShenandoahConcurrentRootsEvacUpdateTask(ShenandoahPhaseTimings::Phase phase) :
|
||||||
|
@ -831,16 +828,15 @@ public:
|
||||||
_phase(phase),
|
_phase(phase),
|
||||||
_vm_roots(phase),
|
_vm_roots(phase),
|
||||||
_cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers()),
|
_cld_roots(phase, ShenandoahHeap::heap()->workers()->active_workers()),
|
||||||
_nmethod_itr(ShenandoahCodeRoots::table()),
|
_nmethod_itr(ShenandoahCodeRoots::table()) {
|
||||||
_process_codecache(!ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
|
if (!ShenandoahHeap::heap()->unload_classes()) {
|
||||||
if (_process_codecache) {
|
|
||||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||||
_nmethod_itr.nmethods_do_begin();
|
_nmethod_itr.nmethods_do_begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~ShenandoahConcurrentRootsEvacUpdateTask() {
|
~ShenandoahConcurrentRootsEvacUpdateTask() {
|
||||||
if (_process_codecache) {
|
if (!ShenandoahHeap::heap()->unload_classes()) {
|
||||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||||
_nmethod_itr.nmethods_do_end();
|
_nmethod_itr.nmethods_do_end();
|
||||||
}
|
}
|
||||||
|
@ -865,7 +861,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cannot setup ShenandoahEvacOOMScope here, due to potential deadlock with nmethod_entry_barrier.
|
// Cannot setup ShenandoahEvacOOMScope here, due to potential deadlock with nmethod_entry_barrier.
|
||||||
if (_process_codecache) {
|
if (!ShenandoahHeap::heap()->unload_classes()) {
|
||||||
ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
|
ShenandoahWorkerTimingsTracker timer(_phase, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
|
||||||
ShenandoahEvacUpdateCodeCacheClosure cl;
|
ShenandoahEvacUpdateCodeCacheClosure cl;
|
||||||
_nmethod_itr.nmethods_do(&cl);
|
_nmethod_itr.nmethods_do(&cl);
|
||||||
|
|
|
@ -104,17 +104,16 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ShenandoahSATBAndRemarkCodeRootsThreadsClosure : public ThreadClosure {
|
class ShenandoahSATBAndRemarkThreadsClosure : public ThreadClosure {
|
||||||
private:
|
private:
|
||||||
SATBMarkQueueSet& _satb_qset;
|
SATBMarkQueueSet& _satb_qset;
|
||||||
OopClosure* const _cl;
|
OopClosure* const _cl;
|
||||||
MarkingCodeBlobClosure* _code_cl;
|
|
||||||
uintx _claim_token;
|
uintx _claim_token;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShenandoahSATBAndRemarkCodeRootsThreadsClosure(SATBMarkQueueSet& satb_qset, OopClosure* cl, MarkingCodeBlobClosure* code_cl) :
|
ShenandoahSATBAndRemarkThreadsClosure(SATBMarkQueueSet& satb_qset, OopClosure* cl) :
|
||||||
_satb_qset(satb_qset),
|
_satb_qset(satb_qset),
|
||||||
_cl(cl), _code_cl(code_cl),
|
_cl(cl),
|
||||||
_claim_token(Threads::thread_claim_token()) {}
|
_claim_token(Threads::thread_claim_token()) {}
|
||||||
|
|
||||||
void do_thread(Thread* thread) {
|
void do_thread(Thread* thread) {
|
||||||
|
@ -124,15 +123,7 @@ public:
|
||||||
if (thread->is_Java_thread()) {
|
if (thread->is_Java_thread()) {
|
||||||
if (_cl != NULL) {
|
if (_cl != NULL) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
thread->oops_do(_cl, _code_cl);
|
thread->oops_do(_cl, NULL);
|
||||||
} else if (_code_cl != NULL) {
|
|
||||||
// In theory it should not be neccessary to explicitly walk the nmethods to find roots for concurrent marking
|
|
||||||
// however the liveness of oops reachable from nmethods have very complex lifecycles:
|
|
||||||
// * Alive if on the stack of an executing method
|
|
||||||
// * Weakly reachable otherwise
|
|
||||||
// Some objects reachable from nmethods, such as the class loader (or klass_holder) of the receiver should be
|
|
||||||
// live by the SATB invariant but other oops recorded in nmethods may behave differently.
|
|
||||||
thread->as_Java_thread()->nmethods_do(_code_cl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,12 +156,9 @@ public:
|
||||||
while (satb_mq_set.apply_closure_to_completed_buffer(&cl)) {}
|
while (satb_mq_set.apply_closure_to_completed_buffer(&cl)) {}
|
||||||
assert(!heap->has_forwarded_objects(), "Not expected");
|
assert(!heap->has_forwarded_objects(), "Not expected");
|
||||||
|
|
||||||
bool do_nmethods = heap->unload_classes() && !ShenandoahConcurrentRoots::can_do_concurrent_class_unloading();
|
|
||||||
ShenandoahMarkRefsClosure mark_cl(q, rp);
|
ShenandoahMarkRefsClosure mark_cl(q, rp);
|
||||||
MarkingCodeBlobClosure blobsCl(&mark_cl, !CodeBlobToOopClosure::FixRelocations);
|
ShenandoahSATBAndRemarkThreadsClosure tc(satb_mq_set,
|
||||||
ShenandoahSATBAndRemarkCodeRootsThreadsClosure tc(satb_mq_set,
|
ShenandoahIUBarrier ? &mark_cl : NULL);
|
||||||
ShenandoahIUBarrier ? &mark_cl : NULL,
|
|
||||||
do_nmethods ? &blobsCl : NULL);
|
|
||||||
Threads::threads_do(&tc);
|
Threads::threads_do(&tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019, 2020, Red Hat, Inc. 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/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
|
||||||
|
|
||||||
bool ShenandoahConcurrentRoots::can_do_concurrent_roots() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ShenandoahConcurrentRoots::should_do_concurrent_roots() {
|
|
||||||
return can_do_concurrent_roots() &&
|
|
||||||
!ShenandoahHeap::heap()->is_stw_gc_in_progress();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() {
|
|
||||||
return ClassUnloading;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ShenandoahConcurrentRoots::should_do_concurrent_class_unloading() {
|
|
||||||
ShenandoahHeap* const heap = ShenandoahHeap::heap();
|
|
||||||
return can_do_concurrent_class_unloading() &&
|
|
||||||
heap->unload_classes() &&
|
|
||||||
!heap->is_stw_gc_in_progress();
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2019, Red Hat, Inc. 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_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP
|
|
||||||
#define SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP
|
|
||||||
|
|
||||||
#include "memory/allocation.hpp"
|
|
||||||
|
|
||||||
class ShenandoahConcurrentRoots : public AllStatic {
|
|
||||||
public:
|
|
||||||
// Can GC settings allow concurrent root processing
|
|
||||||
static bool can_do_concurrent_roots();
|
|
||||||
// If current GC cycle can process roots concurrently
|
|
||||||
static bool should_do_concurrent_roots();
|
|
||||||
|
|
||||||
// If GC settings allow concurrent class unloading
|
|
||||||
static bool can_do_concurrent_class_unloading();
|
|
||||||
// If current GC cycle can unload classes concurrently
|
|
||||||
static bool should_do_concurrent_class_unloading();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP
|
|
|
@ -180,7 +180,7 @@ void ShenandoahDegenGC::op_degenerated() {
|
||||||
assert(!heap->cancelled_gc(), "STW reference update can not OOM");
|
assert(!heap->cancelled_gc(), "STW reference update can not OOM");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) {
|
if (ClassUnloading) {
|
||||||
// Disarm nmethods that armed in concurrent cycle.
|
// Disarm nmethods that armed in concurrent cycle.
|
||||||
// In above case, update roots should disarm them
|
// In above case, update roots should disarm them
|
||||||
ShenandoahCodeRoots::disarm_nmethods();
|
ShenandoahCodeRoots::disarm_nmethods();
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
|
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
|
||||||
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
|
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentMark.hpp"
|
#include "gc/shenandoah/shenandoahConcurrentMark.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahControlThread.hpp"
|
#include "gc/shenandoah/shenandoahControlThread.hpp"
|
||||||
#include "gc/shenandoah/shenandoahFreeSet.hpp"
|
#include "gc/shenandoah/shenandoahFreeSet.hpp"
|
||||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||||
|
@ -1711,7 +1710,6 @@ void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShenandoahHeap::set_concurrent_strong_root_in_progress(bool in_progress) {
|
void ShenandoahHeap::set_concurrent_strong_root_in_progress(bool in_progress) {
|
||||||
assert(ShenandoahConcurrentRoots::can_do_concurrent_roots(), "Why set the flag?");
|
|
||||||
if (in_progress) {
|
if (in_progress) {
|
||||||
_concurrent_strong_root_in_progress.set();
|
_concurrent_strong_root_in_progress.set();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1720,7 +1718,6 @@ void ShenandoahHeap::set_concurrent_strong_root_in_progress(bool in_progress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShenandoahHeap::set_concurrent_weak_root_in_progress(bool in_progress) {
|
void ShenandoahHeap::set_concurrent_weak_root_in_progress(bool in_progress) {
|
||||||
assert(ShenandoahConcurrentRoots::can_do_concurrent_roots(), "Why set the flag?");
|
|
||||||
if (in_progress) {
|
if (in_progress) {
|
||||||
_concurrent_weak_root_in_progress.set();
|
_concurrent_weak_root_in_progress.set();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1971,7 +1968,7 @@ void ShenandoahHeap::prepare_concurrent_roots() {
|
||||||
assert(!is_stw_gc_in_progress(), "Only concurrent GC");
|
assert(!is_stw_gc_in_progress(), "Only concurrent GC");
|
||||||
set_concurrent_strong_root_in_progress(!collection_set()->is_empty());
|
set_concurrent_strong_root_in_progress(!collection_set()->is_empty());
|
||||||
set_concurrent_weak_root_in_progress(true);
|
set_concurrent_weak_root_in_progress(true);
|
||||||
if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
|
if (unload_classes()) {
|
||||||
_unloader.prepare();
|
_unloader.prepare();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1979,7 +1976,7 @@ void ShenandoahHeap::prepare_concurrent_roots() {
|
||||||
void ShenandoahHeap::finish_concurrent_roots() {
|
void ShenandoahHeap::finish_concurrent_roots() {
|
||||||
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
|
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
|
||||||
assert(!is_stw_gc_in_progress(), "Only concurrent GC");
|
assert(!is_stw_gc_in_progress(), "Only concurrent GC");
|
||||||
if (ShenandoahConcurrentRoots::should_do_concurrent_class_unloading()) {
|
if (unload_classes()) {
|
||||||
_unloader.finish();
|
_unloader.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include "gc/shared/tlab_globals.hpp"
|
#include "gc/shared/tlab_globals.hpp"
|
||||||
#include "gc/shenandoah/shenandoahForwarding.inline.hpp"
|
#include "gc/shenandoah/shenandoahForwarding.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentGC.hpp"
|
#include "gc/shenandoah/shenandoahConcurrentGC.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
|
#include "gc/shenandoah/shenandoahCollectionSet.hpp"
|
||||||
#include "gc/shenandoah/shenandoahFreeSet.hpp"
|
#include "gc/shenandoah/shenandoahFreeSet.hpp"
|
||||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||||
|
@ -125,7 +124,7 @@ void ShenandoahMarkCompact::do_it(GCCause::Cause gc_cause) {
|
||||||
|
|
||||||
// Degenerated GC may carry concurrent root flags when upgrading to
|
// Degenerated GC may carry concurrent root flags when upgrading to
|
||||||
// full GC. We need to reset it before mutators resume.
|
// full GC. We need to reset it before mutators resume.
|
||||||
if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) {
|
if (ClassUnloading) {
|
||||||
heap->set_concurrent_strong_root_in_progress(false);
|
heap->set_concurrent_strong_root_in_progress(false);
|
||||||
heap->set_concurrent_weak_root_in_progress(false);
|
heap->set_concurrent_weak_root_in_progress(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
|
* Copyright (c) 2019, 2021, Red Hat, Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,7 +25,6 @@
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
|
|
||||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
||||||
#include "memory/resourceArea.hpp"
|
#include "memory/resourceArea.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
|
* Copyright (c) 2019, 2021, Red Hat, Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
#include "gc/shared/barrierSet.hpp"
|
#include "gc/shared/barrierSet.hpp"
|
||||||
#include "gc/shared/barrierSetNMethod.hpp"
|
#include "gc/shared/barrierSetNMethod.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahNMethod.hpp"
|
#include "gc/shenandoah/shenandoahNMethod.hpp"
|
||||||
|
|
||||||
nmethod* ShenandoahNMethod::nm() const {
|
nmethod* ShenandoahNMethod::nm() const {
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "classfile/classLoaderData.hpp"
|
#include "classfile/classLoaderData.hpp"
|
||||||
#include "code/nmethod.hpp"
|
#include "code/nmethod.hpp"
|
||||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
#include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||||
|
@ -284,7 +283,7 @@ ShenandoahRootAdjuster::ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTi
|
||||||
void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
|
void ShenandoahRootAdjuster::roots_do(uint worker_id, OopClosure* oops) {
|
||||||
CodeBlobToOopClosure code_blob_cl(oops, CodeBlobToOopClosure::FixRelocations);
|
CodeBlobToOopClosure code_blob_cl(oops, CodeBlobToOopClosure::FixRelocations);
|
||||||
ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(oops);
|
ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(oops);
|
||||||
CodeBlobToOopClosure* adjust_code_closure = ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() ?
|
CodeBlobToOopClosure* adjust_code_closure = ClassUnloading ?
|
||||||
static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
|
static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
|
||||||
static_cast<CodeBlobToOopClosure*>(&code_blob_cl);
|
static_cast<CodeBlobToOopClosure*>(&code_blob_cl);
|
||||||
CLDToOopClosure adjust_cld_closure(oops, ClassLoaderData::_claim_strong);
|
CLDToOopClosure adjust_cld_closure(oops, ClassLoaderData::_claim_strong);
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "classfile/classLoaderDataGraph.hpp"
|
#include "classfile/classLoaderDataGraph.hpp"
|
||||||
#include "gc/shared/oopStorageSetParState.inline.hpp"
|
#include "gc/shared/oopStorageSetParState.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||||
#include "gc/shenandoah/shenandoahRootProcessor.hpp"
|
#include "gc/shenandoah/shenandoahRootProcessor.hpp"
|
||||||
|
@ -177,9 +176,9 @@ template <typename IsAlive, typename KeepAlive>
|
||||||
void ShenandoahRootUpdater::roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive) {
|
void ShenandoahRootUpdater::roots_do(uint worker_id, IsAlive* is_alive, KeepAlive* keep_alive) {
|
||||||
CodeBlobToOopClosure update_blobs(keep_alive, CodeBlobToOopClosure::FixRelocations);
|
CodeBlobToOopClosure update_blobs(keep_alive, CodeBlobToOopClosure::FixRelocations);
|
||||||
ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(keep_alive);
|
ShenandoahCodeBlobAndDisarmClosure blobs_and_disarm_Cl(keep_alive);
|
||||||
CodeBlobToOopClosure* codes_cl = ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() ?
|
CodeBlobToOopClosure* codes_cl = ClassUnloading ?
|
||||||
static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
|
static_cast<CodeBlobToOopClosure*>(&blobs_and_disarm_Cl) :
|
||||||
static_cast<CodeBlobToOopClosure*>(&update_blobs);
|
static_cast<CodeBlobToOopClosure*>(&update_blobs);
|
||||||
|
|
||||||
CLDToOopClosure clds(keep_alive, ClassLoaderData::_claim_strong);
|
CLDToOopClosure clds(keep_alive, ClassLoaderData::_claim_strong);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
|
* Copyright (c) 2019, 2021, Red Hat, Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,8 +32,6 @@
|
||||||
#include "gc/shared/gcBehaviours.hpp"
|
#include "gc/shared/gcBehaviours.hpp"
|
||||||
#include "gc/shared/suspendibleThreadSet.hpp"
|
#include "gc/shared/suspendibleThreadSet.hpp"
|
||||||
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahCodeRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
#include "gc/shenandoah/shenandoahNMethod.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahLock.hpp"
|
#include "gc/shenandoah/shenandoahLock.hpp"
|
||||||
|
@ -120,7 +118,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
ShenandoahUnload::ShenandoahUnload() {
|
ShenandoahUnload::ShenandoahUnload() {
|
||||||
if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) {
|
if (ClassUnloading) {
|
||||||
static ShenandoahIsUnloadingBehaviour is_unloading_behaviour;
|
static ShenandoahIsUnloadingBehaviour is_unloading_behaviour;
|
||||||
IsUnloadingBehaviour::set_current(&is_unloading_behaviour);
|
IsUnloadingBehaviour::set_current(&is_unloading_behaviour);
|
||||||
|
|
||||||
|
@ -131,14 +129,14 @@ ShenandoahUnload::ShenandoahUnload() {
|
||||||
|
|
||||||
void ShenandoahUnload::prepare() {
|
void ShenandoahUnload::prepare() {
|
||||||
assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
|
assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
|
||||||
assert(ShenandoahConcurrentRoots::can_do_concurrent_class_unloading(), "Sanity");
|
assert(ClassUnloading, "Sanity");
|
||||||
CodeCache::increment_unloading_cycle();
|
CodeCache::increment_unloading_cycle();
|
||||||
DependencyContext::cleaning_start();
|
DependencyContext::cleaning_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShenandoahUnload::unload() {
|
void ShenandoahUnload::unload() {
|
||||||
ShenandoahHeap* heap = ShenandoahHeap::heap();
|
ShenandoahHeap* heap = ShenandoahHeap::heap();
|
||||||
assert(ShenandoahConcurrentRoots::can_do_concurrent_class_unloading(), "Filtered by caller");
|
assert(ClassUnloading, "Filtered by caller");
|
||||||
assert(heap->is_concurrent_weak_root_in_progress(), "Filtered by caller");
|
assert(heap->is_concurrent_weak_root_in_progress(), "Filtered by caller");
|
||||||
|
|
||||||
// Unlink stale metadata and nmethods
|
// Unlink stale metadata and nmethods
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved.
|
* Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,7 +25,6 @@
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "gc/shared/tlab_globals.hpp"
|
#include "gc/shared/tlab_globals.hpp"
|
||||||
#include "gc/shenandoah/shenandoahAsserts.hpp"
|
#include "gc/shenandoah/shenandoahAsserts.hpp"
|
||||||
#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
|
|
||||||
#include "gc/shenandoah/shenandoahForwarding.inline.hpp"
|
#include "gc/shenandoah/shenandoahForwarding.inline.hpp"
|
||||||
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
#include "gc/shenandoah/shenandoahPhaseTimings.hpp"
|
||||||
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
|
||||||
|
@ -814,7 +813,7 @@ void ShenandoahVerifier::verify_after_concmark() {
|
||||||
|
|
||||||
void ShenandoahVerifier::verify_before_evacuation() {
|
void ShenandoahVerifier::verify_before_evacuation() {
|
||||||
// Concurrent weak roots are evacuated during concurrent phase
|
// Concurrent weak roots are evacuated during concurrent phase
|
||||||
VerifyWeakRoots verify_weak_roots = ShenandoahConcurrentRoots::should_do_concurrent_class_unloading() ?
|
VerifyWeakRoots verify_weak_roots = _heap->unload_classes() ?
|
||||||
_verify_serial_weak_roots :
|
_verify_serial_weak_roots :
|
||||||
_verify_all_weak_roots;
|
_verify_all_weak_roots;
|
||||||
|
|
||||||
|
@ -832,7 +831,7 @@ void ShenandoahVerifier::verify_before_evacuation() {
|
||||||
|
|
||||||
void ShenandoahVerifier::verify_during_evacuation() {
|
void ShenandoahVerifier::verify_during_evacuation() {
|
||||||
// Concurrent weak roots are evacuated during concurrent phase
|
// Concurrent weak roots are evacuated during concurrent phase
|
||||||
VerifyWeakRoots verify_weak_roots = ShenandoahConcurrentRoots::should_do_concurrent_class_unloading() ?
|
VerifyWeakRoots verify_weak_roots = _heap->unload_classes() ?
|
||||||
_verify_serial_weak_roots :
|
_verify_serial_weak_roots :
|
||||||
_verify_all_weak_roots;
|
_verify_all_weak_roots;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue