Merge
authordcubed
Sat, 18 Oct 2014 11:37:11 -0700
changeset 27246 49642d463211
parent 27171 5ee40c966315 (current diff)
parent 27245 6d08a994e466 (diff)
child 27253 9868a71b0cfd
child 27400 c5955f4b7c84
child 27438 6777f21bb53f
Merge
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Oct 17 07:58:54 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Sat Oct 18 11:37:11 2014 -0700
@@ -3782,27 +3782,33 @@
   bool settings_file_specified = false;
   bool needs_hotspotrc_warning = false;
 
-  ArgumentsExt::process_options(args);
-
   const char* flags_file;
   int index;
   for (index = 0; index < args->nOptions; index++) {
     const JavaVMOption *option = args->options + index;
+    if (ArgumentsExt::process_options(option)) {
+      continue;
+    }
     if (match_option(option, "-XX:Flags=", &tail)) {
       flags_file = tail;
       settings_file_specified = true;
+      continue;
     }
     if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
       PrintVMOptions = true;
+      continue;
     }
     if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
       PrintVMOptions = false;
+      continue;
     }
     if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) {
       IgnoreUnrecognizedVMOptions = true;
+      continue;
     }
     if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) {
       IgnoreUnrecognizedVMOptions = false;
+      continue;
     }
     if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) {
       CommandLineFlags::printFlags(tty, false);
@@ -3824,6 +3830,7 @@
       } else {
         vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
       }
+      continue;
     }
 #endif
 
--- a/hotspot/src/share/vm/runtime/arguments_ext.hpp	Fri Oct 17 07:58:54 2014 -0700
+++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp	Sat Oct 18 11:37:11 2014 -0700
@@ -34,7 +34,10 @@
   static inline bool check_gc_consistency_user();
   static inline bool check_gc_consistency_ergo();
   static inline bool check_vm_args_consistency();
-  static        void process_options(const JavaVMInitArgs* args) {}
+  // The argument processing extension. Returns true if there is
+  // no additional parsing needed in Arguments::parse() for the option.
+  // Otherwise returns false.
+  static inline bool process_options(const JavaVMOption *option) { return false; }
 };
 
 void ArgumentsExt::select_gc_ergonomically() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/TestVMOptions.java	Sat Oct 18 11:37:11 2014 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8060256
+ * @summary Test various command line options
+ * @library /testlibrary
+ * @run main TestVMOptions
+ */
+
+import com.oracle.java.testlibrary.*;
+import java.io.File;
+
+public class TestVMOptions {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:bogus",
+        "-XX:+IgnoreUnrecognizedVMOptions",
+        "-XX:+PrintFlagsInitial");
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("bool PrintGCDetails");
+
+    pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:-PrintVMOptions", "-version");
+    output = new OutputAnalyzer(pb.start());
+    output.shouldContain("java version");
+
+    File dir = new File(System.getProperty("test.src", "."));
+    File file = new File(dir, "flagfile.txt");
+    String s = file.getAbsolutePath();
+    pb = ProcessTools.createJavaProcessBuilder("-XX:Flags="+s);
+    output = new OutputAnalyzer(pb.start());
+    output.shouldContain("VM option '-IgnoreUnrecognizedVMOptions'");
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/flagfile.txt	Sat Oct 18 11:37:11 2014 -0700
@@ -0,0 +1,1 @@
++PrintVMOptions -IgnoreUnrecognizedVMOptions