75 * TestSieveObjects
76 *
77 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
78 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
79 * TestSieveObjects
80 *
81 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
83 * TestSieveObjects
84 *
85 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
86 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
87 * TestSieveObjects
88 *
89 * @run main/othervm/timeout=240 -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
90 * -XX:+UseShenandoahGC
91 * -XX:-UseTLAB -XX:+ShenandoahVerify
92 * TestSieveObjects
93 */
94
95 import java.util.concurrent.ThreadLocalRandom;
96
97 public class TestSieveObjects {
98
99 static final int COUNT = 100_000_000;
100 static final int WINDOW = 1_000_000;
101 static final int PAYLOAD = 100;
102
103 static final MyObject[] arr = new MyObject[WINDOW];
104
105 public static void main(String[] args) throws Exception {
106 int rIdx = 0;
107 for (int c = 0; c < COUNT; c++) {
108 MyObject v = arr[rIdx];
109 if (v != null) {
110 if (v.x != rIdx) {
111 throw new IllegalStateException("Illegal value at index " + rIdx + ": " + v.x);
112 }
113 if (ThreadLocalRandom.current().nextInt(1000) > 100) {
114 arr[rIdx] = null;
|
75 * TestSieveObjects
76 *
77 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
78 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
79 * TestSieveObjects
80 *
81 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
82 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
83 * TestSieveObjects
84 *
85 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
86 * -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
87 * TestSieveObjects
88 *
89 * @run main/othervm/timeout=240 -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
90 * -XX:+UseShenandoahGC
91 * -XX:-UseTLAB -XX:+ShenandoahVerify
92 * TestSieveObjects
93 */
94
95 /*
96 * @test TestSieveObjects
97 * @summary Acceptance tests: collector can deal with retained objects
98 * @key gc
99 * @requires vm.gc.Shenandoah & !vm.graal.enabled
100 *
101 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
102 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
103 * -XX:+ShenandoahOOMDuringEvacALot
104 * TestSieveObjects
105 *
106 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
107 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
108 * -XX:+ShenandoahAllocFailureALot
109 * TestSieveObjects
110 *
111 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
112 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
113 * TestSieveObjects
114 *
115 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
116 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
117 * -XX:+ShenandoahVerify
118 * TestSieveObjects
119 *
120 * @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
121 * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
122 * TestSieveObjects
123 */
124
125 import java.util.concurrent.ThreadLocalRandom;
126
127 public class TestSieveObjects {
128
129 static final int COUNT = 100_000_000;
130 static final int WINDOW = 1_000_000;
131 static final int PAYLOAD = 100;
132
133 static final MyObject[] arr = new MyObject[WINDOW];
134
135 public static void main(String[] args) throws Exception {
136 int rIdx = 0;
137 for (int c = 0; c < COUNT; c++) {
138 MyObject v = arr[rIdx];
139 if (v != null) {
140 if (v.x != rIdx) {
141 throw new IllegalStateException("Illegal value at index " + rIdx + ": " + v.x);
142 }
143 if (ThreadLocalRandom.current().nextInt(1000) > 100) {
144 arr[rIdx] = null;
|