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(size_t, YoungPLABSizeConstraintFunc)                        \
46  f(size_t, OldPLABSizeConstraintFunc)                          \
47  f(uintx,  MinHeapFreeRatioConstraintFunc)                     \
48  f(uintx,  MaxHeapFreeRatioConstraintFunc)                     \
49  f(intx,   SoftRefLRUPolicyMSPerMBConstraintFunc)              \
50  f(size_t, MarkStackSizeConstraintFunc)                        \
51  f(uintx,  MinMetaspaceFreeRatioConstraintFunc)                \
52  f(uintx,  MaxMetaspaceFreeRatioConstraintFunc)                \
53  f(uintx,  InitialTenuringThresholdConstraintFunc)             \
54  f(uintx,  MaxTenuringThresholdConstraintFunc)                 \
55                                                                \
56  f(uintx,  MaxGCPauseMillisConstraintFunc)                     \
57  f(uintx,  GCPauseIntervalMillisConstraintFunc)                \
58  f(size_t, MinHeapSizeConstraintFunc)                          \
59  f(size_t, InitialHeapSizeConstraintFunc)                      \
60  f(size_t, MaxHeapSizeConstraintFunc)                          \
61  f(size_t, SoftMaxHeapSizeConstraintFunc)                      \
62  f(size_t, HeapBaseMinAddressConstraintFunc)                   \
63  f(size_t, NewSizeConstraintFunc)                              \
64  f(size_t, MinTLABSizeConstraintFunc)                          \
65  f(size_t, TLABSizeConstraintFunc)                             \
66  f(uintx,  TLABWasteIncrementConstraintFunc)                   \
67  f(uintx,  SurvivorRatioConstraintFunc)                        \
68  f(size_t, MetaspaceSizeConstraintFunc)                        \
69  f(size_t, MaxMetaspaceSizeConstraintFunc)                     \
70  f(uint, GCCardSizeInBytesConstraintFunc)
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