8168295: [JVMCI] -XX:+JVMCIPrintProperties should exit after printing
Reviewed-by: kvn, twisti
--- a/hotspot/.mx.jvmci/.pydevproject Wed Oct 19 16:56:31 2016 +0000
+++ b/hotspot/.mx.jvmci/.pydevproject Wed Oct 19 20:15:35 2016 +0200
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse-pydev version="1.0"?>
-
-<pydev_project>
+<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
-<path>/mx.jvmci</path>
+<path>/.mx.jvmci</path>
</pydev_pathproperty>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/mx</path>
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Wed Oct 19 16:56:31 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Wed Oct 19 20:15:35 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/hotspot/src/share/vm/jvmci/jvmci_globals.hpp Wed Oct 19 16:56:31 2016 +0000
+++ b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp Wed Oct 19 20:15:35 2016 +0200
@@ -50,7 +50,7 @@
"Use JVMCI as the default compiler") \
\
experimental(bool, JVMCIPrintProperties, false, \
- "Prints properties used by the JVMCI compiler") \
+ "Prints properties used by the JVMCI compiler and exits") \
\
experimental(bool, BootstrapJVMCI, false, \
"Bootstrap JVMCI before running Java main method") \
--- a/hotspot/test/compiler/jvmci/TestJVMCIPrintProperties.java Wed Oct 19 16:56:31 2016 +0000
+++ b/hotspot/test/compiler/jvmci/TestJVMCIPrintProperties.java Wed Oct 19 20:15:35 2016 +0200
@@ -37,14 +37,13 @@
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockExperimentalVMOptions",
"-XX:+EnableJVMCI",
- "-XX:+JVMCIPrintProperties",
- "-version");
+ "-XX:+JVMCIPrintProperties");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("[JVMCI properties]"); // expected message
- output.shouldContain("String jvmci.Compiler"); // expected message
- output.shouldContain("Boolean jvmci.InitTimer"); // expected message
- output.shouldContain("Boolean jvmci.PrintConfig"); // expected message
- output.shouldContain("String jvmci.TraceMethodDataFilter"); // expected message
+ output.shouldContain("jvmci.Compiler = null"); // expected message
+ output.shouldContain("jvmci.InitTimer = false"); // expected message
+ output.shouldContain("jvmci.PrintConfig = false"); // expected message
+ output.shouldContain("jvmci.TraceMethodDataFilter = null"); // expected message
output.shouldHaveExitValue(0);
}
}