8171011: convert some CDS dump time warning and error messages to informational messages which will be printed with -XX:+PrintSharedSpaces
authorccheung
Tue, 20 Dec 2016 11:50:40 -0800
changeset 42899 b9ae8968fce6
parent 42898 af1346a135ce
child 42902 380b1219139f
8171011: convert some CDS dump time warning and error messages to informational messages which will be printed with -XX:+PrintSharedSpaces Summary: print informational message if a module related options is used during dumping except for the -m option Reviewed-by: iklam, jiangli, mseledtsov
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Dec 20 17:35:20 2016 +0300
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Dec 20 11:50:40 2016 -0800
@@ -1327,26 +1327,29 @@
                                            "jdk.module.addmods.0",
                                            "jdk.module.patch.0" };
   const char* unsupported_options[] = { "-m", // cannot use at dump time
-                                        "--limit-modules", // cannot use at dump time
+                                        "--limit-modules", // ignored at dump time
                                         "--module-path", // ignored at dump time
                                         "--upgrade-module-path", // ignored at dump time
                                         "--add-modules", // ignored at dump time
                                         "--patch-module" // ignored at dump time
                                       };
   assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
-  // If a vm option is found in the unsupported_options array with index less than the warning_idx,
-  // vm will exit with an error message. Otherwise, it will result in a warning message.
-  uint warning_idx = 2;
+  // If a vm option is found in the unsupported_options array with index less than the info_idx,
+  // vm will exit with an error message. Otherwise, it will print an informational message if
+  // PrintSharedSpaces is enabled.
+  uint info_idx = 1;
   SystemProperty* sp = system_properties();
   while (sp != NULL) {
     for (uint i = 0; i < ARRAY_SIZE(unsupported_properties); i++) {
       if (strcmp(sp->key(), unsupported_properties[i]) == 0) {
-        if (i < warning_idx) {
+        if (i < info_idx) {
           vm_exit_during_initialization(
             "Cannot use the following option when dumping the shared archive", unsupported_options[i]);
         } else {
-          warning(
-            "the %s option is ignored when dumping the shared archive", unsupported_options[i]);
+          if (PrintSharedSpaces) {
+            tty->print_cr(
+              "Info: the %s option is ignored when dumping the shared archive", unsupported_options[i]);
+          }
         }
       }
     }