8203923: Add @requires feature to check flag values for the running JVM
authorstefank
Thu, 31 May 2018 10:41:36 +0200
changeset 50320 df02866807b6
parent 50319 da74e543020e
child 50321 b186322970f4
8203923: Add @requires feature to check flag values for the running JVM Reviewed-by: kvn, dholmes
test/jtreg-ext/requires/VMProps.java
--- a/test/jtreg-ext/requires/VMProps.java	Thu May 31 15:11:57 2018 +0530
+++ b/test/jtreg-ext/requires/VMProps.java	Thu May 31 10:41:36 2018 +0200
@@ -80,6 +80,7 @@
         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;
@@ -236,6 +237,25 @@
     }
 
     /**
+     * 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.
      */
     protected String vmRTMOS() {