Skip to content

Commit

Permalink
8270096: Shenandoah: Optimize gc/shenandoah/TestRefprocSanity.java fo…
Browse files Browse the repository at this point in the history
…r interpreter mode

Backport-of: 4f322a9b6c9cfdf080df23326daa45733f1b9aad
  • Loading branch information
shipilev committed Aug 23, 2021
1 parent 3c1023c commit 7d6c3ad
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions test/hotspot/jtreg/gc/shenandoah/TestRefprocSanity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
* @summary Test that null references/referents work fine
* @requires vm.gc.Shenandoah
*
* @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
*/
Expand All @@ -46,16 +46,16 @@
* @summary Test that null references/referents work fine
* @requires vm.gc.Shenandoah
*
* @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
*/
Expand All @@ -64,13 +64,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();
Expand All @@ -87,7 +89,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);
}
}

Expand Down

1 comment on commit 7d6c3ad

@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.