Skip to content

Commit 43af120

Browse files
author
Doug Simon
committed
8326959: Improve JVMCI option help
Reviewed-by: never
1 parent 742c776 commit 43af120

File tree

2 files changed

+54
-27
lines changed

2 files changed

+54
-27
lines changed

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -221,35 +221,60 @@ static String[] exceptionToString(Throwable o, boolean toString, boolean stackTr
221221
*/
222222
static final Map<String, Object> options = new HashMap<>();
223223

224+
/**
225+
* Sentinel help value to denote options that are not printed by -XX:+JVMCIPrintProperties.
226+
* Javadoc is used instead to document these options.
227+
*/
228+
private static final String[] NO_HELP = null;
229+
224230
/**
225231
* A list of all supported JVMCI options.
226232
*/
227233
public enum Option {
228234
// @formatter:off
229-
Compiler(String.class, null, "Selects the system compiler. This must match the getCompilerName() value returned " +
230-
"by a jdk.vm.ci.runtime.JVMCICompilerFactory provider. " +
231-
"An empty string or the value \"null\" selects a compiler " +
232-
"that will raise an exception upon receiving a compilation request."),
233-
// Note: The following one is not used (see InitTimer.ENABLED). It is added here
234-
// so that -XX:+JVMCIPrintProperties shows the option.
235-
InitTimer(Boolean.class, false, "Specifies if initialization timing is enabled."),
236-
CodeSerializationTypeInfo(Boolean.class, false, "Prepend the size and label of each element to the stream when " +
237-
"serializing HotSpotCompiledCode to verify both ends of the protocol agree on the format. " +
238-
"Defaults to true in non-product builds."),
239-
DumpSerializedCode(String.class, null, "Dump serialized code during code installation for code whose simple " +
240-
"name (a stub) or fully qualified name (an nmethod) contains this option's value as a substring."),
241-
ForceTranslateFailure(String.class, null, "Forces HotSpotJVMCIRuntime.translate to throw an exception in the context " +
242-
"of the peer runtime. The value is a filter that can restrict the forced failure to matching translated " +
243-
"objects. See HotSpotJVMCIRuntime.postTranslation for more details. This option exists solely to test " +
244-
"correct handling of translation failures."),
245-
PrintConfig(Boolean.class, false, "Prints VM configuration available via JVMCI."),
246-
AuditHandles(Boolean.class, false, "Record stack trace along with scoped foreign object reference wrappers " +
247-
"to debug issue with a wrapper being used after its scope has closed."),
248-
TraceMethodDataFilter(String.class, null,
249-
"Enables tracing of profiling info when read by JVMCI.",
250-
"Empty value: trace all methods",
251-
"Non-empty value: trace methods whose fully qualified name contains the value."),
252-
UseProfilingInformation(Boolean.class, true, "");
235+
Compiler(String.class, null,
236+
"Selects the system compiler. This must match the getCompilerName() value",
237+
"returned by a jdk.vm.ci.runtime.JVMCICompilerFactory provider. ",
238+
"An empty string or the value \"null\" selects a compiler ",
239+
"that raises an exception upon receiving a compilation request."),
240+
241+
PrintConfig(Boolean.class, false, "Prints VM values (e.g. flags, constants, field offsets etc) exposed to JVMCI."),
242+
243+
InitTimer(Boolean.class, false, NO_HELP),
244+
245+
/**
246+
* Prepends the size and label of each element to the stream when serializing {@link HotSpotCompiledCode}
247+
* to verify both ends of the protocol agree on the format. Defaults to true in non-product builds.
248+
*/
249+
CodeSerializationTypeInfo(Boolean.class, false, NO_HELP),
250+
251+
/**
252+
* Dumps serialized code during code installation for code whose qualified form (e.g.
253+
* {@code java.lang.String.hashCode()}) contains this option's value as a substring.
254+
*/
255+
DumpSerializedCode(String.class, null, NO_HELP),
256+
257+
/**
258+
* Forces {@link #translate} to throw an exception in the context of the peer runtime for
259+
* translated objects that match this value. See {@link #postTranslation} for more details.
260+
* This option exists solely to test correct handling of translation failures.
261+
*/
262+
ForceTranslateFailure(String.class, null, NO_HELP),
263+
264+
/**
265+
* Captures a stack trace along with scoped foreign object reference wrappers
266+
* to debug an issue with a wrapper being used after its scope has closed.
267+
*/
268+
AuditHandles(Boolean.class, false, NO_HELP),
269+
270+
/**
271+
* Enables tracing of profiling info when read by JVMCI.
272+
* Empty value: trace all methods
273+
* Non-empty value: trace methods whose fully qualified name contains the value
274+
*/
275+
TraceMethodDataFilter(String.class, null, NO_HELP),
276+
277+
UseProfilingInformation(Boolean.class, true, NO_HELP);
253278
// @formatter:on
254279

255280
/**
@@ -343,6 +368,9 @@ public static void printProperties(PrintStream out) {
343368
out.println("[JVMCI properties]");
344369
Option[] values = values();
345370
for (Option option : values) {
371+
if (option.helpLines == null) {
372+
continue;
373+
}
346374
Object value = option.getValue();
347375
if (value instanceof String) {
348376
value = '"' + String.valueOf(value) + '"';
@@ -362,6 +390,7 @@ public static void printProperties(PrintStream out) {
362390
for (String line : option.helpLines) {
363391
out.printf("%" + PROPERTY_HELP_INDENT + "s%s%n", "", line);
364392
}
393+
out.println();
365394
}
366395
}
367396

test/hotspot/jtreg/compiler/jvmci/TestJVMCIPrintProperties.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test TestBasicLogOutput
2626
* @bug 8203370
27-
* @summary Ensure -XX:-JVMCIPrintProperties can be enabled and successfully prints expected output to stdout.
27+
* @summary Ensure -XX:+JVMCIPrintProperties successfully prints expected output to stdout.
2828
* @requires vm.flagless
2929
* @requires vm.jvmci
3030
* @library /test/lib
@@ -49,9 +49,7 @@ static void test(String enableFlag) throws Exception {
4949
OutputAnalyzer output = new OutputAnalyzer(pb.start());
5050
output.shouldContain("[JVMCI properties]"); // expected message
5151
output.shouldContain("jvmci.Compiler := \"null\""); // expected message
52-
output.shouldContain("jvmci.InitTimer = false"); // expected message
5352
output.shouldContain("jvmci.PrintConfig = false"); // expected message
54-
output.shouldContain("jvmci.TraceMethodDataFilter = null"); // expected message
5553
output.shouldHaveExitValue(0);
5654
}
5755
}

0 commit comments

Comments
 (0)