|
56 | 56 | import java.util.concurrent.TimeUnit; |
57 | 57 | import java.util.concurrent.atomic.AtomicInteger; |
58 | 58 |
|
59 | | -public class TestUncaughtErrorInCompileMethod extends JVMCIServiceLocator { |
| 59 | +public class TestUncaughtErrorInCompileMethod { |
60 | 60 |
|
61 | 61 | static volatile boolean compilerCreationErrorOccurred; |
62 | 62 |
|
@@ -86,6 +86,7 @@ static void testSubprocess(boolean fatalError) throws Exception { |
86 | 86 | ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( |
87 | 87 | "-XX:+UnlockExperimentalVMOptions", |
88 | 88 | "-XX:+UseJVMCICompiler", "-Djvmci.Compiler=ErrorCompiler", |
| 89 | + "-XX:-UseJVMCINativeLibrary", |
89 | 90 | "-XX:-TieredCompilation", |
90 | 91 | "-XX:+PrintCompilation", |
91 | 92 | "--add-exports=jdk.internal.vm.ci/jdk.vm.ci.services=ALL-UNNAMED", |
@@ -124,7 +125,7 @@ static void testSubprocess(boolean fatalError) throws Exception { |
124 | 125 |
|
125 | 126 | // Check that hs-err contains the stack trace of the fatal exception (sample shown above) |
126 | 127 | String[] stackTraceSubstrings = { |
127 | | - "at compiler.jvmci.TestUncaughtErrorInCompileMethod$1.createCompiler(TestUncaughtErrorInCompileMethod.java", |
| 128 | + "at compiler.jvmci.TestUncaughtErrorInCompileMethod$Locator$1.createCompiler(TestUncaughtErrorInCompileMethod.java", |
128 | 129 | "at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.compileMethod(HotSpotJVMCIRuntime.java" |
129 | 130 | }; |
130 | 131 | for (String expect : stackTraceSubstrings) { |
@@ -172,31 +173,34 @@ static class CompilerCreationError extends InternalError { |
172 | 173 | } |
173 | 174 | } |
174 | 175 |
|
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 { |
184 | 177 |
|
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"; |
194 | 186 | } |
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; |
198 | 203 | } |
199 | | - return null; |
200 | 204 | } |
201 | 205 |
|
202 | 206 | /** |
|
0 commit comments