1 /*
2  * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 #ifndef SHARE_GC_SHARED_JVMFLAGCONSTRAINTSGC_HPP
26 #define SHARE_GC_SHARED_JVMFLAGCONSTRAINTSGC_HPP
27 
28 #include "runtime/flags/jvmFlag.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/macros.hpp"
31 #if INCLUDE_G1GC
32 #include "gc/g1/jvmFlagConstraintsG1.hpp"
33 #endif
34 #if INCLUDE_PARALLELGC
35 #include "gc/parallel/jvmFlagConstraintsParallel.hpp"
36 #endif
37 
38 /*
39  * Here we have GC arguments constraints functions, which are called automatically
40  * whenever flag's value changes. If the constraint fails the function should return
41  * an appropriate error value.
42  */
43 #define SHARED_GC_CONSTRAINTS(f)                               \
44  f(uint,   ParallelGCThreadsConstraintFunc)                    \
45  f(uint,   ConcGCThreadsConstraintFunc)                        \
46  f(size_t, YoungPLABSizeConstraintFunc)                        \
47  f(size_t, OldPLABSizeConstraintFunc)                          \
48  f(uintx,  MinHeapFreeRatioConstraintFunc)                     \
49  f(uintx,  MaxHeapFreeRatioConstraintFunc)                     \
50  f(intx,   SoftRefLRUPolicyMSPerMBConstraintFunc)              \
51  f(size_t, MarkStackSizeConstraintFunc)                        \
52  f(uintx,  MinMetaspaceFreeRatioConstraintFunc)                \
53  f(uintx,  MaxMetaspaceFreeRatioConstraintFunc)                \
54  f(uintx,  InitialTenuringThresholdConstraintFunc)             \
55  f(uintx,  MaxTenuringThresholdConstraintFunc)                 \
56                                                                \
57  f(uintx,  MaxGCPauseMillisConstraintFunc)                     \
58  f(uintx,  GCPauseIntervalMillisConstraintFunc)                \
59  f(size_t, MinHeapSizeConstraintFunc)                          \
60  f(size_t, InitialHeapSizeConstraintFunc)                      \
61  f(size_t, MaxHeapSizeConstraintFunc)                          \
62  f(size_t, SoftMaxHeapSizeConstraintFunc)                      \
63  f(size_t, HeapBaseMinAddressConstraintFunc)                   \
64  f(size_t, NewSizeConstraintFunc)                              \
65  f(size_t, MinTLABSizeConstraintFunc)                          \
66  f(size_t, TLABSizeConstraintFunc)                             \
67  f(uintx,  TLABWasteIncrementConstraintFunc)                   \
68  f(uintx,  SurvivorRatioConstraintFunc)                        \
69  f(size_t, MetaspaceSizeConstraintFunc)                        \
70  f(size_t, MaxMetaspaceSizeConstraintFunc)
71 
72 SHARED_GC_CONSTRAINTS(DECLARE_CONSTRAINT)
73 
74 JVMFlag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbose);
75 
76 #define GC_CONSTRAINTS(f)                      \
77   SHARED_GC_CONSTRAINTS(f)                     \
78   G1GC_ONLY(G1_GC_CONSTRAINTS(f))              \
79   PARALLELGC_ONLY(PARALLEL_GC_CONSTRAINTS(f))
80 
81 #endif // SHARE_GC_SHARED_JVMFLAGCONSTRAINTSGC_HPP
82