8212070: Introduce diagnostic flag to abort VM on failed JIT compilation
Reviewed-by: mikael, thartmann
--- a/src/hotspot/share/compiler/compileBroker.cpp Tue Nov 13 09:59:50 2018 +0100
+++ b/src/hotspot/share/compiler/compileBroker.cpp Mon Nov 19 11:51:27 2018 +0100
@@ -1946,7 +1946,8 @@
}
}
-void CompileBroker::post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env) {
+void CompileBroker::post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env,
+ int compilable, const char* failure_reason) {
if (success) {
task->mark_success();
if (ci_env != NULL) {
@@ -1958,6 +1959,13 @@
_compilation_log->log_nmethod(thread, code);
}
}
+ } else if (AbortVMOnCompilationFailure) {
+ if (compilable == ciEnv::MethodCompilable_not_at_tier) {
+ fatal("Not compilable at tier %d: %s", task->comp_level(), failure_reason);
+ }
+ if (compilable == ciEnv::MethodCompilable_never) {
+ fatal("Never compilable: %s", failure_reason);
+ }
}
// simulate crash during compilation
assert(task->compile_id() != CICrashAt, "just as planned");
@@ -2068,7 +2076,7 @@
compilable = ciEnv::MethodCompilable_not_at_tier;
}
}
- post_compile(thread, task, task->code() != NULL, NULL);
+ post_compile(thread, task, task->code() != NULL, NULL, compilable, failure_reason);
if (event.should_commit()) {
post_compilation_event(&event, task);
}
@@ -2128,7 +2136,7 @@
ci_env.report_failure(failure_reason);
}
- post_compile(thread, task, !ci_env.failing(), &ci_env);
+ post_compile(thread, task, !ci_env.failing(), &ci_env, compilable, failure_reason);
if (event.should_commit()) {
post_compilation_event(&event, task);
}
--- a/src/hotspot/share/compiler/compileBroker.hpp Tue Nov 13 09:59:50 2018 +0100
+++ b/src/hotspot/share/compiler/compileBroker.hpp Mon Nov 19 11:51:27 2018 +0100
@@ -252,7 +252,8 @@
#endif
static void invoke_compiler_on_method(CompileTask* task);
- static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env);
+ static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env,
+ int compilable, const char* failure_reason);
static void set_last_compile(CompilerThread *thread, const methodHandle& method, bool is_osr, int comp_level);
static void push_jni_handle_block();
static void pop_jni_handle_block();
--- a/src/hotspot/share/runtime/globals.hpp Tue Nov 13 09:59:50 2018 +0100
+++ b/src/hotspot/share/runtime/globals.hpp Mon Nov 19 11:51:27 2018 +0100
@@ -2016,6 +2016,9 @@
notproduct(bool, CIObjectFactoryVerify, false, \
"enable potentially expensive verification in ciObjectFactory") \
\
+ diagnostic(bool, AbortVMOnCompilationFailure, false, \
+ "Abort VM when method had failed to compile.") \
+ \
/* Priorities */ \
product_pd(bool, UseThreadPriorities, "Use native thread priorities") \
\