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