RFR: TestSelectiveBarrierFlags should accept multi-element flag selections

Aleksey Shipilev shade at redhat.com
Fri Jan 19 14:15:56 UTC 2018


Roman's test changes need this: Fixed the bug that breaks when more than 2 flags per group are
present, and also rewritten for clarity:

diff -r 12654193e434 test/hotspot/jtreg/gc/shenandoah/TestSelectiveBarrierFlags.java
--- a/test/hotspot/jtreg/gc/shenandoah/TestSelectiveBarrierFlags.java	Fri Jan 19 11:52:40 2018 +0100
+++ b/test/hotspot/jtreg/gc/shenandoah/TestSelectiveBarrierFlags.java	Fri Jan 19 15:14:50 2018 +0100
@@ -69,10 +69,11 @@

             StringBuilder sb = new StringBuilder();
             for (String[] l : opts) {
-                int f = t % (l.length + 1);
-                conf.add("-XX:" + ((f & 1) == 1 ? "+" : "-") + l[0]);
-                if (l.length > 1) {
-                    conf.add("-XX:" + ((f & 2) == 2 ? "+" : "-") + l[1]);
+                // Make a choice which flag to select from the group.
+                // Zero means no flag is selected from the group.
+                int choice = t % (l.length + 1);
+                for (int e = 0; e < l.length; e++) {
+                  conf.add("-XX:" + ((choice == (e + 1)) ? "+" : "-") + l[e]);
                 }
                 t = t / (l.length + 1);
             }

Testing: TestSelectiveBarrierFlags {fastdebug,release}

Thanks,
-Aleksey



More information about the shenandoah-dev mailing list