hotspot/src/share/vm/runtime/arguments.cpp
changeset 27926 0e2e188ab887
parent 27711 0b952ebd3953
parent 27905 12c6386f6775
child 28034 f46051dc7d51
child 29181 89beae49867c
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 20:10:08 2017 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Fri Dec 05 16:36:07 2014 -0800
@@ -417,7 +417,7 @@
 inline void SysClassPath::reset_item_at(int index) {
   assert(index < _scp_nitems && index != _scp_base, "just checking");
   if (_items[index] != NULL) {
-    FREE_C_HEAP_ARRAY(char, _items[index], mtInternal);
+    FREE_C_HEAP_ARRAY(char, _items[index]);
     _items[index] = NULL;
   }
 }
@@ -490,7 +490,7 @@
       cp_tmp += str_len;
       *cp_tmp = separator;
       memcpy(++cp_tmp, path, old_len + 1);      // copy the trailing null
-      FREE_C_HEAP_ARRAY(char, path, mtInternal);
+      FREE_C_HEAP_ARRAY(char, path);
     } else {
       cp = REALLOC_C_HEAP_ARRAY(char, path, len, mtInternal);
       char* cp_tmp = cp + old_len;
@@ -525,10 +525,10 @@
       char* jarpath = NEW_C_HEAP_ARRAY(char, directory_len + 2 + strlen(name), mtInternal);
       sprintf(jarpath, "%s%s%s", directory, dir_sep, name);
       path = add_to_path(path, jarpath, false);
-      FREE_C_HEAP_ARRAY(char, jarpath, mtInternal);
+      FREE_C_HEAP_ARRAY(char, jarpath);
     }
   }
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
   os::closedir(dir);
   return path;
 }
@@ -663,7 +663,7 @@
 static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
   if (!CommandLineFlags::ccstrAtPut(name, &value, origin))  return false;
   // Contract:  CommandLineFlags always returns a pointer that needs freeing.
-  FREE_C_HEAP_ARRAY(char, value, mtInternal);
+  FREE_C_HEAP_ARRAY(char, value);
   return true;
 }
 
@@ -687,10 +687,10 @@
   }
   (void) CommandLineFlags::ccstrAtPut(name, &value, origin);
   // CommandLineFlags always returns a pointer that needs freeing.
-  FREE_C_HEAP_ARRAY(char, value, mtInternal);
+  FREE_C_HEAP_ARRAY(char, value);
   if (free_this_too != NULL) {
     // CommandLineFlags made its own copy, so I must delete my own temp. buffer.
-    FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal);
+    FREE_C_HEAP_ARRAY(char, free_this_too);
   }
   return true;
 }
@@ -1222,10 +1222,8 @@
 void Arguments::set_parnew_gc_flags() {
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
          "control point invariant");
-  assert(UseParNewGC, "Error");
-
-  // Turn off AdaptiveSizePolicy for parnew until it is complete.
-  disable_adaptive_size_policy("UseParNewGC");
+  assert(UseConcMarkSweepGC, "CMS is expected to be on here");
+  assert(UseParNewGC, "ParNew should always be used with CMS");
 
   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
     FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
@@ -1266,21 +1264,12 @@
 void Arguments::set_cms_and_parnew_gc_flags() {
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
-
-  // If we are using CMS, we prefer to UseParNewGC,
-  // unless explicitly forbidden.
-  if (FLAG_IS_DEFAULT(UseParNewGC)) {
-    FLAG_SET_ERGO(bool, UseParNewGC, true);
-  }
+  assert(UseParNewGC, "ParNew should always be used with CMS");
 
   // Turn off AdaptiveSizePolicy by default for cms until it is complete.
   disable_adaptive_size_policy("UseConcMarkSweepGC");
 
-  // In either case, adjust ParallelGCThreads and/or UseParNewGC
-  // as needed.
-  if (UseParNewGC) {
-    set_parnew_gc_flags();
-  }
+  set_parnew_gc_flags();
 
   size_t max_heap = align_size_down(MaxHeapSize,
                                     CardTableRS::ct_max_alignment_constraint());
@@ -1750,14 +1739,11 @@
   // Set per-collector flags
   if (UseParallelGC || UseParallelOldGC) {
     set_parallel_gc_flags();
-  } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
+  } else if (UseConcMarkSweepGC) {
     set_cms_and_parnew_gc_flags();
-  } else if (UseParNewGC) {  // Skipped if CMS is set above
-    set_parnew_gc_flags();
   } else if (UseG1GC) {
     set_g1_gc_flags();
   }
-  check_deprecated_gcs();
   check_deprecated_gc_flags();
   if (AssumeMP && !UseSerialGC) {
     if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
@@ -2118,17 +2104,11 @@
 // Check consistency of GC selection
 bool Arguments::check_gc_consistency_user() {
   check_gclog_consistency();
-  bool status = true;
   // Ensure that the user has not selected conflicting sets
-  // of collectors. [Note: this check is merely a user convenience;
-  // collectors over-ride each other so that only a non-conflicting
-  // set is selected; however what the user gets is not what they
-  // may have expected from the combination they asked for. It's
-  // better to reduce user confusion by not allowing them to
-  // select conflicting combinations.
+  // of collectors.
   uint i = 0;
   if (UseSerialGC)                       i++;
-  if (UseConcMarkSweepGC || UseParNewGC) i++;
+  if (UseConcMarkSweepGC)                i++;
   if (UseParallelGC || UseParallelOldGC) i++;
   if (UseG1GC)                           i++;
   if (i > 1) {
@@ -2136,26 +2116,30 @@
                 "Conflicting collector combinations in option list; "
                 "please refer to the release notes for the combinations "
                 "allowed\n");
-    status = false;
+    return false;
   }
-  return status;
-}
-
-void Arguments::check_deprecated_gcs() {
+
   if (UseConcMarkSweepGC && !UseParNewGC) {
-    warning("Using the DefNew young collector with the CMS collector is deprecated "
-        "and will likely be removed in a future release");
+    jio_fprintf(defaultStream::error_stream(),
+        "It is not possible to combine the DefNew young collector with the CMS collector.\n");
+    return false;
   }
 
   if (UseParNewGC && !UseConcMarkSweepGC) {
     // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
     // set up UseSerialGC properly, so that can't be used in the check here.
-    warning("Using the ParNew young collector with the Serial old collector is deprecated "
-        "and will likely be removed in a future release");
+    jio_fprintf(defaultStream::error_stream(),
+        "It is not possible to combine the ParNew young collector with the Serial old collector.\n");
+    return false;
   }
+
+  return true;
 }
 
 void Arguments::check_deprecated_gc_flags() {
+  if (FLAG_IS_CMDLINE(UseParNewGC)) {
+    warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
+  }
   if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
     warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
             "and will likely be removed in future release");
@@ -2262,7 +2246,7 @@
     FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
   }
 
-  status = status && ArgumentsExt::check_gc_consistency_user();
+  status = status && check_gc_consistency_user();
   status = status && check_stack_pages();
 
   status = status && verify_percentage(CMSIncrementalSafetyFactor,
@@ -3473,7 +3457,7 @@
     const char* ext = name + strlen(name) - 4;
     hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
   }
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
   os::closedir(dir);
   return hasJarFile ;
 }
@@ -3500,7 +3484,7 @@
         jio_fprintf(defaultStream::output_stream(),
           "Non-empty directory: %s\n", dirpath);
       }
-      FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
+      FREE_C_HEAP_ARRAY(char, dirpath);
       path = tmp_end + 1;
     }
   }
@@ -3610,7 +3594,12 @@
     }
   }
 
-  if (!ArgumentsExt::check_vm_args_consistency()) {
+  if (UseConcMarkSweepGC && FLAG_IS_DEFAULT(UseParNewGC) && !UseParNewGC) {
+    // CMS can only be used with ParNew
+    FLAG_SET_ERGO(bool, UseParNewGC, true);
+  }
+
+  if (!check_vm_args_consistency()) {
     return JNI_ERR;
   }
 
@@ -4008,7 +3997,7 @@
   // Set heap size based on available physical memory
   set_heap_size();
 
-  set_gc_specific_flags();
+  ArgumentsExt::set_gc_specific_flags();
 
   // Initialize Metaspace flags and alignments
   Metaspace::ergo_initialize();