--- old/test/jtreg-ext/requires/VMProps.java Fri Jun 10 19:37:22 2016 +++ new/test/jtreg-ext/requires/VMProps.java Fri Jun 10 19:37:22 2016 @@ -32,6 +32,8 @@ import java.util.concurrent.Callable; import java.util.regex.Matcher; import java.util.regex.Pattern; +import sun.hotspot.WhiteBox; +import sun.hotspot.gc.GC; /** * The Class to be invoked by jtreg prior Test Suite execution to @@ -39,6 +41,8 @@ * Properties set by this Class will be available in the @requires expressions. */ public class VMProps implements Callable> { + + private static final WhiteBox WB = WhiteBox.getWhiteBox(); /** * Collects information about VM properties. @@ -52,6 +56,7 @@ map.put("vm.flavor", vmFlavor()); map.put("vm.compMode", vmCompMode()); map.put("vm.bits", vmBits()); + vmGC(map); // vm.gc.X.acceptable = true/false dump(map); return map; } @@ -103,6 +108,24 @@ return System.getProperty("sun.arch.data.model"); } + /** + * For all existing GC sets vm.gc.XXX.acceptable property. + * Example vm.gc.G1.acceptable=true means: + * VM supports G1 + * User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC + * @param map - requires context + */ + protected void vmGC(Map map){ + GC currentGC = GC.current(); + boolean isByErgo = GC.currentSetByErgo(); + List supportedGC = GC.allSupported(); + for (GC gc: GC.values()) { + boolean isSupported = supportedGC.contains(gc); + boolean isAcceptable = isSupported && (gc == currentGC || isByErgo); + map.put("vm.gc." + gc.name() + ".acceptable", "" + isAcceptable); + } + } + /** * Dumps the map to the file if the file name is given as the property. * This functionality could be helpful to know context in the real