From a9d5455ee1447ddaffc57f96595a8fe6f0ab3cd7 Mon Sep 17 00:00:00 2001 From: iveresov Date: Tue, 16 Nov 2010 15:57:16 -0800 Subject: [PATCH] 7000349: Tiered reacts incorrectly to C1 compilation failures Summary: Fix policy reaction to C1 comilation failures, make C1 properly report errors. Reviewed-by: kvn --- src/share/vm/c1/c1_Compilation.cpp | 9 ++++++++- src/share/vm/compiler/compileBroker.cpp | 11 ++--------- src/share/vm/runtime/simpleThresholdPolicy.cpp | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/share/vm/c1/c1_Compilation.cpp b/src/share/vm/c1/c1_Compilation.cpp index b1dd7e201..57e1623d9 100644 --- a/src/share/vm/c1/c1_Compilation.cpp +++ b/src/share/vm/c1/c1_Compilation.cpp @@ -471,7 +471,14 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho _exception_info_list = new ExceptionInfoList(); _implicit_exception_table.set_size(0); compile_method(); - if (is_profiling() && _would_profile) { + if (bailed_out()) { + _env->record_method_not_compilable(bailout_msg(), !TieredCompilation); + if (is_profiling()) { + // Compilation failed, create MDO, which would signal the interpreter + // to start profiling on its own. + _method->build_method_data(); + } + } else if (is_profiling() && _would_profile) { ciMethodData *md = method->method_data(); assert (md != NULL, "Should have MDO"); md->set_would_profile(_would_profile); diff --git a/src/share/vm/compiler/compileBroker.cpp b/src/share/vm/compiler/compileBroker.cpp index 213ea0cc4..311d1b744 100644 --- a/src/share/vm/compiler/compileBroker.cpp +++ b/src/share/vm/compiler/compileBroker.cpp @@ -1535,7 +1535,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { //assert(false, "compiler should always document failure"); // The compiler elected, without comment, not to register a result. // Do not attempt further compilations of this method. - ci_env.record_method_not_compilable("compile failed"); + ci_env.record_method_not_compilable("compile failed", !TieredCompilation); } if (ci_env.failing()) { @@ -1544,15 +1544,8 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { if (PrintCompilation) { const char* reason = ci_env.failure_reason(); if (compilable == ciEnv::MethodCompilable_not_at_tier) { - if (is_highest_tier_compile(ci_env.comp_level())) { - // Already at highest tier, promote to not compilable. - compilable = ciEnv::MethodCompilable_never; - } else { tty->print_cr("%3d COMPILE SKIPPED: %s (retry at different tier)", compile_id, reason); - } - } - - if (compilable == ciEnv::MethodCompilable_never) { + } else if (compilable == ciEnv::MethodCompilable_never) { tty->print_cr("%3d COMPILE SKIPPED: %s (not retryable)", compile_id, reason); } else if (compilable == ciEnv::MethodCompilable) { tty->print_cr("%3d COMPILE SKIPPED: %s", compile_id, reason); diff --git a/src/share/vm/runtime/simpleThresholdPolicy.cpp b/src/share/vm/runtime/simpleThresholdPolicy.cpp index ce8495675..c38c2041a 100644 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp @@ -176,11 +176,11 @@ void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, T if (level == CompLevel_none) { return; } - // Check if the method can be compiled, if not - try different levels. + // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling + // in the interpreter and then compile with C2 (the transition function will request that, + // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with + // pure C1. if (!can_be_compiled(mh, level)) { - if (level < CompLevel_full_optimization && can_be_compiled(mh, CompLevel_full_optimization)) { - compile(mh, bci, CompLevel_full_optimization, THREAD); - } if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) { compile(mh, bci, CompLevel_simple, THREAD); } -- GitLab