Skip to content
Permalink
Browse files
8270096: Shenandoah: Optimize gc/shenandoah/TestRefprocSanity.java fo…
…r interpreter mode

Backport-of: 4f322a9
  • Loading branch information
shipilev committed Aug 24, 2021
1 parent 4a2cd36 commit a27ee498ad05ccc5e85bd59839edb0c62d16b54b
Showing 1 changed file with 17 additions and 10 deletions.
@@ -27,16 +27,16 @@
* @key gc
* @requires vm.gc.Shenandoah & !vm.graal.enabled
*
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC
* -XX:+ShenandoahVerify
* TestRefprocSanity
*
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC
* TestRefprocSanity
*
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
* TestRefprocSanity
*/
@@ -47,16 +47,16 @@
* @key gc
* @requires vm.gc.Shenandoah & !vm.graal.enabled
*
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
* -XX:+ShenandoahVerify
* TestRefprocSanity
*
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
* TestRefprocSanity
*
* @run main/othervm -Xmx1g -Xms1g -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* @run main/othervm -Xmx128m -Xms128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
* TestRefprocSanity
*/
@@ -65,13 +65,15 @@

public class TestRefprocSanity {

static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation
static final int WINDOW = 10_000;
static final long TARGET_MB = Long.getLong("target", 1_000); // 1 Gb allocation
static final int WINDOW = 1_000;

static final Reference<MyObject>[] refs = new Reference[WINDOW];

static Object sink;

public static void main(String[] args) throws Exception {
long count = TARGET_MB * 1024 * 1024 / 32;
long count = TARGET_MB * 1024 * 1024 / 128;
int rIdx = 0;

ReferenceQueue rq = new ReferenceQueue();
@@ -88,7 +90,12 @@ public static void main(String[] args) throws Exception {
if (rIdx >= WINDOW) {
rIdx = 0;
}
while (rq.poll() != null); // drain

// Do allocations to force GCs
sink = new byte[100];

// Drain the refqueue
while (rq.poll() != null);
}
}

1 comment on commit a27ee49

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.