use of org.graalvm.compiler.truffle.options.PolyglotCompilerOptions.ExceptionAction in project graal by oracle.
the class OptimizedCallTarget method onCompilationFailed.
@Override
public final void onCompilationFailed(Supplier<String> serializedException, boolean silent, boolean bailout, boolean permanentBailout, boolean graphTooBig) {
if (graphTooBig) {
if (computeBlockCompilations()) {
// retry compilation
return;
}
}
ExceptionAction action;
if (bailout && !permanentBailout) {
/*
* Non-permanent bailouts are expected cases. A non-permanent bailout would be for
* example class redefinition during code installation. As opposed to permanent
* bailouts, non-permanent bailouts will trigger recompilation and are not considered a
* failure state.
*/
action = ExceptionAction.Silent;
} else {
compilationFailed = true;
action = silent ? ExceptionAction.Silent : engine.compilationFailureAction;
}
if (action == ExceptionAction.Throw) {
final InternalError error = new InternalError(serializedException.get());
throw new OptimizationFailedException(error, this);
}
if (action.ordinal() >= ExceptionAction.Print.ordinal()) {
GraalTruffleRuntime rt = runtime();
Map<String, Object> properties = new LinkedHashMap<>();
properties.put("AST", getNonTrivialNodeCount());
rt.logEvent(this, 0, "opt fail", toString(), properties, serializedException.get());
if (action == ExceptionAction.ExitVM) {
String reason;
if (getOptionValue(PolyglotCompilerOptions.CompilationFailureAction) == ExceptionAction.ExitVM) {
reason = "engine.CompilationFailureAction=ExitVM";
} else if (getOptionValue(PolyglotCompilerOptions.CompilationExceptionsAreFatal)) {
reason = "engine.CompilationExceptionsAreFatal=true";
} else {
reason = "engine.PerformanceWarningsAreFatal=true";
}
log(String.format("Exiting VM due to %s", reason));
System.exit(-1);
}
}
}
Aggregations