8203923: Add @requires feature to check flag values for the running JVM

Reviewed-by: kvn, dholmes
This commit is contained in:
Stefan Karlsson 2018-05-31 10:41:36 +02:00
parent f001238086
commit c5d5f71014

View File

@ -80,6 +80,7 @@ public class VMProps implements Callable<Map<String, String>> {
map.put("vm.graal.enabled", isGraalEnabled());
map.put("docker.support", dockerSupport());
vmGC(map); // vm.gc.X = true/false
vmOptFinalFlags(map);
VMProps.dump(map);
return map;
@ -235,6 +236,25 @@ public class VMProps implements Callable<Map<String, String>> {
}
}
/**
* Selected final flag.
* @param map - property-value pairs
* @param flagName - flag name
*/
private void vmOptFinalFlag(Map<String, String> map, String flagName) {
String value = WB.getBooleanVMFlag(flagName) ? "true" : "false";
map.put("vm.opt.final." + flagName, value);
}
/**
* Selected sets of final flags.
* @param map -property-value pairs
*/
protected void vmOptFinalFlags(Map<String, String> map) {
vmOptFinalFlag(map, "ClassUnloading");
vmOptFinalFlag(map, "UseCompressedOops");
}
/**
* @return true if VM runs RTM supported OS and false otherwise.
*/