Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions test/jtreg-ext/requires/VMProps.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class VMProps implements Callable<Map<String, String>> {
// value known to jtreg as an indicator of error state
private static final String ERROR_STATE = "__ERROR__";

private static final String GC_PREFIX = "-XX:+Use";
private static final String GC_SUFFIX = "GC";

private static final WhiteBox WB = WhiteBox.getWhiteBox();

private static class SafeMap {
Expand Down Expand Up @@ -348,8 +351,6 @@ protected void vmGCforCDS(SafeMap map) {
return;
}

String GC_PREFIX = "-XX:+Use";
String GC_SUFFIX = "GC";
String jtropts = System.getProperty("test.cds.runtime.options");
if (jtropts != null) {
for (String opt : jtropts.split(",")) {
Expand Down Expand Up @@ -462,7 +463,31 @@ protected String vmCDSForCustomLoaders() {
* @return true if this VM can write Java heap objects into the CDS archive
*/
protected String vmCDSCanWriteArchivedJavaHeap() {
return "" + ("true".equals(vmCDS()) && WB.canWriteJavaHeapArchive());
return "" + ("true".equals(vmCDS()) && WB.canWriteJavaHeapArchive()
&& isCDSRuntimeOptionsCompatible());
}

/**
* @return true if the VM options specified via the "test.cds.runtime.options"
* property is compatible with writing Java heap objects into the CDS archive
*/
protected boolean isCDSRuntimeOptionsCompatible() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add braces for all the added if statements.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed this one:

        if (jtropts == null)
            return true;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

String jtropts = System.getProperty("test.cds.runtime.options");
if (jtropts == null) {
return true;
}
String CCP_DISABLED = "-XX:-UseCompressedClassPointers";
String G1GC_ENABLED = "-XX:+UseG1GC";
for (String opt : jtropts.split(",")) {
if (opt.equals(CCP_DISABLED)) {
return false;
}
if (opt.startsWith(GC_PREFIX) && opt.endsWith(GC_SUFFIX) &&
!opt.equals(G1GC_ENABLED)) {
return false;
}
}
return true;
}

/**
Expand Down