< prev index next >

test/jtreg-ext/requires/VMProps.java

Print this page
rev 59879 : [mq]: 8249000

@@ -266,26 +266,45 @@
      */
     protected String cpuFeatures() {
         return CPUInfo.getFeatures().toString();
     }
 
+    private boolean isGcSupportedByGraal(GC gc) {
+        switch (gc) {
+            case Serial:
+            case Parallel:
+            case G1:
+                return true;
+            case Epsilon:
+            case Z:
+            case Shenandoah:
+                return false;
+            default:
+                throw new IllegalStateException("Unknown GC " + gc.name());
+        }
+    }
+
     /**
      * For all existing GC sets vm.gc.X property.
      * Example vm.gc.G1=true means:
      *    VM supports G1
      *    User either set G1 explicitely (-XX:+UseG1GC) or did not set any GC
+     *    G1 can be selected, i.e. it doesn't conflict with other VM flags
      *
      * @param map - property-value pairs
      */
     protected void vmGC(SafeMap map) {
+        var isGraalEnabled = Compiler.isGraalEnabled();
         for (GC gc: GC.values()) {
             map.put("vm.gc." + gc.name(),
                     () -> "" + (gc.isSupported()
+                            && (!isGraalEnabled || isGcSupportedByGraal(gc))
                             && (gc.isSelected() || GC.isSelectedErgonomically())));
         }
     }
 
+
     /**
      * Selected final flag.
      *
      * @param map - property-value pairs
      * @param flagName - flag name
< prev index next >