hotspot/src/share/vm/runtime/arguments.cpp
changeset 15484 7395ace8a11a
parent 15463 8693f5fb0828
parent 15483 113ca9e9c1bb
child 15613 7c250aa645c5
child 15611 c288dd5b9130
child 15758 619e0eebeb86
child 15920 b6a92b294176
equal deleted inserted replaced
15470:998186997e90 15484:7395ace8a11a
    36 #include "runtime/globals_extension.hpp"
    36 #include "runtime/globals_extension.hpp"
    37 #include "runtime/java.hpp"
    37 #include "runtime/java.hpp"
    38 #include "services/management.hpp"
    38 #include "services/management.hpp"
    39 #include "services/memTracker.hpp"
    39 #include "services/memTracker.hpp"
    40 #include "utilities/defaultStream.hpp"
    40 #include "utilities/defaultStream.hpp"
       
    41 #include "utilities/macros.hpp"
    41 #include "utilities/taskqueue.hpp"
    42 #include "utilities/taskqueue.hpp"
    42 #ifdef TARGET_OS_FAMILY_linux
    43 #ifdef TARGET_OS_FAMILY_linux
    43 # include "os_linux.inline.hpp"
    44 # include "os_linux.inline.hpp"
    44 #endif
    45 #endif
    45 #ifdef TARGET_OS_FAMILY_solaris
    46 #ifdef TARGET_OS_FAMILY_solaris
    49 # include "os_windows.inline.hpp"
    50 # include "os_windows.inline.hpp"
    50 #endif
    51 #endif
    51 #ifdef TARGET_OS_FAMILY_bsd
    52 #ifdef TARGET_OS_FAMILY_bsd
    52 # include "os_bsd.inline.hpp"
    53 # include "os_bsd.inline.hpp"
    53 #endif
    54 #endif
    54 #ifndef SERIALGC
    55 #if INCLUDE_ALL_GCS
    55 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
    56 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
    56 #endif
    57 #endif // INCLUDE_ALL_GCS
    57 
    58 
    58 // Note: This is a special bug reporting site for the JVM
    59 // Note: This is a special bug reporting site for the JVM
    59 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp"
    60 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp"
    60 #define DEFAULT_JAVA_LAUNCHER  "generic"
    61 #define DEFAULT_JAVA_LAUNCHER  "generic"
    61 
    62 
  1087   if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
  1088   if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
  1088     FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2);
  1089     FLAG_SET_DEFAULT(ReservedCodeCacheSize, ReservedCodeCacheSize * 2);
  1089   }
  1090   }
  1090 }
  1091 }
  1091 
  1092 
  1092 #if INCLUDE_ALTERNATE_GCS
  1093 #if INCLUDE_ALL_GCS
  1093 static void disable_adaptive_size_policy(const char* collector_name) {
  1094 static void disable_adaptive_size_policy(const char* collector_name) {
  1094   if (UseAdaptiveSizePolicy) {
  1095   if (UseAdaptiveSizePolicy) {
  1095     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
  1096     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
  1096       warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
  1097       warning("disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
  1097               collector_name);
  1098               collector_name);
  1299     tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
  1300     tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
  1300       MarkStackSize / K, MarkStackSizeMax / K);
  1301       MarkStackSize / K, MarkStackSizeMax / K);
  1301     tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
  1302     tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
  1302   }
  1303   }
  1303 }
  1304 }
  1304 #endif // INCLUDE_ALTERNATE_GCS
  1305 #endif // INCLUDE_ALL_GCS
  1305 
  1306 
  1306 void set_object_alignment() {
  1307 void set_object_alignment() {
  1307   // Object alignment.
  1308   // Object alignment.
  1308   assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
  1309   assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2");
  1309   MinObjAlignmentInBytes     = ObjectAlignmentInBytes;
  1310   MinObjAlignmentInBytes     = ObjectAlignmentInBytes;
  1316   LogMinObjAlignment         = LogMinObjAlignmentInBytes - LogHeapWordSize;
  1317   LogMinObjAlignment         = LogMinObjAlignmentInBytes - LogHeapWordSize;
  1317 
  1318 
  1318   // Oop encoding heap max
  1319   // Oop encoding heap max
  1319   OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
  1320   OopEncodingHeapMax = (uint64_t(max_juint) + 1) << LogMinObjAlignmentInBytes;
  1320 
  1321 
  1321 #if INCLUDE_ALTERNATE_GCS
  1322 #if INCLUDE_ALL_GCS
  1322   // Set CMS global values
  1323   // Set CMS global values
  1323   CompactibleFreeListSpace::set_cms_values();
  1324   CompactibleFreeListSpace::set_cms_values();
  1324 #endif // INCLUDE_ALTERNATE_GCS
  1325 #endif // INCLUDE_ALL_GCS
  1325 }
  1326 }
  1326 
  1327 
  1327 bool verify_object_alignment() {
  1328 bool verify_object_alignment() {
  1328   // Object alignment.
  1329   // Object alignment.
  1329   if (!is_power_of_2(ObjectAlignmentInBytes)) {
  1330   if (!is_power_of_2(ObjectAlignmentInBytes)) {
  1996     status = false;
  1997     status = false;
  1997   }
  1998   }
  1998 
  1999 
  1999   status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
  2000   status = status && verify_min_value(ParGCArrayScanChunk, 1, "ParGCArrayScanChunk");
  2000 
  2001 
  2001 #ifndef SERIALGC
  2002 #if INCLUDE_ALL_GCS
  2002   if (UseG1GC) {
  2003   if (UseG1GC) {
  2003     status = status && verify_percentage(InitiatingHeapOccupancyPercent,
  2004     status = status && verify_percentage(InitiatingHeapOccupancyPercent,
  2004                                          "InitiatingHeapOccupancyPercent");
  2005                                          "InitiatingHeapOccupancyPercent");
  2005     status = status && verify_min_value(G1RefProcDrainInterval, 1,
  2006     status = status && verify_min_value(G1RefProcDrainInterval, 1,
  2006                                         "G1RefProcDrainInterval");
  2007                                         "G1RefProcDrainInterval");
  2007     status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1,
  2008     status = status && verify_min_value((intx)G1ConcMarkStepDurationMillis, 1,
  2008                                         "G1ConcMarkStepDurationMillis");
  2009                                         "G1ConcMarkStepDurationMillis");
  2009   }
  2010   }
  2010 #endif
  2011 #endif // INCLUDE_ALL_GCS
  2011 
  2012 
  2012   status = status && verify_interval(RefDiscoveryPolicy,
  2013   status = status && verify_interval(RefDiscoveryPolicy,
  2013                                      ReferenceProcessor::DiscoveryPolicyMin,
  2014                                      ReferenceProcessor::DiscoveryPolicyMin,
  2014                                      ReferenceProcessor::DiscoveryPolicyMax,
  2015                                      ReferenceProcessor::DiscoveryPolicyMax,
  2015                                      "RefDiscoveryPolicy");
  2016                                      "RefDiscoveryPolicy");
  3174 
  3175 
  3175 #ifdef _ALLBSD_SOURCE  // UseLargePages is not yet supported on BSD.
  3176 #ifdef _ALLBSD_SOURCE  // UseLargePages is not yet supported on BSD.
  3176   UNSUPPORTED_OPTION(UseLargePages, "-XX:+UseLargePages");
  3177   UNSUPPORTED_OPTION(UseLargePages, "-XX:+UseLargePages");
  3177 #endif
  3178 #endif
  3178 
  3179 
  3179 #if !INCLUDE_ALTERNATE_GCS
  3180 #if !INCLUDE_ALL_GCS
  3180   if (UseParallelGC) {
  3181   if (UseParallelGC) {
  3181     warning("Parallel GC is not supported in this VM.  Using Serial GC.");
  3182     warning("Parallel GC is not supported in this VM.  Using Serial GC.");
  3182   }
  3183   }
  3183   if (UseParallelOldGC) {
  3184   if (UseParallelOldGC) {
  3184     warning("Parallel Old GC is not supported in this VM.  Using Serial GC.");
  3185     warning("Parallel Old GC is not supported in this VM.  Using Serial GC.");
  3187     warning("Concurrent Mark Sweep GC is not supported in this VM.  Using Serial GC.");
  3188     warning("Concurrent Mark Sweep GC is not supported in this VM.  Using Serial GC.");
  3188   }
  3189   }
  3189   if (UseParNewGC) {
  3190   if (UseParNewGC) {
  3190     warning("Par New GC is not supported in this VM.  Using Serial GC.");
  3191     warning("Par New GC is not supported in this VM.  Using Serial GC.");
  3191   }
  3192   }
  3192 #endif // INCLUDE_ALTERNATE_GCS
  3193 #endif // INCLUDE_ALL_GCS
  3193 
  3194 
  3194 #ifndef PRODUCT
  3195 #ifndef PRODUCT
  3195   if (TraceBytecodesAt != 0) {
  3196   if (TraceBytecodesAt != 0) {
  3196     TraceBytecodes = true;
  3197     TraceBytecodes = true;
  3197   }
  3198   }
  3234   }
  3235   }
  3235 
  3236 
  3236   // Set object alignment values.
  3237   // Set object alignment values.
  3237   set_object_alignment();
  3238   set_object_alignment();
  3238 
  3239 
  3239 #ifdef SERIALGC
  3240 #if !INCLUDE_ALL_GCS
  3240   force_serial_gc();
  3241   force_serial_gc();
  3241 #endif // SERIALGC
  3242 #endif // INCLUDE_ALL_GCS
  3242 #if !INCLUDE_CDS
  3243 #if !INCLUDE_CDS
  3243   no_shared_spaces();
  3244   no_shared_spaces();
  3244 #endif // INCLUDE_CDS
  3245 #endif // INCLUDE_CDS
  3245 
  3246 
  3246   // Set flags based on ergonomics.
  3247   // Set flags based on ergonomics.
  3264   }
  3265   }
  3265 
  3266 
  3266   // Set heap size based on available physical memory
  3267   // Set heap size based on available physical memory
  3267   set_heap_size();
  3268   set_heap_size();
  3268 
  3269 
  3269 #if INCLUDE_ALTERNATE_GCS
  3270 #if INCLUDE_ALL_GCS
  3270   // Set per-collector flags
  3271   // Set per-collector flags
  3271   if (UseParallelGC || UseParallelOldGC) {
  3272   if (UseParallelGC || UseParallelOldGC) {
  3272     set_parallel_gc_flags();
  3273     set_parallel_gc_flags();
  3273   } else if (UseConcMarkSweepGC) { // should be done before ParNew check below
  3274   } else if (UseConcMarkSweepGC) { // should be done before ParNew check below
  3274     set_cms_and_parnew_gc_flags();
  3275     set_cms_and_parnew_gc_flags();
  3276     set_parnew_gc_flags();
  3277     set_parnew_gc_flags();
  3277   } else if (UseG1GC) {
  3278   } else if (UseG1GC) {
  3278     set_g1_gc_flags();
  3279     set_g1_gc_flags();
  3279   }
  3280   }
  3280   check_deprecated_gcs();
  3281   check_deprecated_gcs();
  3281 #endif // INCLUDE_ALTERNATE_GCS
  3282 #else // INCLUDE_ALL_GCS
  3282 
       
  3283 #ifdef SERIALGC
       
  3284   assert(verify_serial_gc_flags(), "SerialGC unset");
  3283   assert(verify_serial_gc_flags(), "SerialGC unset");
  3285 #endif // SERIALGC
  3284 #endif // INCLUDE_ALL_GCS
  3286 
  3285 
  3287   // Set bytecode rewriting flags
  3286   // Set bytecode rewriting flags
  3288   set_bytecode_flags();
  3287   set_bytecode_flags();
  3289 
  3288 
  3290   // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled.
  3289   // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled.
  3374 
  3373 
  3375   return JNI_OK;
  3374   return JNI_OK;
  3376 }
  3375 }
  3377 
  3376 
  3378 jint Arguments::adjust_after_os() {
  3377 jint Arguments::adjust_after_os() {
  3379 #if INCLUDE_ALTERNATE_GCS
  3378 #if INCLUDE_ALL_GCS
  3380   if (UseParallelGC || UseParallelOldGC) {
  3379   if (UseParallelGC || UseParallelOldGC) {
  3381     if (UseNUMA) {
  3380     if (UseNUMA) {
  3382       if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
  3381       if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
  3383         FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
  3382         FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
  3384       }
  3383       }
  3385       // For those collectors or operating systems (eg, Windows) that do
  3384       // For those collectors or operating systems (eg, Windows) that do
  3386       // not support full UseNUMA, we will map to UseNUMAInterleaving for now
  3385       // not support full UseNUMA, we will map to UseNUMAInterleaving for now
  3387       UseNUMAInterleaving = true;
  3386       UseNUMAInterleaving = true;
  3388     }
  3387     }
  3389   }
  3388   }
  3390 #endif
  3389 #endif // INCLUDE_ALL_GCS
  3391   return JNI_OK;
  3390   return JNI_OK;
  3392 }
  3391 }
  3393 
  3392 
  3394 int Arguments::PropertyList_count(SystemProperty* pl) {
  3393 int Arguments::PropertyList_count(SystemProperty* pl) {
  3395   int count = 0;
  3394   int count = 0;