1 /*
   2  * Copyright (c) 1997, 2019, 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_WRITEABLE(type)
  81 
  82 #define VM_FLAGS(             \
  83     develop,                  \
  84     develop_pd,               \
  85     product,                  \
  86     product_pd,               \
  87     diagnostic,               \
  88     diagnostic_pd,            \
  89     experimental,             \
  90     notproduct,               \
  91     manageable,               \
  92     product_rw,               \
  93     lp64_product,             \
  94     range,                    \
  95     constraint,               \
  96     writeable)                \
  97                               \
  98   RUNTIME_FLAGS(              \
  99     develop,                  \
 100     develop_pd,               \
 101     product,                  \
 102     product_pd,               \
 103     diagnostic,               \
 104     diagnostic_pd,            \
 105     experimental,             \
 106     notproduct,               \
 107     manageable,               \
 108     product_rw,               \
 109     lp64_product,             \
 110     range,                    \
 111     constraint,               \
 112     writeable)                \
 113                               \
 114   GC_FLAGS(                   \
 115     develop,                  \
 116     develop_pd,               \
 117     product,                  \
 118     product_pd,               \
 119     diagnostic,               \
 120     diagnostic_pd,            \
 121     experimental,             \
 122     notproduct,               \
 123     manageable,               \
 124     product_rw,               \
 125     lp64_product,             \
 126     range,                    \
 127     constraint,               \
 128     writeable)                \
 129 
 130 
 131 #define ALL_FLAGS(            \
 132     develop,                  \
 133     develop_pd,               \
 134     product,                  \
 135     product_pd,               \
 136     diagnostic,               \
 137     diagnostic_pd,            \
 138     experimental,             \
 139     notproduct,               \
 140     manageable,               \
 141     product_rw,               \
 142     lp64_product,             \
 143     range,                    \
 144     constraint,               \
 145     writeable)                \
 146                               \
 147   VM_FLAGS(                   \
 148     develop,                  \
 149     develop_pd,               \
 150     product,                  \
 151     product_pd,               \
 152     diagnostic,               \
 153     diagnostic_pd,            \
 154     experimental,             \
 155     notproduct,               \
 156     manageable,               \
 157     product_rw,               \
 158     lp64_product,             \
 159     range,                    \
 160     constraint,               \
 161     writeable)                \
 162                               \
 163   RUNTIME_OS_FLAGS(           \
 164     develop,                  \
 165     develop_pd,               \
 166     product,                  \
 167     product_pd,               \
 168     diagnostic,               \
 169     diagnostic_pd,            \
 170     notproduct,               \
 171     range,                    \
 172     constraint,               \
 173     writeable)                \
 174                               \
 175   JVMCI_ONLY(JVMCI_FLAGS(     \
 176     develop,                  \
 177     develop_pd,               \
 178     product,                  \
 179     product_pd,               \
 180     diagnostic,               \
 181     diagnostic_pd,            \
 182     experimental,             \
 183     notproduct,               \
 184     range,                    \
 185     constraint,               \
 186     writeable))               \
 187                               \
 188   COMPILER1_PRESENT(C1_FLAGS( \
 189     develop,                  \
 190     develop_pd,               \
 191     product,                  \
 192     product_pd,               \
 193     diagnostic,               \
 194     diagnostic_pd,            \
 195     notproduct,               \
 196     range,                    \
 197     constraint,               \
 198     writeable))               \
 199                               \
 200   COMPILER2_PRESENT(C2_FLAGS( \
 201     develop,                  \
 202     develop_pd,               \
 203     product,                  \
 204     product_pd,               \
 205     diagnostic,               \
 206     diagnostic_pd,            \
 207     experimental,             \
 208     notproduct,               \
 209     range,                    \
 210     constraint,               \
 211     writeable))               \
 212                               \
 213   ARCH_FLAGS(                 \
 214     develop,                  \
 215     product,                  \
 216     diagnostic,               \
 217     experimental,             \
 218     notproduct,               \
 219     range,                    \
 220     constraint,               \
 221     writeable)
 222 
 223 #endif // SHARE_RUNTIME_GLOBALS_SHARED_HPP