From b1f4c8ba650169e09e8df0b0160fbf65269ef257 Mon Sep 17 00:00:00 2001 From: kvn Date: Thu, 7 Jan 2010 16:24:17 -0800 Subject: [PATCH] 6914622: Print values of all flags for product VM Summary: Change the flag -XX:+PrintFlagsFinal to product and add new product flag -XX:+PrintFlagsInitial. Reviewed-by: phh, ysr Contributed-by: gbenson@redhat.com --- src/share/vm/runtime/arguments.cpp | 6 ++++-- src/share/vm/runtime/globals.cpp | 4 ++-- src/share/vm/runtime/globals.hpp | 19 +++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp index f0615f0e1..fc58a5363 100644 --- a/src/share/vm/runtime/arguments.cpp +++ b/src/share/vm/runtime/arguments.cpp @@ -2633,6 +2633,10 @@ jint Arguments::parse(const JavaVMInitArgs* args) { if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) { IgnoreUnrecognizedVMOptions = false; } + if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) { + CommandLineFlags::printFlags(); + vm_exit(0); + } } if (IgnoreUnrecognizedVMOptions) { @@ -2795,11 +2799,9 @@ jint Arguments::parse(const JavaVMInitArgs* args) { CommandLineFlags::printSetFlags(); } -#ifdef ASSERT if (PrintFlagsFinal) { CommandLineFlags::printFlags(); } -#endif return JNI_OK; } diff --git a/src/share/vm/runtime/globals.cpp b/src/share/vm/runtime/globals.cpp index 03e068dea..32a43d6e2 100644 --- a/src/share/vm/runtime/globals.cpp +++ b/src/share/vm/runtime/globals.cpp @@ -468,6 +468,8 @@ void CommandLineFlags::verify() { assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict"); } +#endif // PRODUCT + void CommandLineFlags::printFlags() { // Print the flags sorted by name // note: this method is called before the thread structure is in place @@ -493,5 +495,3 @@ void CommandLineFlags::printFlags() { } FREE_C_HEAP_ARRAY(Flag*, array); } - -#endif diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp index 62dceadc2..b733da77d 100644 --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -211,7 +211,7 @@ class CommandLineFlags { static bool wasSetOnCmdline(const char* name, bool* value); static void printSetFlags(); - static void printFlags() PRODUCT_RETURN; + static void printFlags(); static void verify() PRODUCT_RETURN; }; @@ -327,9 +327,6 @@ class CommandLineFlags { product(bool, UseMembar, false, \ "(Unstable) Issues membars on thread state transitions") \ \ - product(bool, PrintCommandLineFlags, false, \ - "Prints flags that appeared on the command line") \ - \ diagnostic(bool, UnlockDiagnosticVMOptions, trueInDebug, \ "Enable normal processing of flags relating to field diagnostics")\ \ @@ -1967,9 +1964,6 @@ class CommandLineFlags { "number of times a GC thread (minus the coordinator) " \ "will sleep while yielding before giving up and resuming GC") \ \ - notproduct(bool, PrintFlagsFinal, false, \ - "Print all command line flags after argument processing") \ - \ /* gc tracing */ \ manageable(bool, PrintGC, false, \ "Print message at garbage collect") \ @@ -2269,11 +2263,20 @@ class CommandLineFlags { "If false, restricts profiled locations to the root method only") \ \ product(bool, PrintVMOptions, trueInDebug, \ - "print VM flag settings") \ + "Print flags that appeared on the command line") \ \ product(bool, IgnoreUnrecognizedVMOptions, false, \ "Ignore unrecognized VM options") \ \ + product(bool, PrintCommandLineFlags, false, \ + "Print flags specified on command line or set by ergonomics") \ + \ + product(bool, PrintFlagsInitial, false, \ + "Print all VM flags before argument processing and exit VM") \ + \ + product(bool, PrintFlagsFinal, false, \ + "Print all VM flags after argument and ergonomic processing") \ + \ diagnostic(bool, SerializeVMOutput, true, \ "Use a mutex to serialize output to tty and hotspot.log") \ \ -- GitLab