hotspot/src/share/vm/runtime/arguments.cpp
changeset 33230 23bb11a5cf4e
parent 33198 b37ad9fbf681
parent 33227 b00ec45f8c2c
child 33632 038347770a9e
child 33587 c04a7462b0e6
child 33589 7cbd1b2c139b
child 33976 160793725e6f
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Mon Oct 19 12:30:17 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Oct 20 11:17:19 2015 -0400
@@ -2436,20 +2436,6 @@
     MarkSweepAlwaysCompactCount = 1;  // Move objects every gc.
   }
 
-  if (UseParallelOldGC && ParallelOldGCSplitALot) {
-    // Settings to encourage splitting.
-    if (!FLAG_IS_CMDLINE(NewRatio)) {
-      if (FLAG_SET_CMDLINE(uintx, NewRatio, 2) != Flag::SUCCESS) {
-        status = false;
-      }
-    }
-    if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) {
-      if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) {
-        status = false;
-      }
-    }
-  }
-
   if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) {
     FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false);
   }
@@ -3350,19 +3336,6 @@
         return JNI_EINVAL;
       }
 #endif
-    } else if (match_option(option, "-XX:MaxDirectMemorySize=", &tail)) {
-      julong max_direct_memory_size = 0;
-      ArgsRange errcode = parse_memory_size(tail, &max_direct_memory_size, 0);
-      if (errcode != arg_in_range) {
-        jio_fprintf(defaultStream::error_stream(),
-                    "Invalid maximum direct memory size: %s\n",
-                    option->optionString);
-        describe_range_error(errcode);
-        return JNI_EINVAL;
-      }
-      if (FLAG_SET_CMDLINE(size_t, MaxDirectMemorySize, max_direct_memory_size) != Flag::SUCCESS) {
-        return JNI_EINVAL;
-      }
 #if !INCLUDE_MANAGEMENT
     } else if (match_option(option, "-XX:+ManagementServer")) {
         jio_fprintf(defaultStream::error_stream(),
@@ -3990,16 +3963,8 @@
     return code;
   }
 
-  // Now set global settings from the vm_option file, giving an error if
-  // it has VMOptionsFile in it
-  code = match_special_option_and_act(vm_options_file_args->get(), flags_file,
-                                      NULL, NULL, NULL);
-  if (code != JNI_OK) {
-    return code;
-  }
-
   if (vm_options_file_args->get()->nOptions < 1) {
-    return 0;
+    return JNI_OK;
   }
 
   return args_out->insert(args, vm_options_file_args->get(),
@@ -4034,17 +3999,29 @@
         // The caller accepts -XX:VMOptionsFile
         if (*vm_options_file != NULL) {
           jio_fprintf(defaultStream::error_stream(),
-                      "Only one VM Options file is supported "
-                      "on the command line\n");
+                      "The VM Options file can only be specified once and "
+                      "only on the command line.\n");
           return JNI_EINVAL;
         }
 
         *vm_options_file = (char *) tail;
         vm_options_file_pos = index;  // save position of -XX:VMOptionsFile
-        if (*vm_options_file == NULL) {
-          jio_fprintf(defaultStream::error_stream(),
-                      "Cannot copy vm_options_file name.\n");
-          return JNI_ENOMEM;
+        // If there's a VMOptionsFile, parse that (also can set flags_file)
+        jint code = insert_vm_options_file(args, flags_file, vm_options_file,
+                                           vm_options_file_pos,
+                                           vm_options_file_args, args_out);
+        if (code != JNI_OK) {
+          return code;
+        }
+        if (args_out->is_set()) {
+          // The VMOptions file inserted some options so switch 'args'
+          // to the new set of options, and continue processing which
+          // preserves "last option wins" semantics.
+          args = args_out->get();
+          // The first option from the VMOptionsFile replaces the
+          // current option.  So we back track to process the
+          // replacement option.
+          index--;
         }
       } else {
         jio_fprintf(defaultStream::error_stream(),
@@ -4104,12 +4081,6 @@
     }
 #endif
   }
-
-  // If there's a VMOptionsFile, parse that (also can set flags_file)
-  if ((vm_options_file != NULL) && (*vm_options_file != NULL)) {
-    return insert_vm_options_file(args, flags_file, vm_options_file,
-                                  vm_options_file_pos, vm_options_file_args, args_out);
-  }
   return JNI_OK;
 }