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