提交 feffc9ab 编写于 作者: T thartmann

8065339: Failed compilation does not always trigger a JFR event 'CompilerFailure'

Summary: CompilerFailure JFR event should be triggered in ciEnv.
Reviewed-by: kvn
上级 0595b6e8
......@@ -53,6 +53,7 @@
#include "runtime/reflection.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/thread.inline.hpp"
#include "trace/tracing.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/macros.hpp"
#ifdef COMPILER1
......@@ -1141,6 +1142,16 @@ void ciEnv::record_failure(const char* reason) {
}
}
void ciEnv::report_failure(const char* reason) {
// Create and fire JFR event
EventCompilerFailure event;
if (event.should_commit()) {
event.set_compileID(compile_id());
event.set_failure(reason);
event.commit();
}
}
// ------------------------------------------------------------------
// ciEnv::record_method_not_compilable()
void ciEnv::record_method_not_compilable(const char* reason, bool all_tiers) {
......
......@@ -450,7 +450,8 @@ public:
// Check for changes to the system dictionary during compilation
bool system_dictionary_modification_counter_changed();
void record_failure(const char* reason);
void record_failure(const char* reason); // Record failure and report later
void report_failure(const char* reason); // Report failure immediately
void record_method_not_compilable(const char* reason, bool all_tiers = true);
void record_out_of_memory_failure();
......
......@@ -1985,6 +1985,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
if (ci_env.failing()) {
task->set_failure_reason(ci_env.failure_reason());
ci_env.report_failure(ci_env.failure_reason());
const char* retry_message = ci_env.retry_message();
if (_compilation_log != NULL) {
_compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
......
......@@ -102,23 +102,25 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
// Attempt to compile while subsuming loads into machine instructions.
Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
// Check result and retry if appropriate.
if (C.failure_reason() != NULL) {
if (C.failure_reason_is(retry_no_subsuming_loads())) {
assert(subsume_loads, "must make progress");
subsume_loads = false;
env->report_failure(C.failure_reason());
continue; // retry
}
if (C.failure_reason_is(retry_no_escape_analysis())) {
assert(do_escape_analysis, "must make progress");
do_escape_analysis = false;
env->report_failure(C.failure_reason());
continue; // retry
}
if (C.has_boxed_value()) {
// Recompile without boxing elimination regardless failure reason.
assert(eliminate_boxing, "must make progress");
eliminate_boxing = false;
env->report_failure(C.failure_reason());
continue; // retry
}
// Pass any other failure reason up to the ciEnv.
......
......@@ -67,7 +67,6 @@
#include "runtime/signature.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/timer.hpp"
#include "trace/tracing.hpp"
#include "utilities/copy.hpp"
......@@ -3542,13 +3541,6 @@ void Compile::record_failure(const char* reason) {
_failure_reason = reason;
}
EventCompilerFailure event;
if (event.should_commit()) {
event.set_compileID(Compile::compile_id());
event.set_failure(reason);
event.commit();
}
if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
C->print_method(PHASE_FAILURE);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册