# HG changeset patch # User zgu # Date 1553795621 14400 # Thu Mar 28 13:53:41 2019 -0400 # Node ID 0d07b9c82c64f7faf0641c5049983961461c8639 # Parent ac40561279dc3aef9d1a88ae2448f7299e441307 [backport] 8221629: Shenandoah: Cleanup class unloading logic Reviewed-by: rkennke diff -r ac40561279dc -r 0d07b9c82c64 src/share/vm/gc_implementation/shenandoah/shenandoahConcurrentMark.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahConcurrentMark.cpp Tue Mar 26 12:12:49 2019 -0400 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahConcurrentMark.cpp Thu Mar 28 13:53:41 2019 -0400 @@ -34,7 +34,7 @@ #include "gc_implementation/shenandoah/shenandoahConcurrentMark.inline.hpp" #include "gc_implementation/shenandoah/shenandoahOopClosures.inline.hpp" #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp" -#include "gc_implementation/shenandoah/shenandoahRootProcessor.hpp" +#include "gc_implementation/shenandoah/shenandoahRootProcessor.inline.hpp" #include "gc_implementation/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc_implementation/shenandoah/shenandoahTimingTracker.hpp" #include "gc_implementation/shenandoah/shenandoahWeakProcessor.hpp" @@ -133,7 +133,7 @@ ResourceMark m; if (heap->unload_classes()) { - _rp->process_strong_roots(oops, &clds_cl, NULL, &blobs_cl, NULL, worker_id); + _rp->process_strong_roots(oops, &clds_cl, &blobs_cl, NULL, worker_id); } else { if (ShenandoahConcurrentScanCodeRoots) { CodeBlobClosure* code_blobs = NULL; @@ -186,7 +186,7 @@ DEBUG_ONLY(&assert_to_space) NOT_DEBUG(NULL); } - _rp->update_all_roots(&cl, &cldCl, code_blobs, NULL, worker_id); + _rp->update_all_roots(&cl, &cldCl, code_blobs, NULL, worker_id); } }; diff -r ac40561279dc -r 0d07b9c82c64 src/share/vm/gc_implementation/shenandoah/shenandoahMarkCompact.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahMarkCompact.cpp Tue Mar 26 12:12:49 2019 -0400 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahMarkCompact.cpp Thu Mar 28 13:53:41 2019 -0400 @@ -37,7 +37,7 @@ #include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp" #include "gc_implementation/shenandoah/shenandoahHeuristics.hpp" #include "gc_implementation/shenandoah/shenandoahMarkingContext.inline.hpp" -#include "gc_implementation/shenandoah/shenandoahRootProcessor.hpp" +#include "gc_implementation/shenandoah/shenandoahRootProcessor.inline.hpp" #include "gc_implementation/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc_implementation/shenandoah/shenandoahUtils.hpp" #include "gc_implementation/shenandoah/shenandoahVerifier.hpp" @@ -574,9 +574,9 @@ MarkingCodeBlobClosure adjust_code_closure(&cl, CodeBlobToOopClosure::FixRelocations); - _rp->update_all_roots(&cl, - &adjust_cld_closure, - &adjust_code_closure, NULL, worker_id); + _rp->update_all_roots(&cl, + &adjust_cld_closure, + &adjust_code_closure, NULL, worker_id); } }; diff -r ac40561279dc -r 0d07b9c82c64 src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.cpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.cpp Tue Mar 26 12:12:49 2019 -0400 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.cpp Thu Mar 28 13:53:41 2019 -0400 @@ -89,13 +89,12 @@ void ShenandoahRootProcessor::process_strong_roots(OopClosure* oops, CLDClosure* clds, - CLDClosure* weak_clds, CodeBlobClosure* blobs, ThreadClosure* thread_cl, uint worker_id) { assert(thread_cl == NULL, "not implemented yet"); ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); - process_java_roots(oops, clds, clds, weak_clds, blobs, worker_id); + process_java_roots(oops, clds, clds, NULL, blobs, worker_id); process_vm_roots(oops, worker_id); if (!_process_strong_tasks->is_task_claimed(SHENANDOAH_RP_PS_SystemDictionary_oops_do)) { @@ -138,26 +137,6 @@ } -void ShenandoahRootProcessor::update_all_roots(OopClosure* oops, - CLDClosure* clds, - CodeBlobClosure* blobs, - ThreadClosure* thread_cl, - uint worker_id) { - ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); - ShenandoahAlwaysTrueClosure always_true; - - if (!_process_strong_tasks->is_task_claimed(SHENANDOAH_RP_PS_JNIHandles_weak_oops_do)) { - ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIWeakRoots, worker_id); - ShenandoahWeakProcessor::weak_oops_do(&always_true, oops); - } - - process_all_roots(oops, clds, blobs, thread_cl, worker_id); - - if (ShenandoahStringDedup::is_enabled()) { - ShenandoahStringDedup::parallel_oops_do(oops); - } -} - void ShenandoahRootProcessor::process_java_roots(OopClosure* strong_roots, CLDClosure* thread_clds, CLDClosure* strong_clds, diff -r ac40561279dc -r 0d07b9c82c64 src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.hpp --- a/src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.hpp Tue Mar 26 12:12:49 2019 -0400 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.hpp Thu Mar 28 13:53:41 2019 -0400 @@ -78,7 +78,6 @@ // for the particular GC cycles. void process_strong_roots(OopClosure* oops, CLDClosure* clds, - CLDClosure* weak_clds, CodeBlobClosure* blobs, ThreadClosure* thread_cl, uint worker_id); @@ -91,22 +90,13 @@ uint worker_id); // Apply oops, clds and blobs to strongly and weakly reachable roots in the system + template void update_all_roots(OopClosure* oops, CLDClosure* clds, CodeBlobClosure* blobs, ThreadClosure* thread_cl, uint worker_id); - - // Apply oops, clds and blobs to strongly and weakly reachable roots in the system - // during traversal GC. - // It cleans up and updates weak roots in one iteration. - void traversal_update_all_roots(OopClosure* oops, - CLDClosure* clds, - CodeBlobClosure* blobs, - ThreadClosure* thread_cl, - uint worker_id); - // For slow debug/verification code void process_all_roots_slow(OopClosure* oops); diff -r ac40561279dc -r 0d07b9c82c64 src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.inline.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/gc_implementation/shenandoah/shenandoahRootProcessor.inline.hpp Thu Mar 28 13:53:41 2019 -0400 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. + * + * 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_SHENANDOAHROOTPROCESSOR_INLINE_HPP +#define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP + +#include "gc_implementation/shenandoah/shenandoahRootProcessor.hpp" +#include "gc_implementation/shenandoah/shenandoahTimingTracker.hpp" +#include "gc_implementation/shenandoah/shenandoahWeakProcessor.hpp" + +template +void ShenandoahRootProcessor::update_all_roots(OopClosure* oops, + CLDClosure* clds, + CodeBlobClosure* blobs, + ThreadClosure* thread_cl, + uint worker_id) { + ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times(); + + IsAlive is_alive; + if (!_process_strong_tasks->is_task_claimed(SHENANDOAH_RP_PS_JNIHandles_weak_oops_do)) { + ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIWeakRoots, worker_id); + ShenandoahWeakProcessor::weak_oops_do(&is_alive, oops); + } + + process_all_roots(oops, clds, blobs, thread_cl, worker_id); + + if (ShenandoahStringDedup::is_enabled()) { + ShenandoahStringDedup::parallel_oops_do(oops); + } +} + +#endif // SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP