Skip to content

Commit 6020991

Browse files
author
Tom Rodriguez
committed
8255068: [JVMCI] errors during compiler creation can be hidden
Reviewed-by: kvn
1 parent 8d9e6d0 commit 6020991

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import java.util.function.Predicate;
4747

4848
import jdk.vm.ci.code.Architecture;
49+
import jdk.vm.ci.code.CompilationRequest;
4950
import jdk.vm.ci.code.CompilationRequestResult;
5051
import jdk.vm.ci.code.CompiledCode;
5152
import jdk.vm.ci.code.InstalledCode;
@@ -698,18 +699,39 @@ public Class<?> getMirror(ResolvedJavaType type) {
698699
return null;
699700
}
700701

702+
static class ErrorCreatingCompiler implements JVMCICompiler {
703+
private final RuntimeException t;
704+
705+
ErrorCreatingCompiler(RuntimeException t) {
706+
this.t = t;
707+
}
708+
709+
@Override
710+
public CompilationRequestResult compileMethod(CompilationRequest request) {
711+
throw t;
712+
}
713+
}
714+
701715
@Override
702716
public JVMCICompiler getCompiler() {
703717
if (compiler == null) {
704718
synchronized (this) {
705719
if (compiler == null) {
706720
assert !creatingCompiler : "recursive compiler creation";
707721
creatingCompiler = true;
708-
compiler = compilerFactory.createCompiler(this);
709-
creatingCompiler = false;
722+
try {
723+
compiler = compilerFactory.createCompiler(this);
724+
} catch (RuntimeException t) {
725+
compiler = new ErrorCreatingCompiler(t);
726+
} finally {
727+
creatingCompiler = false;
728+
}
710729
}
711730
}
712731
}
732+
if (compiler instanceof ErrorCreatingCompiler) {
733+
throw ((ErrorCreatingCompiler) compiler).t;
734+
}
713735
return compiler;
714736
}
715737

0 commit comments

Comments
 (0)