8254075: Shenandoah: Remove ShenandoahCodeRootsStyle diagnostic flag and related test

Reviewed-by: shade
This commit is contained in:
Zhengyu Gu 2020-10-06 15:28:44 +00:00
parent 77921b9736
commit 51fdb4c039
5 changed files with 12 additions and 141 deletions

@ -112,50 +112,18 @@ void ShenandoahCodeRoots::initialize() {
}
void ShenandoahCodeRoots::register_nmethod(nmethod* nm) {
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1:
break;
case 2: {
assert_locked_or_safepoint(CodeCache_lock);
_nmethod_table->register_nmethod(nm);
break;
}
default:
ShouldNotReachHere();
}
assert_locked_or_safepoint(CodeCache_lock);
_nmethod_table->register_nmethod(nm);
}
void ShenandoahCodeRoots::unregister_nmethod(nmethod* nm) {
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1: {
break;
}
case 2: {
assert_locked_or_safepoint(CodeCache_lock);
_nmethod_table->unregister_nmethod(nm);
break;
}
default:
ShouldNotReachHere();
}
assert_locked_or_safepoint(CodeCache_lock);
_nmethod_table->unregister_nmethod(nm);
}
void ShenandoahCodeRoots::flush_nmethod(nmethod* nm) {
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1: {
break;
}
case 2: {
assert_locked_or_safepoint(CodeCache_lock);
_nmethod_table->flush_nmethod(nm);
break;
}
default:
ShouldNotReachHere();
}
assert_locked_or_safepoint(CodeCache_lock);
_nmethod_table->flush_nmethod(nm);
}
void ShenandoahCodeRoots::arm_nmethods() {
@ -389,64 +357,18 @@ ShenandoahCodeRootsIterator::ShenandoahCodeRootsIterator() :
_table_snapshot(NULL) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
assert(!Thread::current()->is_Worker_thread(), "Should not be acquired by workers");
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1: {
// No need to do anything here
break;
}
case 2: {
CodeCache_lock->lock_without_safepoint_check();
_table_snapshot = ShenandoahCodeRoots::table()->snapshot_for_iteration();
break;
}
default:
ShouldNotReachHere();
}
CodeCache_lock->lock_without_safepoint_check();
_table_snapshot = ShenandoahCodeRoots::table()->snapshot_for_iteration();
}
ShenandoahCodeRootsIterator::~ShenandoahCodeRootsIterator() {
switch (ShenandoahCodeRootsStyle) {
case 0:
case 1: {
// No need to do anything here
break;
}
case 2: {
ShenandoahCodeRoots::table()->finish_iteration(_table_snapshot);
_table_snapshot = NULL;
CodeCache_lock->unlock();
break;
}
default:
ShouldNotReachHere();
}
ShenandoahCodeRoots::table()->finish_iteration(_table_snapshot);
_table_snapshot = NULL;
CodeCache_lock->unlock();
}
void ShenandoahCodeRootsIterator::possibly_parallel_blobs_do(CodeBlobClosure *f) {
switch (ShenandoahCodeRootsStyle) {
case 0: {
if (_seq_claimed.try_set()) {
CodeCache::blobs_do(f);
}
break;
}
case 1: {
_par_iterator.parallel_blobs_do(f);
break;
}
case 2: {
ShenandoahCodeRootsIterator::fast_parallel_blobs_do(f);
break;
}
default:
ShouldNotReachHere();
}
}
void ShenandoahCodeRootsIterator::fast_parallel_blobs_do(CodeBlobClosure *f) {
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
assert(_table_snapshot != NULL, "Sanity");
_table_snapshot->parallel_blobs_do(f);
}

@ -78,7 +78,6 @@ public:
~ShenandoahCodeRootsIterator();
void possibly_parallel_blobs_do(CodeBlobClosure *f);
void fast_parallel_blobs_do(CodeBlobClosure *f);
};
class ShenandoahCodeRoots : public AllStatic {

@ -37,12 +37,7 @@ bool ShenandoahConcurrentRoots::should_do_concurrent_roots() {
}
bool ShenandoahConcurrentRoots::can_do_concurrent_class_unloading() {
#if (defined(X86) || defined(AARCH64))
return ShenandoahCodeRootsStyle == 2 &&
ClassUnloading;
#else
return false;
#endif
return ClassUnloading;
}
bool ShenandoahConcurrentRoots::should_do_concurrent_class_unloading() {

@ -336,12 +336,6 @@
product(bool, ShenandoahLoadRefBarrier, true, DIAGNOSTIC, \
"Turn on/off load-reference barriers in Shenandoah") \
\
product(uintx, ShenandoahCodeRootsStyle, 2, DIAGNOSTIC, \
"Use this style to scan the code cache roots:" \
" 0 - sequential iterator;" \
" 1 - parallel iterator;" \
" 2 - parallel iterator with cset filters;") \
\
develop(bool, ShenandoahVerifyOptoBarriers, false, \
"Verify no missing barriers in C2.") \
\

@ -1,39 +0,0 @@
/*
* Copyright (c) 2017, 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.
*
*/
/* @test TestCodeCacheRootStyles
* @requires vm.gc.Shenandoah
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahCodeRootsStyle=0 TestCodeCacheRootStyles
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahCodeRootsStyle=1 TestCodeCacheRootStyles
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahCodeRootsStyle=2 TestCodeCacheRootStyles
*/
public class TestCodeCacheRootStyles {
public static void main(String[] args) {
// Bug should crash before we get here.
}
}