Skip to content

Commit

Permalink
8255068: [JVMCI] errors during compiler creation can be hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrodriguez committed Oct 21, 2020
1 parent cb6167b commit 2ab7aa9
Showing 1 changed file with 24 additions and 2 deletions.
Expand Up @@ -46,6 +46,7 @@
import java.util.function.Predicate;

import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.CompilationRequest;
import jdk.vm.ci.code.CompilationRequestResult;
import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.InstalledCode;
Expand Down Expand Up @@ -698,18 +699,39 @@ public Class<?> getMirror(ResolvedJavaType type) {
return null;
}

static class ErrorCreatingCompiler implements JVMCICompiler {
private final RuntimeException t;

ErrorCreatingCompiler(RuntimeException t) {
this.t = t;
}

@Override
public CompilationRequestResult compileMethod(CompilationRequest request) {
throw t;
}
}

@Override
public JVMCICompiler getCompiler() {
if (compiler == null) {
synchronized (this) {
if (compiler == null) {
assert !creatingCompiler : "recursive compiler creation";
creatingCompiler = true;
compiler = compilerFactory.createCompiler(this);
creatingCompiler = false;
try {
compiler = compilerFactory.createCompiler(this);
} catch (RuntimeException t) {
compiler = new ErrorCreatingCompiler(t);
} finally {
creatingCompiler = false;
}
}
}
}
if (compiler instanceof ErrorCreatingCompiler) {
throw ((ErrorCreatingCompiler) compiler).t;
}
return compiler;
}

Expand Down

0 comments on commit 2ab7aa9

Please sign in to comment.