--- a/hotspot/src/share/vm/runtime/arguments.cpp Wed Oct 22 16:40:43 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Oct 23 17:36:30 2014 +0200
@@ -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 Wed Oct 22 16:40:43 2014 +0200
+++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp Thu Oct 23 17:36:30 2014 +0200
@@ -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 Thu Oct 23 17:36:30 2014 +0200
@@ -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 Thu Oct 23 17:36:30 2014 +0200
@@ -0,0 +1,1 @@
++PrintVMOptions -IgnoreUnrecognizedVMOptions