changeset 23787:fcffda51e6fe

-XX:+JVMCIPrintProperties should exit after printing (JDK-8168295)
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Oct 2016 20:22:48 +0200
parents 643e6e4dcb01
children e804aec381cd
files jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java src/share/vm/jvmci/jvmci_globals.hpp
diffstat 2 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Oct 18 14:30:55 2016 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Wed Oct 19 20:22:48 2016 +0200
@@ -171,6 +171,9 @@
             return (String) getValue();
         }
 
+        private static final int PROPERTY_LINE_WIDTH = 80;
+        private static final int PROPERTY_HELP_INDENT = 10;
+
         /**
          * Prints a description of the properties used to configure shared JVMCI code.
          *
@@ -178,24 +181,26 @@
          */
         public static void printProperties(PrintStream out) {
             out.println("[JVMCI properties]");
-            int typeWidth = 0;
-            int nameWidth = 0;
             Option[] values = values();
             for (Option option : values) {
-                typeWidth = Math.max(typeWidth, option.type.getSimpleName().length());
-                nameWidth = Math.max(nameWidth, option.getPropertyName().length());
-            }
-            for (Option option : values) {
                 Object value = option.getValue();
                 if (value instanceof String) {
                     value = '"' + String.valueOf(value) + '"';
                 }
-                String assign = option.isDefault ? " =" : ":=";
-                String format = "%" + (typeWidth + 1) + "s %-" + (nameWidth + 1) + "s %s %s%n";
-                out.printf(format, option.type.getSimpleName(), option.getPropertyName(), assign, value);
-                String helpFormat = "%" + (typeWidth + 1) + "s %s%n";
+
+                String name = option.getPropertyName();
+                String assign = option.isDefault ? "=" : ":=";
+                String typeName = option.type.getSimpleName();
+                String linePrefix = String.format("%s %s %s ", name, assign, value);
+                int typeStartPos = PROPERTY_LINE_WIDTH - typeName.length();
+                int linePad = typeStartPos - linePrefix.length();
+                if (linePad > 0) {
+                    out.printf("%s%-" + linePad + "s[%s]%n", linePrefix, "", typeName);
+                } else {
+                    out.printf("%s[%s]%n", linePrefix, typeName);
+                }
                 for (String line : option.helpLines) {
-                    out.printf(helpFormat, "", line);
+                    out.printf("%" + PROPERTY_HELP_INDENT + "s%s%n", "", line);
                 }
             }
         }
@@ -306,6 +311,7 @@
             PrintStream out = new PrintStream(getLogStream());
             Option.printProperties(out);
             compilerFactory.printProperties(out);
+            System.exit(0);
         }
 
         if (Option.PrintConfig.getBoolean()) {
--- a/src/share/vm/jvmci/jvmci_globals.hpp	Tue Oct 18 14:30:55 2016 +0200
+++ b/src/share/vm/jvmci/jvmci_globals.hpp	Wed Oct 19 20:22:48 2016 +0200
@@ -53,7 +53,7 @@
           "Use JVMCI as the default compiler")                              \
                                                                             \
   product(bool, JVMCIPrintProperties, false,                                \
-          "Prints properties used by the JVMCI compiler")                   \
+          "Prints properties used by the JVMCI compiler and exits")         \
                                                                             \
   product(bool, UseJVMCIClassLoader, true,                                  \
           "Load JVMCI classes with separate class loader")                  \