Skip to content

Commit

Permalink
Have counter pre-initialized in ParallelGC test
Browse files Browse the repository at this point in the history
Bug: 94471075
Test: testrunner.py --target --verbose --ndebug --gcstress --optimizing --debuggable -t 114-ParallelGC
Change-Id: Id0b3640bc4e21caf187fd886d153e00761b9ba15
  • Loading branch information
sbgoog committed Aug 17, 2021
1 parent bbd13da commit a0e10b1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/114-ParallelGC/src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@ public class Main implements Runnable {
private final static int THREAD_COUNT = 16;

// Use a couple of different forms of synchronizing to test some of these...
private final static AtomicInteger counter = new AtomicInteger();
private final static AtomicInteger counter = new AtomicInteger(-1);
private final static Object gate = new Object();
private volatile static int waitCount = 0;

static {
// If we're using the interpreter for the boot class path, the VarHandle implementation of
// AtomicInteger.incrementAndGet() needs to resolve a MethodType which is then cached for
// subsequent uses. Make sure the MethodType is resolved early, otherwise the
// counter.incrementAndGet() call in work(), after we have tried to allocate all memory,
// could throw OOME.
counter.incrementAndGet();
}

public static void main(String[] args) throws Exception {
Thread[] threads = new Thread[THREAD_COUNT];

Expand Down

0 comments on commit a0e10b1

Please sign in to comment.