mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8350263: JvmciNotifyBootstrapFinishedEventTest intermittently times out
Reviewed-by: yzheng, never
This commit is contained in:
parent
46d4a601e0
commit
f2b4e12afe
@ -1 +1 @@
|
||||
compiler.jvmci.TestUncaughtErrorInCompileMethod
|
||||
compiler.jvmci.TestUncaughtErrorInCompileMethod$Locator
|
||||
|
||||
@ -56,7 +56,7 @@ import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class TestUncaughtErrorInCompileMethod extends JVMCIServiceLocator {
|
||||
public class TestUncaughtErrorInCompileMethod {
|
||||
|
||||
static volatile boolean compilerCreationErrorOccurred;
|
||||
|
||||
@ -86,6 +86,7 @@ public class TestUncaughtErrorInCompileMethod extends JVMCIServiceLocator {
|
||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||
"-XX:+UnlockExperimentalVMOptions",
|
||||
"-XX:+UseJVMCICompiler", "-Djvmci.Compiler=ErrorCompiler",
|
||||
"-XX:-UseJVMCINativeLibrary",
|
||||
"-XX:-TieredCompilation",
|
||||
"-XX:+PrintCompilation",
|
||||
"--add-exports=jdk.internal.vm.ci/jdk.vm.ci.services=ALL-UNNAMED",
|
||||
@ -124,7 +125,7 @@ public class TestUncaughtErrorInCompileMethod extends JVMCIServiceLocator {
|
||||
|
||||
// Check that hs-err contains the stack trace of the fatal exception (sample shown above)
|
||||
String[] stackTraceSubstrings = {
|
||||
"at compiler.jvmci.TestUncaughtErrorInCompileMethod$1.createCompiler(TestUncaughtErrorInCompileMethod.java",
|
||||
"at compiler.jvmci.TestUncaughtErrorInCompileMethod$Locator$1.createCompiler(TestUncaughtErrorInCompileMethod.java",
|
||||
"at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java"
|
||||
};
|
||||
for (String expect : stackTraceSubstrings) {
|
||||
@ -172,31 +173,34 @@ public class TestUncaughtErrorInCompileMethod extends JVMCIServiceLocator {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> S getProvider(Class<S> service) {
|
||||
if (service == JVMCICompilerFactory.class) {
|
||||
return service.cast(new JVMCICompilerFactory() {
|
||||
final AtomicInteger counter = new AtomicInteger();
|
||||
@Override
|
||||
public String getCompilerName() {
|
||||
return "ErrorCompiler";
|
||||
}
|
||||
public static class Locator extends JVMCIServiceLocator {
|
||||
|
||||
@Override
|
||||
public JVMCICompiler createCompiler(JVMCIRuntime runtime) {
|
||||
int attempt = counter.incrementAndGet();
|
||||
CompilerCreationError e = new CompilerCreationError(attempt);
|
||||
e.printStackTrace();
|
||||
if (attempt >= 10) {
|
||||
// Delay notifying the loop in main so that compilation failures
|
||||
// have time to be reported by -XX:+PrintCompilation.
|
||||
compilerCreationErrorOccurred = true;
|
||||
@Override
|
||||
public <S> S getProvider(Class<S> service) {
|
||||
if (service == JVMCICompilerFactory.class) {
|
||||
return service.cast(new JVMCICompilerFactory() {
|
||||
final AtomicInteger counter = new AtomicInteger();
|
||||
@Override
|
||||
public String getCompilerName() {
|
||||
return "ErrorCompiler";
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public JVMCICompiler createCompiler(JVMCIRuntime runtime) {
|
||||
int attempt = counter.incrementAndGet();
|
||||
CompilerCreationError e = new CompilerCreationError(attempt);
|
||||
e.printStackTrace();
|
||||
if (attempt >= 10) {
|
||||
// Delay notifying the loop in main so that compilation failures
|
||||
// have time to be reported by -XX:+PrintCompilation.
|
||||
compilerCreationErrorOccurred = true;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
|
||||
compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest$Locator
|
||||
compiler.jvmci.common.JVMCIHelpers
|
||||
|
||||
@ -62,29 +62,34 @@ import jdk.test.lib.Asserts;
|
||||
import jdk.vm.ci.services.JVMCIServiceLocator;
|
||||
import jdk.vm.ci.hotspot.HotSpotVMEventListener;
|
||||
|
||||
public class JvmciNotifyBootstrapFinishedEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {
|
||||
public class JvmciNotifyBootstrapFinishedEventTest {
|
||||
private static final boolean BOOTSTRAP = Boolean
|
||||
.getBoolean("compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap");
|
||||
private static volatile int gotBoostrapNotification = 0;
|
||||
private static volatile int gotBootstrapNotification = 0;
|
||||
|
||||
public static void main(String args[]) {
|
||||
if (BOOTSTRAP) {
|
||||
Asserts.assertEQ(gotBoostrapNotification, 1, "Did not receive expected number of bootstrap events");
|
||||
Asserts.assertEQ(gotBootstrapNotification, 1, "Did not receive expected number of bootstrap events");
|
||||
} else {
|
||||
Asserts.assertEQ(gotBoostrapNotification, 0, "Got unexpected bootstrap event");
|
||||
Asserts.assertEQ(gotBootstrapNotification, 0, "Got unexpected bootstrap event");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> S getProvider(Class<S> service) {
|
||||
if (service == HotSpotVMEventListener.class) {
|
||||
return service.cast(this);
|
||||
public static class Locator extends JVMCIServiceLocator implements HotSpotVMEventListener {
|
||||
public Locator() {
|
||||
Thread.dumpStack();
|
||||
}
|
||||
@Override
|
||||
public <S> S getProvider(Class<S> service) {
|
||||
if (service == HotSpotVMEventListener.class) {
|
||||
return service.cast(this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyBootstrapFinished() {
|
||||
gotBoostrapNotification++;
|
||||
@Override
|
||||
public void notifyBootstrapFinished() {
|
||||
gotBootstrapNotification++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user