Skip to content

Commit f2b4e12

Browse files
author
Doug Simon
committed
8350263: JvmciNotifyBootstrapFinishedEventTest intermittently times out
Reviewed-by: yzheng, never
1 parent 46d4a60 commit f2b4e12

File tree

4 files changed

+48
-39
lines changed

4 files changed

+48
-39
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
compiler.jvmci.TestUncaughtErrorInCompileMethod
1+
compiler.jvmci.TestUncaughtErrorInCompileMethod$Locator

test/hotspot/jtreg/compiler/jvmci/TestUncaughtErrorInCompileMethod.java

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
import java.util.concurrent.TimeUnit;
5757
import java.util.concurrent.atomic.AtomicInteger;
5858

59-
public class TestUncaughtErrorInCompileMethod extends JVMCIServiceLocator {
59+
public class TestUncaughtErrorInCompileMethod {
6060

6161
static volatile boolean compilerCreationErrorOccurred;
6262

@@ -86,6 +86,7 @@ static void testSubprocess(boolean fatalError) throws Exception {
8686
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
8787
"-XX:+UnlockExperimentalVMOptions",
8888
"-XX:+UseJVMCICompiler", "-Djvmci.Compiler=ErrorCompiler",
89+
"-XX:-UseJVMCINativeLibrary",
8990
"-XX:-TieredCompilation",
9091
"-XX:+PrintCompilation",
9192
"--add-exports=jdk.internal.vm.ci/jdk.vm.ci.services=ALL-UNNAMED",
@@ -124,7 +125,7 @@ static void testSubprocess(boolean fatalError) throws Exception {
124125

125126
// Check that hs-err contains the stack trace of the fatal exception (sample shown above)
126127
String[] stackTraceSubstrings = {
127-
"at compiler.jvmci.TestUncaughtErrorInCompileMethod$1.createCompiler(TestUncaughtErrorInCompileMethod.java",
128+
"at compiler.jvmci.TestUncaughtErrorInCompileMethod$Locator$1.createCompiler(TestUncaughtErrorInCompileMethod.java",
128129
"at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java"
129130
};
130131
for (String expect : stackTraceSubstrings) {
@@ -172,31 +173,34 @@ static class CompilerCreationError extends InternalError {
172173
}
173174
}
174175

175-
@Override
176-
public <S> S getProvider(Class<S> service) {
177-
if (service == JVMCICompilerFactory.class) {
178-
return service.cast(new JVMCICompilerFactory() {
179-
final AtomicInteger counter = new AtomicInteger();
180-
@Override
181-
public String getCompilerName() {
182-
return "ErrorCompiler";
183-
}
176+
public static class Locator extends JVMCIServiceLocator {
184177

185-
@Override
186-
public JVMCICompiler createCompiler(JVMCIRuntime runtime) {
187-
int attempt = counter.incrementAndGet();
188-
CompilerCreationError e = new CompilerCreationError(attempt);
189-
e.printStackTrace();
190-
if (attempt >= 10) {
191-
// Delay notifying the loop in main so that compilation failures
192-
// have time to be reported by -XX:+PrintCompilation.
193-
compilerCreationErrorOccurred = true;
178+
@Override
179+
public <S> S getProvider(Class<S> service) {
180+
if (service == JVMCICompilerFactory.class) {
181+
return service.cast(new JVMCICompilerFactory() {
182+
final AtomicInteger counter = new AtomicInteger();
183+
@Override
184+
public String getCompilerName() {
185+
return "ErrorCompiler";
194186
}
195-
throw e;
196-
}
197-
});
187+
188+
@Override
189+
public JVMCICompiler createCompiler(JVMCIRuntime runtime) {
190+
int attempt = counter.incrementAndGet();
191+
CompilerCreationError e = new CompilerCreationError(attempt);
192+
e.printStackTrace();
193+
if (attempt >= 10) {
194+
// Delay notifying the loop in main so that compilation failures
195+
// have time to be reported by -XX:+PrintCompilation.
196+
compilerCreationErrorOccurred = true;
197+
}
198+
throw e;
199+
}
200+
});
201+
}
202+
return null;
198203
}
199-
return null;
200204
}
201205

202206
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
1+
compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest$Locator
22
compiler.jvmci.common.JVMCIHelpers

test/hotspot/jtreg/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,34 @@
6262
import jdk.vm.ci.services.JVMCIServiceLocator;
6363
import jdk.vm.ci.hotspot.HotSpotVMEventListener;
6464

65-
public class JvmciNotifyBootstrapFinishedEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {
65+
public class JvmciNotifyBootstrapFinishedEventTest {
6666
private static final boolean BOOTSTRAP = Boolean
6767
.getBoolean("compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap");
68-
private static volatile int gotBoostrapNotification = 0;
68+
private static volatile int gotBootstrapNotification = 0;
6969

7070
public static void main(String args[]) {
7171
if (BOOTSTRAP) {
72-
Asserts.assertEQ(gotBoostrapNotification, 1, "Did not receive expected number of bootstrap events");
72+
Asserts.assertEQ(gotBootstrapNotification, 1, "Did not receive expected number of bootstrap events");
7373
} else {
74-
Asserts.assertEQ(gotBoostrapNotification, 0, "Got unexpected bootstrap event");
74+
Asserts.assertEQ(gotBootstrapNotification, 0, "Got unexpected bootstrap event");
7575
}
7676
}
7777

78-
@Override
79-
public <S> S getProvider(Class<S> service) {
80-
if (service == HotSpotVMEventListener.class) {
81-
return service.cast(this);
78+
public static class Locator extends JVMCIServiceLocator implements HotSpotVMEventListener {
79+
public Locator() {
80+
Thread.dumpStack();
81+
}
82+
@Override
83+
public <S> S getProvider(Class<S> service) {
84+
if (service == HotSpotVMEventListener.class) {
85+
return service.cast(this);
86+
}
87+
return null;
8288
}
83-
return null;
84-
}
8589

86-
@Override
87-
public void notifyBootstrapFinished() {
88-
gotBoostrapNotification++;
90+
@Override
91+
public void notifyBootstrapFinished() {
92+
gotBootstrapNotification++;
93+
}
8994
}
9095
}

0 commit comments

Comments
 (0)