1 /*
2  * Copyright (c) 1997, 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_RUNTIME_GLOBALS_SHARED_HPP
26 #define SHARE_RUNTIME_GLOBALS_SHARED_HPP
27 
28 #include "utilities/align.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/macros.hpp"
31 
32 #include <float.h> // for DBL_MAX
33 
34 // The larger HeapWordSize for 64bit requires larger heaps
35 // for the same application running in 64bit.  See bug 4967770.
36 // The minimum alignment to a heap word size is done.  Other
37 // parts of the memory system may require additional alignment
38 // and are responsible for those alignments.
39 #ifdef _LP64
40 #define ScaleForWordSize(x) align_down((x) * 13 / 10, HeapWordSize)
41 #else
42 #define ScaleForWordSize(x) (x)
43 #endif
44 
45 // use this for flags that are true per default in the tiered build
46 // but false in non-tiered builds, and vice versa
47 #ifdef TIERED
48 #define  trueInTiered true
49 #define falseInTiered false
50 #else
51 #define  trueInTiered false
52 #define falseInTiered true
53 #endif
54 
55 // use this for flags that are true by default in the debug version but
56 // false in the optimized version, and vice versa
57 #ifdef ASSERT
58 #define trueInDebug  true
59 #define falseInDebug false
60 #else
61 #define trueInDebug  false
62 #define falseInDebug true
63 #endif
64 
65 // use this for flags that are true per default in the product build
66 // but false in development builds, and vice versa
67 #ifdef PRODUCT
68 #define trueInProduct  true
69 #define falseInProduct false
70 #else
71 #define trueInProduct  false
72 #define falseInProduct true
73 #endif
74 
75 // Only materialize src code for range checking when required, ignore otherwise
76 #define IGNORE_RANGE(a, b)
77 // Only materialize src code for contraint checking when required, ignore otherwise
78 #define IGNORE_CONSTRAINT(func,type)
79 
80 #define IGNORE_FLAG(...)
81 
82 #define VM_FLAGS(             \
83     develop,                  \
84     develop_pd,               \
85     product,                  \
86     product_pd,               \
87     notproduct,               \
88     range,                    \
89     constraint)               \
90                               \
91   RUNTIME_FLAGS(              \
92     develop,                  \
93     develop_pd,               \
94     product,                  \
95     product_pd,               \
96     notproduct,               \
97     range,                    \
98     constraint)               \
99                               \
100   GC_FLAGS(                   \
101     develop,                  \
102     develop_pd,               \
103     product,                  \
104     product_pd,               \
105     notproduct,               \
106     range,                    \
107     constraint)               \
108 
109 // Put the LP64/JVMCI/COMPILER1/COMPILER1/ARCH at
110 // the top, as they are processed by jvmFlags.cpp in that
111 // order.
112 
113 #define ALL_FLAGS(            \
114     develop,                  \
115     develop_pd,               \
116     product,                  \
117     product_pd,               \
118     notproduct,               \
119     range,                    \
120     constraint)               \
121                               \
122   LP64_RUNTIME_FLAGS(         \
123     develop,                  \
124     develop_pd,               \
125     product,                  \
126     product_pd,               \
127     notproduct,               \
128     range,                    \
129     constraint)               \
130                               \
131   JVMCI_ONLY(JVMCI_FLAGS(     \
132     develop,                  \
133     develop_pd,               \
134     product,                  \
135     product_pd,               \
136     notproduct,               \
137     range,                    \
138     constraint))              \
139                               \
140   COMPILER1_PRESENT(C1_FLAGS( \
141     develop,                  \
142     develop_pd,               \
143     product,                  \
144     product_pd,               \
145     notproduct,               \
146     range,                    \
147     constraint))              \
148                               \
149   COMPILER2_PRESENT(C2_FLAGS( \
150     develop,                  \
151     develop_pd,               \
152     product,                  \
153     product_pd,               \
154     notproduct,               \
155     range,                    \
156     constraint))              \
157                               \
158   ARCH_FLAGS(                 \
159     develop,                  \
160     product,                  \
161     notproduct,               \
162     range,                    \
163     constraint)               \
164                               \
165   VM_FLAGS(                   \
166     develop,                  \
167     develop_pd,               \
168     product,                  \
169     product_pd,               \
170     notproduct,               \
171     range,                    \
172     constraint)               \
173                               \
174   RUNTIME_OS_FLAGS(           \
175     develop,                  \
176     develop_pd,               \
177     product,                  \
178     product_pd,               \
179     notproduct,               \
180     range,                    \
181     constraint)
182 
183 #define ALL_CONSTRAINTS(f)    \
184   COMPILER_CONSTRAINTS(f)     \
185   RUNTIME_CONSTRAINTS(f)      \
186   GC_CONSTRAINTS(f)
187 
188 #endif // SHARE_RUNTIME_GLOBALS_SHARED_HPP
189