OpenJDK / jdk / jdk
changeset 59237:a8dd9e32110b
8244737: Shenandoah: move mode code to gc/shenandoah/mode
Reviewed-by: rkennke
author | shade |
---|---|
date | Mon, 11 May 2020 18:33:33 +0200 |
parents | 1c6c963683e2 |
children | 4ea431f68e73 |
files | src/hotspot/share/gc/shenandoah/mode/shenandoahIUMode.cpp src/hotspot/share/gc/shenandoah/mode/shenandoahIUMode.hpp src/hotspot/share/gc/shenandoah/mode/shenandoahMode.hpp src/hotspot/share/gc/shenandoah/mode/shenandoahNormalMode.cpp src/hotspot/share/gc/shenandoah/mode/shenandoahNormalMode.hpp src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp src/hotspot/share/gc/shenandoah/shenandoahIUMode.cpp src/hotspot/share/gc/shenandoah/shenandoahIUMode.hpp src/hotspot/share/gc/shenandoah/shenandoahMode.hpp src/hotspot/share/gc/shenandoah/shenandoahNormalMode.cpp src/hotspot/share/gc/shenandoah/shenandoahNormalMode.hpp src/hotspot/share/gc/shenandoah/shenandoahPassiveMode.cpp src/hotspot/share/gc/shenandoah/shenandoahPassiveMode.hpp |
diffstat | 15 files changed, 367 insertions(+), 367 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahIUMode.cpp Mon May 11 18:33:33 2020 +0200 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 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/heuristics/shenandoahAdaptiveHeuristics.hpp" +#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" +#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" +#include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" +#include "gc/shenandoah/mode/shenandoahIUMode.hpp" +#include "logging/log.hpp" +#include "logging/logTag.hpp" + +void ShenandoahIUMode::initialize_flags() const { + if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) { + FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true); + FLAG_SET_DEFAULT(VerifyBeforeExit, false); + } + + if (FLAG_IS_DEFAULT(ShenandoahStoreValEnqueueBarrier)) { + FLAG_SET_DEFAULT(ShenandoahStoreValEnqueueBarrier, true); + } + if (FLAG_IS_DEFAULT(ShenandoahSATBBarrier)) { + FLAG_SET_DEFAULT(ShenandoahSATBBarrier, false); + } + + SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent); + SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent); + + // Final configuration checks + SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier); + SHENANDOAH_CHECK_FLAG_UNSET(ShenandoahSATBBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahStoreValEnqueueBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahIUMode.hpp Mon May 11 18:33:33 2020 +0200 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 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. + * + */ + +#ifndef SHARE_GC_SHENANDOAH_MODE_SHENANDOAHIUMODE_HPP +#define SHARE_GC_SHENANDOAH_MODE_SHENANDOAHIUMODE_HPP + +#include "gc/shenandoah/mode/shenandoahNormalMode.hpp" + +class ShenandoahHeuristics; + +class ShenandoahIUMode : public ShenandoahNormalMode { +public: + virtual void initialize_flags() const; + + virtual const char* name() { return "Incremental-Update"; } + virtual bool is_diagnostic() { return false; } + virtual bool is_experimental() { return true; } +}; + +#endif // SHARE_GC_SHENANDOAH_MODE_SHENANDOAHIUMODE_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahMode.hpp Mon May 11 18:33:33 2020 +0200 @@ -0,0 +1,57 @@ +/* + * 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_MODE_SHENANDOAHMODE_HPP +#define SHARE_GC_SHENANDOAH_MODE_SHENANDOAHMODE_HPP + +#include "memory/allocation.hpp" + +class ShenandoahHeuristics; + +#define SHENANDOAH_CHECK_FLAG_SET(name) \ + do { \ + if (!(name)) { \ + err_msg message("GC mode needs -XX:+" #name " to work correctly"); \ + vm_exit_during_initialization("Error", message); \ + } \ + } while (0) + +#define SHENANDOAH_CHECK_FLAG_UNSET(name) \ + do { \ + if ((name)) { \ + err_msg message("GC mode needs -XX:-" #name " to work correctly"); \ + vm_exit_during_initialization("Error", message); \ + } \ + } while (0) + +class ShenandoahMode : public CHeapObj<mtGC> { +public: + virtual void initialize_flags() const = 0; + virtual ShenandoahHeuristics* initialize_heuristics() const = 0; + virtual const char* name() = 0; + virtual bool is_diagnostic() = 0; + virtual bool is_experimental() = 0; +}; + +#endif // SHARE_GC_SHENANDOAH_MODE_SHENANDOAHMODE_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahNormalMode.cpp Mon May 11 18:33:33 2020 +0200 @@ -0,0 +1,68 @@ +/* + * 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/heuristics/shenandoahAdaptiveHeuristics.hpp" +#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" +#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" +#include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" +#include "gc/shenandoah/mode/shenandoahNormalMode.hpp" +#include "logging/log.hpp" +#include "logging/logTag.hpp" + +void ShenandoahNormalMode::initialize_flags() const { + if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) { + FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true); + FLAG_SET_DEFAULT(VerifyBeforeExit, false); + } + + SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent); + SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent); + + // Final configuration checks + SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier); + SHENANDOAH_CHECK_FLAG_UNSET(ShenandoahStoreValEnqueueBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahSATBBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier); + SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier); +} + +ShenandoahHeuristics* ShenandoahNormalMode::initialize_heuristics() const { + if (ShenandoahGCHeuristics != NULL) { + if (strcmp(ShenandoahGCHeuristics, "aggressive") == 0) { + return new ShenandoahAggressiveHeuristics(); + } else if (strcmp(ShenandoahGCHeuristics, "static") == 0) { + return new ShenandoahStaticHeuristics(); + } else if (strcmp(ShenandoahGCHeuristics, "adaptive") == 0) { + return new ShenandoahAdaptiveHeuristics(); + } else if (strcmp(ShenandoahGCHeuristics, "compact") == 0) { + return new ShenandoahCompactHeuristics(); + } else { + vm_exit_during_initialization("Unknown -XX:ShenandoahGCHeuristics option"); + } + } + ShouldNotReachHere(); + return NULL; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahNormalMode.hpp Mon May 11 18:33:33 2020 +0200 @@ -0,0 +1,41 @@ +/* + * 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_MODE_SHENANDOAHNORMALMODE_HPP +#define SHARE_GC_SHENANDOAH_MODE_SHENANDOAHNORMALMODE_HPP + +#include "gc/shenandoah/mode/shenandoahMode.hpp" + +class ShenandoahHeuristics; + +class ShenandoahNormalMode : public ShenandoahMode { +public: + virtual void initialize_flags() const; + virtual ShenandoahHeuristics* initialize_heuristics() const; + virtual const char* name() { return "Normal"; } + virtual bool is_diagnostic() { return false; } + virtual bool is_experimental() { return false; } +}; + +#endif // SHARE_GC_SHENANDOAH_MODE_SHENANDOAHNORMALMODE_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.cpp Mon May 11 18:33:33 2020 +0200 @@ -0,0 +1,60 @@ +/* + * 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. + * + */ + +#include "precompiled.hpp" +#include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" +#include "gc/shenandoah/mode/shenandoahPassiveMode.hpp" +#include "logging/log.hpp" +#include "logging/logTag.hpp" + +void ShenandoahPassiveMode::initialize_flags() const { + // Do not allow concurrent cycles. + FLAG_SET_DEFAULT(ExplicitGCInvokesConcurrent, false); + FLAG_SET_DEFAULT(ShenandoahImplicitGCInvokesConcurrent, false); + + // Passive runs with max speed for allocation, because GC is always STW + SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahPacing); + + // No need for evacuation reserve with Full GC, only for Degenerated GC. + if (!ShenandoahDegeneratedGC) { + SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahEvacReserve, 0); + } + + // Disable known barriers by default. + SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahLoadRefBarrier); + SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahSATBBarrier); + SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahStoreValEnqueueBarrier); + SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCASBarrier); + SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCloneBarrier); + + // Final configuration checks + // No barriers are required to run. +} +ShenandoahHeuristics* ShenandoahPassiveMode::initialize_heuristics() const { + if (ShenandoahGCHeuristics != NULL) { + return new ShenandoahPassiveHeuristics(); + } + ShouldNotReachHere(); + return NULL; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/mode/shenandoahPassiveMode.hpp Mon May 11 18:33:33 2020 +0200 @@ -0,0 +1,40 @@ +/* + * 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_MODE_SHENANDOAHPASSIVEMODE_HPP +#define SHARE_GC_SHENANDOAH_MODE_SHENANDOAHPASSIVEMODE_HPP + +#include "gc/shenandoah/mode/shenandoahNormalMode.hpp" + +class ShenandoahPassiveMode : public ShenandoahNormalMode { +public: + virtual void initialize_flags() const; + virtual ShenandoahHeuristics* initialize_heuristics() const; + + virtual const char* name() { return "Passive"; } + virtual bool is_diagnostic() { return true; } + virtual bool is_experimental() { return false; } +}; + +#endif // SHARE_GC_SHENANDOAH_MODE_SHENANDOAHPASSIVEMODE_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon May 11 18:33:24 2020 +0200 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon May 11 18:33:33 2020 +0200 @@ -46,18 +46,15 @@ #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.hpp" -#include "gc/shenandoah/shenandoahIUMode.hpp" #include "gc/shenandoah/shenandoahMarkCompact.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahMemoryPool.hpp" #include "gc/shenandoah/shenandoahMetrics.hpp" #include "gc/shenandoah/shenandoahMonitoringSupport.hpp" -#include "gc/shenandoah/shenandoahNormalMode.hpp" #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" #include "gc/shenandoah/shenandoahPacer.inline.hpp" #include "gc/shenandoah/shenandoahPadding.hpp" #include "gc/shenandoah/shenandoahParallelCleaning.inline.hpp" -#include "gc/shenandoah/shenandoahPassiveMode.hpp" #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" #include "gc/shenandoah/shenandoahTaskqueue.hpp" @@ -67,6 +64,9 @@ #include "gc/shenandoah/shenandoahVMOperations.hpp" #include "gc/shenandoah/shenandoahWorkGroup.hpp" #include "gc/shenandoah/shenandoahWorkerPolicy.hpp" +#include "gc/shenandoah/mode/shenandoahIUMode.hpp" +#include "gc/shenandoah/mode/shenandoahNormalMode.hpp" +#include "gc/shenandoah/mode/shenandoahPassiveMode.hpp" #if INCLUDE_JFR #include "gc/shenandoah/shenandoahJfrSupport.hpp" #endif
--- a/src/hotspot/share/gc/shenandoah/shenandoahIUMode.cpp Mon May 11 18:33:24 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 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/shenandoahIUMode.hpp" -#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp" -#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" -#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" -#include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" -#include "logging/log.hpp" -#include "logging/logTag.hpp" - -void ShenandoahIUMode::initialize_flags() const { - if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) { - FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true); - FLAG_SET_DEFAULT(VerifyBeforeExit, false); - } - - if (FLAG_IS_DEFAULT(ShenandoahStoreValEnqueueBarrier)) { - FLAG_SET_DEFAULT(ShenandoahStoreValEnqueueBarrier, true); - } - if (FLAG_IS_DEFAULT(ShenandoahSATBBarrier)) { - FLAG_SET_DEFAULT(ShenandoahSATBBarrier, false); - } - - SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent); - SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent); - - // Final configuration checks - SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier); - SHENANDOAH_CHECK_FLAG_UNSET(ShenandoahSATBBarrier); - SHENANDOAH_CHECK_FLAG_SET(ShenandoahStoreValEnqueueBarrier); - SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier); - SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier); -}
--- a/src/hotspot/share/gc/shenandoah/shenandoahIUMode.hpp Mon May 11 18:33:24 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 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. - * - */ - -#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHIUMODE_HPP -#define SHARE_GC_SHENANDOAH_SHENANDOAHIUMODE_HPP - -#include "gc/shenandoah/shenandoahNormalMode.hpp" - -class ShenandoahHeuristics; - -class ShenandoahIUMode : public ShenandoahNormalMode { -public: - virtual void initialize_flags() const; - - virtual const char* name() { return "Incremental-Update"; } - virtual bool is_diagnostic() { return false; } - virtual bool is_experimental() { return true; } -}; - -#endif // SHARE_GC_SHENANDOAH_SHENANDOAHIUMODE_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahMode.hpp Mon May 11 18:33:24 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +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_SHENANDOAHMODE_HPP -#define SHARE_GC_SHENANDOAH_SHENANDOAHMODE_HPP - -#include "memory/allocation.hpp" - -class ShenandoahHeuristics; - -#define SHENANDOAH_CHECK_FLAG_SET(name) \ - do { \ - if (!(name)) { \ - err_msg message("GC mode needs -XX:+" #name " to work correctly"); \ - vm_exit_during_initialization("Error", message); \ - } \ - } while (0) - -#define SHENANDOAH_CHECK_FLAG_UNSET(name) \ - do { \ - if ((name)) { \ - err_msg message("GC mode needs -XX:-" #name " to work correctly"); \ - vm_exit_during_initialization("Error", message); \ - } \ - } while (0) - -class ShenandoahMode : public CHeapObj<mtGC> { -public: - virtual void initialize_flags() const = 0; - virtual ShenandoahHeuristics* initialize_heuristics() const = 0; - virtual const char* name() = 0; - virtual bool is_diagnostic() = 0; - virtual bool is_experimental() = 0; -}; - -#endif // SHARE_GC_SHENANDOAH_SHENANDOAHMODE_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahNormalMode.cpp Mon May 11 18:33:24 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +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/shenandoahNormalMode.hpp" -#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp" -#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" -#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" -#include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" -#include "logging/log.hpp" -#include "logging/logTag.hpp" - -void ShenandoahNormalMode::initialize_flags() const { - if (ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) { - FLAG_SET_DEFAULT(ShenandoahSuspendibleWorkers, true); - FLAG_SET_DEFAULT(VerifyBeforeExit, false); - } - - SHENANDOAH_ERGO_ENABLE_FLAG(ExplicitGCInvokesConcurrent); - SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahImplicitGCInvokesConcurrent); - - // Final configuration checks - SHENANDOAH_CHECK_FLAG_SET(ShenandoahLoadRefBarrier); - SHENANDOAH_CHECK_FLAG_UNSET(ShenandoahStoreValEnqueueBarrier); - SHENANDOAH_CHECK_FLAG_SET(ShenandoahSATBBarrier); - SHENANDOAH_CHECK_FLAG_SET(ShenandoahCASBarrier); - SHENANDOAH_CHECK_FLAG_SET(ShenandoahCloneBarrier); -} - -ShenandoahHeuristics* ShenandoahNormalMode::initialize_heuristics() const { - if (ShenandoahGCHeuristics != NULL) { - if (strcmp(ShenandoahGCHeuristics, "aggressive") == 0) { - return new ShenandoahAggressiveHeuristics(); - } else if (strcmp(ShenandoahGCHeuristics, "static") == 0) { - return new ShenandoahStaticHeuristics(); - } else if (strcmp(ShenandoahGCHeuristics, "adaptive") == 0) { - return new ShenandoahAdaptiveHeuristics(); - } else if (strcmp(ShenandoahGCHeuristics, "compact") == 0) { - return new ShenandoahCompactHeuristics(); - } else { - vm_exit_during_initialization("Unknown -XX:ShenandoahGCHeuristics option"); - } - } - ShouldNotReachHere(); - return NULL; -}
--- a/src/hotspot/share/gc/shenandoah/shenandoahNormalMode.hpp Mon May 11 18:33:24 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +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_SHENANDOAHNORMALMODE_HPP -#define SHARE_GC_SHENANDOAH_SHENANDOAHNORMALMODE_HPP - -#include "gc/shenandoah/shenandoahMode.hpp" - -class ShenandoahHeuristics; - -class ShenandoahNormalMode : public ShenandoahMode { -public: - virtual void initialize_flags() const; - virtual ShenandoahHeuristics* initialize_heuristics() const; - virtual const char* name() { return "Normal"; } - virtual bool is_diagnostic() { return false; } - virtual bool is_experimental() { return false; } -}; - -#endif // SHARE_GC_SHENANDOAH_SHENANDOAHNORMALMODE_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahPassiveMode.cpp Mon May 11 18:33:24 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +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. - * - */ - -#include "precompiled.hpp" -#include "gc/shenandoah/shenandoahPassiveMode.hpp" -#include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" -#include "logging/log.hpp" -#include "logging/logTag.hpp" - -void ShenandoahPassiveMode::initialize_flags() const { - // Do not allow concurrent cycles. - FLAG_SET_DEFAULT(ExplicitGCInvokesConcurrent, false); - FLAG_SET_DEFAULT(ShenandoahImplicitGCInvokesConcurrent, false); - - // Passive runs with max speed for allocation, because GC is always STW - SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahPacing); - - // No need for evacuation reserve with Full GC, only for Degenerated GC. - if (!ShenandoahDegeneratedGC) { - SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahEvacReserve, 0); - } - - // Disable known barriers by default. - SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahLoadRefBarrier); - SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahSATBBarrier); - SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahStoreValEnqueueBarrier); - SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCASBarrier); - SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCloneBarrier); - - // Final configuration checks - // No barriers are required to run. -} -ShenandoahHeuristics* ShenandoahPassiveMode::initialize_heuristics() const { - if (ShenandoahGCHeuristics != NULL) { - return new ShenandoahPassiveHeuristics(); - } - ShouldNotReachHere(); - return NULL; -}
--- a/src/hotspot/share/gc/shenandoah/shenandoahPassiveMode.hpp Mon May 11 18:33:24 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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_SHENANDOAHPASSIVEMODE_HPP -#define SHARE_GC_SHENANDOAH_SHENANDOAHPASSIVEMODE_HPP - -#include "gc/shenandoah/shenandoahNormalMode.hpp" - -class ShenandoahPassiveMode : public ShenandoahNormalMode { -public: - virtual void initialize_flags() const; - virtual ShenandoahHeuristics* initialize_heuristics() const; - - virtual const char* name() { return "Passive"; } - virtual bool is_diagnostic() { return true; } - virtual bool is_experimental() { return false; } -}; - -#endif // SHARE_GC_SHENANDOAH_SHENANDOAHNORMALMODE_HPP