src/hotspot/share/runtime/globals.hpp
changeset 54982 b18c8301b8c2
parent 54927 1512d88b24c6
child 55044 d3afe760b392
equal deleted inserted replaced
54981:0b56fc0448ec 54982:b18c8301b8c2
    23  */
    23  */
    24 
    24 
    25 #ifndef SHARE_RUNTIME_GLOBALS_HPP
    25 #ifndef SHARE_RUNTIME_GLOBALS_HPP
    26 #define SHARE_RUNTIME_GLOBALS_HPP
    26 #define SHARE_RUNTIME_GLOBALS_HPP
    27 
    27 
       
    28 #include "compiler/compiler_globals.hpp"
    28 #include "gc/shared/gc_globals.hpp"
    29 #include "gc/shared/gc_globals.hpp"
       
    30 #include "runtime/globals_shared.hpp"
    29 #include "utilities/align.hpp"
    31 #include "utilities/align.hpp"
    30 #include "utilities/globalDefinitions.hpp"
    32 #include "utilities/globalDefinitions.hpp"
    31 #include "utilities/macros.hpp"
    33 #include "utilities/macros.hpp"
    32 
       
    33 #include <float.h> // for DBL_MAX
       
    34 
       
    35 // The larger HeapWordSize for 64bit requires larger heaps
       
    36 // for the same application running in 64bit.  See bug 4967770.
       
    37 // The minimum alignment to a heap word size is done.  Other
       
    38 // parts of the memory system may require additional alignment
       
    39 // and are responsible for those alignments.
       
    40 #ifdef _LP64
       
    41 #define ScaleForWordSize(x) align_down_((x) * 13 / 10, HeapWordSize)
       
    42 #else
       
    43 #define ScaleForWordSize(x) (x)
       
    44 #endif
       
    45 
       
    46 // use this for flags that are true per default in the tiered build
       
    47 // but false in non-tiered builds, and vice versa
       
    48 #ifdef TIERED
       
    49 #define  trueInTiered true
       
    50 #define falseInTiered false
       
    51 #else
       
    52 #define  trueInTiered false
       
    53 #define falseInTiered true
       
    54 #endif
       
    55 
       
    56 // Default and minimum StringTable and SymbolTable size values
       
    57 // Must be powers of 2
       
    58 const size_t defaultStringTableSize = NOT_LP64(1024) LP64_ONLY(65536);
       
    59 const size_t minimumStringTableSize = 128;
       
    60 const size_t defaultSymbolTableSize = 32768; // 2^15
       
    61 const size_t minimumSymbolTableSize = 1024;
       
    62 
       
    63 #include CPU_HEADER(globals)
    34 #include CPU_HEADER(globals)
    64 #include OS_HEADER(globals)
    35 #include OS_HEADER(globals)
    65 #include OS_CPU_HEADER(globals)
    36 #include OS_CPU_HEADER(globals)
    66 #ifdef COMPILER1
       
    67 #include CPU_HEADER(c1_globals)
       
    68 #include OS_HEADER(c1_globals)
       
    69 #endif
       
    70 #ifdef COMPILER2
       
    71 #include CPU_HEADER(c2_globals)
       
    72 #include OS_HEADER(c2_globals)
       
    73 #endif
       
    74 
       
    75 #if !defined(COMPILER1) && !defined(COMPILER2) && !INCLUDE_JVMCI
       
    76 define_pd_global(bool, BackgroundCompilation,        false);
       
    77 define_pd_global(bool, UseTLAB,                      false);
       
    78 define_pd_global(bool, CICompileOSR,                 false);
       
    79 define_pd_global(bool, UseTypeProfile,               false);
       
    80 define_pd_global(bool, UseOnStackReplacement,        false);
       
    81 define_pd_global(bool, InlineIntrinsics,             false);
       
    82 define_pd_global(bool, PreferInterpreterNativeStubs, true);
       
    83 define_pd_global(bool, ProfileInterpreter,           false);
       
    84 define_pd_global(bool, ProfileTraps,                 false);
       
    85 define_pd_global(bool, TieredCompilation,            false);
       
    86 
       
    87 define_pd_global(intx, CompileThreshold,             0);
       
    88 
       
    89 define_pd_global(intx,   OnStackReplacePercentage,   0);
       
    90 define_pd_global(bool,   ResizeTLAB,                 false);
       
    91 define_pd_global(intx,   FreqInlineSize,             0);
       
    92 define_pd_global(size_t, NewSizeThreadIncrease,      4*K);
       
    93 define_pd_global(bool,   InlineClassNatives,         true);
       
    94 define_pd_global(bool,   InlineUnsafeOps,            true);
       
    95 define_pd_global(uintx,  InitialCodeCacheSize,       160*K);
       
    96 define_pd_global(uintx,  ReservedCodeCacheSize,      32*M);
       
    97 define_pd_global(uintx,  NonProfiledCodeHeapSize,    0);
       
    98 define_pd_global(uintx,  ProfiledCodeHeapSize,       0);
       
    99 define_pd_global(uintx,  NonNMethodCodeHeapSize,     32*M);
       
   100 
       
   101 define_pd_global(uintx,  CodeCacheExpansionSize,     32*K);
       
   102 define_pd_global(uintx,  CodeCacheMinBlockLength,    1);
       
   103 define_pd_global(uintx,  CodeCacheMinimumUseSpace,   200*K);
       
   104 define_pd_global(size_t, MetaspaceSize,              ScaleForWordSize(4*M));
       
   105 define_pd_global(bool, NeverActAsServerClassMachine, true);
       
   106 define_pd_global(uint64_t,MaxRAM,                    1ULL*G);
       
   107 #define CI_COMPILER_COUNT 0
       
   108 #else
       
   109 
       
   110 #if COMPILER2_OR_JVMCI
       
   111 #define CI_COMPILER_COUNT 2
       
   112 #else
       
   113 #define CI_COMPILER_COUNT 1
       
   114 #endif // COMPILER2_OR_JVMCI
       
   115 
       
   116 #endif // no compilers
       
   117 
       
   118 // use this for flags that are true by default in the debug version but
       
   119 // false in the optimized version, and vice versa
       
   120 #ifdef ASSERT
       
   121 #define trueInDebug  true
       
   122 #define falseInDebug false
       
   123 #else
       
   124 #define trueInDebug  false
       
   125 #define falseInDebug true
       
   126 #endif
       
   127 
       
   128 // use this for flags that are true per default in the product build
       
   129 // but false in development builds, and vice versa
       
   130 #ifdef PRODUCT
       
   131 #define trueInProduct  true
       
   132 #define falseInProduct false
       
   133 #else
       
   134 #define trueInProduct  false
       
   135 #define falseInProduct true
       
   136 #endif
       
   137 
    37 
   138 // develop flags are settable / visible only during development and are constant in the PRODUCT version
    38 // develop flags are settable / visible only during development and are constant in the PRODUCT version
   139 // product flags are always settable / visible
    39 // product flags are always settable / visible
   140 // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
    40 // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
   141 
    41 
   214 //
   114 //
   215 // writeable(CommandLineOnly) flag value's can be only set from command line
   115 // writeable(CommandLineOnly) flag value's can be only set from command line
   216 //    (multiple times allowed)
   116 //    (multiple times allowed)
   217 //
   117 //
   218 
   118 
       
   119 // Default and minimum StringTable and SymbolTable size values
       
   120 // Must be powers of 2
       
   121 const size_t defaultStringTableSize = NOT_LP64(1024) LP64_ONLY(65536);
       
   122 const size_t minimumStringTableSize = 128;
       
   123 const size_t defaultSymbolTableSize = 32768; // 2^15
       
   124 const size_t minimumSymbolTableSize = 1024;
   219 
   125 
   220 #define RUNTIME_FLAGS(develop, \
   126 #define RUNTIME_FLAGS(develop, \
   221                       develop_pd, \
   127                       develop_pd, \
   222                       product, \
   128                       product, \
   223                       product_pd, \
   129                       product_pd, \
  2557   JFR_ONLY(product(ccstr, StartFlightRecording, NULL,                       \
  2463   JFR_ONLY(product(ccstr, StartFlightRecording, NULL,                       \
  2558           "Start flight recording with options"))                           \
  2464           "Start flight recording with options"))                           \
  2559                                                                             \
  2465                                                                             \
  2560   experimental(bool, UseFastUnorderedTimeStamps, false,                     \
  2466   experimental(bool, UseFastUnorderedTimeStamps, false,                     \
  2561           "Use platform unstable time where supported for timestamps only")
  2467           "Use platform unstable time where supported for timestamps only")
  2562 
       
  2563 #define VM_FLAGS(develop,                                                   \
       
  2564                  develop_pd,                                                \
       
  2565                  product,                                                   \
       
  2566                  product_pd,                                                \
       
  2567                  diagnostic,                                                \
       
  2568                  diagnostic_pd,                                             \
       
  2569                  experimental,                                              \
       
  2570                  notproduct,                                                \
       
  2571                  manageable,                                                \
       
  2572                  product_rw,                                                \
       
  2573                  lp64_product,                                              \
       
  2574                  range,                                                     \
       
  2575                  constraint,                                                \
       
  2576                  writeable)                                                 \
       
  2577                                                                             \
       
  2578   RUNTIME_FLAGS(                                                            \
       
  2579     develop,                                                                \
       
  2580     develop_pd,                                                             \
       
  2581     product,                                                                \
       
  2582     product_pd,                                                             \
       
  2583     diagnostic,                                                             \
       
  2584     diagnostic_pd,                                                          \
       
  2585     experimental,                                                           \
       
  2586     notproduct,                                                             \
       
  2587     manageable,                                                             \
       
  2588     product_rw,                                                             \
       
  2589     lp64_product,                                                           \
       
  2590     range,                                                                  \
       
  2591     constraint,                                                             \
       
  2592     writeable)                                                              \
       
  2593                                                                             \
       
  2594   GC_FLAGS(                                                                 \
       
  2595     develop,                                                                \
       
  2596     develop_pd,                                                             \
       
  2597     product,                                                                \
       
  2598     product_pd,                                                             \
       
  2599     diagnostic,                                                             \
       
  2600     diagnostic_pd,                                                          \
       
  2601     experimental,                                                           \
       
  2602     notproduct,                                                             \
       
  2603     manageable,                                                             \
       
  2604     product_rw,                                                             \
       
  2605     lp64_product,                                                           \
       
  2606     range,                                                                  \
       
  2607     constraint,                                                             \
       
  2608     writeable)                                                              \
       
  2609 
       
  2610 /*
       
  2611  *  Macros for factoring of globals
       
  2612  */
       
  2613 
  2468 
  2614 // Interface macros
  2469 // Interface macros
  2615 #define DECLARE_PRODUCT_FLAG(type, name, value, doc)      extern "C" type name;
  2470 #define DECLARE_PRODUCT_FLAG(type, name, value, doc)      extern "C" type name;
  2616 #define DECLARE_PD_PRODUCT_FLAG(type, name, doc)          extern "C" type name;
  2471 #define DECLARE_PD_PRODUCT_FLAG(type, name, doc)          extern "C" type name;
  2617 #define DECLARE_DIAGNOSTIC_FLAG(type, name, value, doc)   extern "C" type name;
  2472 #define DECLARE_DIAGNOSTIC_FLAG(type, name, value, doc)   extern "C" type name;
  2633 #define DECLARE_LP64_PRODUCT_FLAG(type, name, value, doc) extern "C" type name;
  2488 #define DECLARE_LP64_PRODUCT_FLAG(type, name, value, doc) extern "C" type name;
  2634 #else
  2489 #else
  2635 #define DECLARE_LP64_PRODUCT_FLAG(type, name, value, doc) const type name = value;
  2490 #define DECLARE_LP64_PRODUCT_FLAG(type, name, value, doc) const type name = value;
  2636 #endif // _LP64
  2491 #endif // _LP64
  2637 
  2492 
  2638 // Implementation macros
  2493 ALL_FLAGS(DECLARE_DEVELOPER_FLAG,     \
  2639 #define MATERIALIZE_PRODUCT_FLAG(type, name, value, doc)      type name = value;
  2494           DECLARE_PD_DEVELOPER_FLAG,  \
  2640 #define MATERIALIZE_PD_PRODUCT_FLAG(type, name, doc)          type name = pd_##name;
  2495           DECLARE_PRODUCT_FLAG,       \
  2641 #define MATERIALIZE_DIAGNOSTIC_FLAG(type, name, value, doc)   type name = value;
  2496           DECLARE_PD_PRODUCT_FLAG,    \
  2642 #define MATERIALIZE_PD_DIAGNOSTIC_FLAG(type, name, doc)       type name = pd_##name;
  2497           DECLARE_DIAGNOSTIC_FLAG,    \
  2643 #define MATERIALIZE_EXPERIMENTAL_FLAG(type, name, value, doc) type name = value;
  2498           DECLARE_PD_DIAGNOSTIC_FLAG, \
  2644 #define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc)   type name = value;
  2499           DECLARE_EXPERIMENTAL_FLAG,  \
  2645 #define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc)   type name = value;
  2500           DECLARE_NOTPRODUCT_FLAG,    \
  2646 #ifdef PRODUCT
  2501           DECLARE_MANAGEABLE_FLAG,    \
  2647 #define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc)
  2502           DECLARE_PRODUCT_RW_FLAG,    \
  2648 #define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc)
  2503           DECLARE_LP64_PRODUCT_FLAG,  \
  2649 #define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc)
  2504           IGNORE_RANGE,               \
  2650 #else
  2505           IGNORE_CONSTRAINT,          \
  2651 #define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc)    type name = value;
  2506           IGNORE_WRITEABLE)
  2652 #define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc)        type name = pd_##name;
       
  2653 #define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc)   type name = value;
       
  2654 #endif // PRODUCT
       
  2655 #ifdef _LP64
       
  2656 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) type name = value;
       
  2657 #else
       
  2658 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) /* flag is constant */
       
  2659 #endif // _LP64
       
  2660 
       
  2661 // Only materialize src code for range checking when required, ignore otherwise
       
  2662 #define IGNORE_RANGE(a, b)
       
  2663 // Only materialize src code for contraint checking when required, ignore otherwise
       
  2664 #define IGNORE_CONSTRAINT(func,type)
       
  2665 
       
  2666 #define IGNORE_WRITEABLE(type)
       
  2667 
       
  2668 VM_FLAGS(DECLARE_DEVELOPER_FLAG, \
       
  2669          DECLARE_PD_DEVELOPER_FLAG, \
       
  2670          DECLARE_PRODUCT_FLAG, \
       
  2671          DECLARE_PD_PRODUCT_FLAG, \
       
  2672          DECLARE_DIAGNOSTIC_FLAG, \
       
  2673          DECLARE_PD_DIAGNOSTIC_FLAG, \
       
  2674          DECLARE_EXPERIMENTAL_FLAG, \
       
  2675          DECLARE_NOTPRODUCT_FLAG, \
       
  2676          DECLARE_MANAGEABLE_FLAG, \
       
  2677          DECLARE_PRODUCT_RW_FLAG, \
       
  2678          DECLARE_LP64_PRODUCT_FLAG, \
       
  2679          IGNORE_RANGE, \
       
  2680          IGNORE_CONSTRAINT, \
       
  2681          IGNORE_WRITEABLE)
       
  2682 
       
  2683 RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, \
       
  2684                  DECLARE_PD_DEVELOPER_FLAG, \
       
  2685                  DECLARE_PRODUCT_FLAG, \
       
  2686                  DECLARE_PD_PRODUCT_FLAG, \
       
  2687                  DECLARE_DIAGNOSTIC_FLAG, \
       
  2688                  DECLARE_PD_DIAGNOSTIC_FLAG, \
       
  2689                  DECLARE_NOTPRODUCT_FLAG, \
       
  2690                  IGNORE_RANGE, \
       
  2691                  IGNORE_CONSTRAINT, \
       
  2692                  IGNORE_WRITEABLE)
       
  2693 
       
  2694 ARCH_FLAGS(DECLARE_DEVELOPER_FLAG, \
       
  2695            DECLARE_PRODUCT_FLAG, \
       
  2696            DECLARE_DIAGNOSTIC_FLAG, \
       
  2697            DECLARE_EXPERIMENTAL_FLAG, \
       
  2698            DECLARE_NOTPRODUCT_FLAG, \
       
  2699            IGNORE_RANGE, \
       
  2700            IGNORE_CONSTRAINT, \
       
  2701            IGNORE_WRITEABLE)
       
  2702 
  2507 
  2703 // Extensions
  2508 // Extensions
  2704 
  2509 
  2705 #include "runtime/globals_ext.hpp"
  2510 #include "runtime/globals_ext.hpp"
  2706 
  2511