--- old/src/share/vm/runtime/advancedThresholdPolicy.cpp 2016-05-10 14:10:38.000000000 +0200 +++ new/src/share/vm/runtime/advancedThresholdPolicy.cpp 2016-05-10 14:10:38.000000000 +0200 @@ -27,6 +27,9 @@ #include "compiler/compileTask.hpp" #include "runtime/advancedThresholdPolicy.hpp" #include "runtime/simpleThresholdPolicy.inline.hpp" +#if INCLUDE_JVMCI +#include "jvmci/jvmciRuntime.hpp" +#endif #ifdef TIERED // Print an event. @@ -453,7 +456,7 @@ } // Determine if a method should be compiled with a normal entry point at a different level. -CompLevel AdvancedThresholdPolicy::call_event(Method* method, CompLevel cur_level) { +CompLevel AdvancedThresholdPolicy::call_event(Method* method, CompLevel cur_level, JavaThread * thread) { CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(), common(&AdvancedThresholdPolicy::loop_predicate, method, cur_level, true)); CompLevel next_level = common(&AdvancedThresholdPolicy::call_predicate, method, cur_level); @@ -470,11 +473,16 @@ } else { next_level = MAX2(osr_level, next_level); } +#if INCLUDE_JVMCI + if (UseJVMCICompiler) { + next_level = JVMCIRuntime::adjust_comp_level(method, false, next_level, thread); + } +#endif return next_level; } // Determine if we should do an OSR compilation of a given method. -CompLevel AdvancedThresholdPolicy::loop_event(Method* method, CompLevel cur_level) { +CompLevel AdvancedThresholdPolicy::loop_event(Method* method, CompLevel cur_level, JavaThread * thread) { CompLevel next_level = common(&AdvancedThresholdPolicy::loop_predicate, method, cur_level, true); if (cur_level == CompLevel_none) { // If there is a live OSR method that means that we deopted to the interpreter @@ -484,6 +492,11 @@ return osr_level; } } +#if INCLUDE_JVMCI + if (UseJVMCICompiler) { + next_level = JVMCIRuntime::adjust_comp_level(method, true, next_level, thread); + } +#endif return next_level; } @@ -501,7 +514,7 @@ create_mdo(mh, thread); } if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { - CompLevel next_level = call_event(mh(), level); + CompLevel next_level = call_event(mh(), level, thread); if (next_level != level) { compile(mh, InvocationEntryBci, next_level, thread); } @@ -521,7 +534,7 @@ } if (is_compilation_enabled()) { - CompLevel next_osr_level = loop_event(imh(), level); + CompLevel next_osr_level = loop_event(imh(), level, thread); CompLevel max_osr_level = (CompLevel)imh->highest_osr_comp_level(); // At the very least compile the OSR version if (!CompileBroker::compilation_is_in_queue(imh) && (next_osr_level != level)) { @@ -534,7 +547,7 @@ if (mh() != imh()) { // If there is an enclosing method guarantee(nm != NULL, "Should have nmethod here"); cur_level = comp_level(mh()); - next_level = call_event(mh(), cur_level); + next_level = call_event(mh(), cur_level, thread); if (max_osr_level == CompLevel_full_optimization) { // The inlinee OSRed to full opt, we need to modify the enclosing method to avoid deopts @@ -569,7 +582,7 @@ } } else { cur_level = comp_level(imh()); - next_level = call_event(imh(), cur_level); + next_level = call_event(imh(), cur_level, thread); if (!CompileBroker::compilation_is_in_queue(imh) && (next_level != cur_level)) { compile(imh, InvocationEntryBci, next_level, thread); }