< prev index next >

src/hotspot/share/gc/shared/gcArguments.cpp

Print this page




  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/shared/gcArguments.hpp"
  27 #include "gc/serial/serialArguments.hpp"
  28 #include "runtime/globals.hpp"
  29 #include "runtime/globals_extension.hpp"
  30 #include "runtime/java.hpp"
  31 #include "runtime/os.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 #if INCLUDE_ALL_GCS
  35 #include "gc/parallel/parallelArguments.hpp"
  36 #include "gc/cms/cmsArguments.hpp"
  37 #include "gc/g1/g1Arguments.hpp"
  38 #endif
  39 
  40 GCArguments* GCArguments::_instance = NULL;
  41 
  42 GCArguments* GCArguments::instance() {
  43   assert(is_initialized(), "Heap factory not yet created");
  44   return _instance;
  45 }
  46 
  47 bool GCArguments::is_initialized() {
  48   return _instance != NULL;
  49 }
  50 
  51 bool GCArguments::gc_selected() {
  52 #if INCLUDE_ALL_GCS
  53   return UseSerialGC || UseParallelGC || UseParallelOldGC || UseConcMarkSweepGC || UseG1GC;
  54 #else
  55   return UseSerialGC;
  56 #endif // INCLUDE_ALL_GCS
  57 }
  58 
  59 void GCArguments::select_gc() {
  60   if (!gc_selected()) {
  61     select_gc_ergonomically();
  62     if (!gc_selected()) {


  86   if (AssumeMP && !UseSerialGC) {
  87     if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
  88       warning("If the number of processors is expected to increase from one, then"
  89               " you should configure the number of parallel GC threads appropriately"
  90               " using -XX:ParallelGCThreads=N");
  91     }
  92   }
  93   if (MinHeapFreeRatio == 100) {
  94     // Keeping the heap 100% free is hard ;-) so limit it to 99%.
  95     FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
  96   }
  97 
  98   // If class unloading is disabled, also disable concurrent class unloading.
  99   if (!ClassUnloading) {
 100     FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
 101     FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
 102   }
 103 #endif // INCLUDE_ALL_GCS
 104 }
 105 
 106 jint GCArguments::create_instance() {
 107   assert(!is_initialized(), "GC arguments already initialized");
 108 
 109   select_gc();
 110 
 111 #if !INCLUDE_ALL_GCS
 112   if (UseParallelGC || UseParallelOldGC) {
 113     jio_fprintf(defaultStream::error_stream(), "UseParallelGC not supported in this VM.\n");
 114     return JNI_ERR;
 115   } else if (UseG1GC) {
 116     jio_fprintf(defaultStream::error_stream(), "UseG1GC not supported in this VM.\n");
 117     return JNI_ERR;
 118   } else if (UseConcMarkSweepGC) {
 119     jio_fprintf(defaultStream::error_stream(), "UseConcMarkSweepGC not supported in this VM.\n");
 120     return JNI_ERR;
 121 #else
 122   if (UseParallelGC || UseParallelOldGC) {
 123     _instance = new ParallelArguments();
 124   } else if (UseG1GC) {
 125     _instance = new G1Arguments();
 126   } else if (UseConcMarkSweepGC) {


  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/shared/gcArguments.hpp"
  27 #include "gc/serial/serialArguments.hpp"
  28 #include "runtime/globals.hpp"
  29 #include "runtime/globals_extension.hpp"
  30 #include "runtime/java.hpp"
  31 #include "runtime/os.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 #if INCLUDE_ALL_GCS
  35 #include "gc/parallel/parallelArguments.hpp"
  36 #include "gc/cms/cmsArguments.hpp"
  37 #include "gc/g1/g1Arguments.hpp"
  38 #endif
  39 
  40 GCArguments* GCArguments::_instance = NULL;
  41 
  42 GCArguments* GCArguments::arguments() {
  43   assert(is_initialized(), "Heap factory not yet created");
  44   return _instance;
  45 }
  46 
  47 bool GCArguments::is_initialized() {
  48   return _instance != NULL;
  49 }
  50 
  51 bool GCArguments::gc_selected() {
  52 #if INCLUDE_ALL_GCS
  53   return UseSerialGC || UseParallelGC || UseParallelOldGC || UseConcMarkSweepGC || UseG1GC;
  54 #else
  55   return UseSerialGC;
  56 #endif // INCLUDE_ALL_GCS
  57 }
  58 
  59 void GCArguments::select_gc() {
  60   if (!gc_selected()) {
  61     select_gc_ergonomically();
  62     if (!gc_selected()) {


  86   if (AssumeMP && !UseSerialGC) {
  87     if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
  88       warning("If the number of processors is expected to increase from one, then"
  89               " you should configure the number of parallel GC threads appropriately"
  90               " using -XX:ParallelGCThreads=N");
  91     }
  92   }
  93   if (MinHeapFreeRatio == 100) {
  94     // Keeping the heap 100% free is hard ;-) so limit it to 99%.
  95     FLAG_SET_ERGO(uintx, MinHeapFreeRatio, 99);
  96   }
  97 
  98   // If class unloading is disabled, also disable concurrent class unloading.
  99   if (!ClassUnloading) {
 100     FLAG_SET_CMDLINE(bool, CMSClassUnloadingEnabled, false);
 101     FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false);
 102   }
 103 #endif // INCLUDE_ALL_GCS
 104 }
 105 
 106 jint GCArguments::initialize() {
 107   assert(!is_initialized(), "GC arguments already initialized");
 108 
 109   select_gc();
 110 
 111 #if !INCLUDE_ALL_GCS
 112   if (UseParallelGC || UseParallelOldGC) {
 113     jio_fprintf(defaultStream::error_stream(), "UseParallelGC not supported in this VM.\n");
 114     return JNI_ERR;
 115   } else if (UseG1GC) {
 116     jio_fprintf(defaultStream::error_stream(), "UseG1GC not supported in this VM.\n");
 117     return JNI_ERR;
 118   } else if (UseConcMarkSweepGC) {
 119     jio_fprintf(defaultStream::error_stream(), "UseConcMarkSweepGC not supported in this VM.\n");
 120     return JNI_ERR;
 121 #else
 122   if (UseParallelGC || UseParallelOldGC) {
 123     _instance = new ParallelArguments();
 124   } else if (UseG1GC) {
 125     _instance = new G1Arguments();
 126   } else if (UseConcMarkSweepGC) {
< prev index next >