8256806: Shenandoah: optimize shenandoah/jni/TestPinnedGarbage.java test
Reviewed-by: rkennke
This commit is contained in:
parent
57025e65e1
commit
86f36027e4
@ -28,12 +28,12 @@
|
|||||||
* @requires vm.gc.Shenandoah
|
* @requires vm.gc.Shenandoah
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
*
|
*
|
||||||
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx512m
|
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
|
||||||
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
|
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
|
||||||
* -XX:+ShenandoahVerify -XX:+ShenandoahDegeneratedGC
|
* -XX:+ShenandoahVerify -XX:+ShenandoahDegeneratedGC
|
||||||
* TestPinnedGarbage
|
* TestPinnedGarbage
|
||||||
*
|
*
|
||||||
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx512m
|
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
|
||||||
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
|
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
|
||||||
* -XX:+ShenandoahVerify -XX:-ShenandoahDegeneratedGC
|
* -XX:+ShenandoahVerify -XX:-ShenandoahDegeneratedGC
|
||||||
* TestPinnedGarbage
|
* TestPinnedGarbage
|
||||||
@ -45,11 +45,11 @@
|
|||||||
* @requires vm.gc.Shenandoah
|
* @requires vm.gc.Shenandoah
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
*
|
*
|
||||||
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx512m
|
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
|
||||||
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
|
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
|
||||||
* TestPinnedGarbage
|
* TestPinnedGarbage
|
||||||
*
|
*
|
||||||
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx512m
|
* @run main/othervm/native -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx128m
|
||||||
* -XX:+UseShenandoahGC
|
* -XX:+UseShenandoahGC
|
||||||
* -XX:+ShenandoahVerify
|
* -XX:+ShenandoahVerify
|
||||||
* TestPinnedGarbage
|
* TestPinnedGarbage
|
||||||
@ -65,26 +65,26 @@ public class TestPinnedGarbage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final int NUM_RUNS = 1_000;
|
private static final int NUM_RUNS = 1_000;
|
||||||
private static final int OBJS_COUNT = 1_000;
|
private static final int OBJS_COUNT = 1 << 10;
|
||||||
private static final int GARBAGE_COUNT = 1_000_000;
|
private static final int GARBAGE_COUNT = 1 << 18;
|
||||||
|
|
||||||
private static native void pin(int[] a);
|
private static native void pin(int[] a);
|
||||||
private static native void unpin(int[] a);
|
private static native void unpin(int[] a);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Random rng = Utils.getRandomInstance();
|
||||||
for (int i = 0; i < NUM_RUNS; i++) {
|
for (int i = 0; i < NUM_RUNS; i++) {
|
||||||
test();
|
test(rng);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void test() {
|
private static void test(Random rng) {
|
||||||
Object[] objs = new Object[OBJS_COUNT];
|
Object[] objs = new Object[OBJS_COUNT];
|
||||||
for (int i = 0; i < OBJS_COUNT; i++) {
|
for (int i = 0; i < OBJS_COUNT; i++) {
|
||||||
objs[i] = new MyClass();
|
objs[i] = new MyClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] cog = new int[10];
|
int[] cog = new int[10];
|
||||||
Random rng = Utils.getRandomInstance();
|
|
||||||
int cogIdx = rng.nextInt(OBJS_COUNT);
|
int cogIdx = rng.nextInt(OBJS_COUNT);
|
||||||
objs[cogIdx] = cog;
|
objs[cogIdx] = cog;
|
||||||
pin(cog);
|
pin(cog);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user