src/hotspot/share/runtime/tieredThresholdPolicy.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Cdiff src/hotspot/share/runtime/tieredThresholdPolicy.cpp

src/hotspot/share/runtime/tieredThresholdPolicy.cpp

Print this page

        

*** 410,421 **** method_invocation_event(method, inlinee, comp_level, nm, thread); } else { // method == inlinee if the event originated in the main method method_back_branch_event(method, inlinee, bci, comp_level, nm, thread); // Check if event led to a higher level OSR compilation ! nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, comp_level, false); ! if (osr_nm != NULL && osr_nm->comp_level() > comp_level) { // Perform OSR with new nmethod return osr_nm; } } return NULL; --- 410,427 ---- method_invocation_event(method, inlinee, comp_level, nm, thread); } else { // method == inlinee if the event originated in the main method method_back_branch_event(method, inlinee, bci, comp_level, nm, thread); // Check if event led to a higher level OSR compilation ! CompLevel expected_comp_level = comp_level; ! if (inlinee->is_not_osr_compilable(expected_comp_level)) { ! // It's not possble to reach the expected level so fall back to simple. ! expected_comp_level = CompLevel_simple; ! } ! nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, expected_comp_level, false); ! assert(osr_nm == NULL || osr_nm->comp_level() >= expected_comp_level, "lookup_osr_nmethod_for is broken"); ! if (osr_nm != NULL) { // Perform OSR with new nmethod return osr_nm; } } return NULL;
*** 447,462 **** // 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_simple)) { compile(mh, bci, CompLevel_simple, thread); } return; } if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) { return; } if (!CompileBroker::compilation_is_in_queue(mh)) { if (PrintTieredEvents) { --- 453,479 ---- // 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 ((bci == InvocationEntryBci && !can_be_compiled(mh, level))) { if (level == CompLevel_full_optimization && can_be_compiled(mh, CompLevel_simple)) { compile(mh, bci, CompLevel_simple, thread); } return; } + if ((bci != InvocationEntryBci && !can_be_osr_compiled(mh, level))) { + if (level == CompLevel_full_optimization && can_be_osr_compiled(mh, CompLevel_simple)) { + nmethod* osr_nm = mh->lookup_osr_nmethod_for(bci, CompLevel_simple, false); + if (osr_nm != NULL && osr_nm->comp_level() > CompLevel_simple) { + // Invalidate the existing OSR nmethod so that a compile at CompLevel_simple is permitted. + osr_nm->make_not_entrant(); + } + compile(mh, bci, CompLevel_simple, thread); + } + return; + } if (bci != InvocationEntryBci && mh->is_not_osr_compilable(level)) { return; } if (!CompileBroker::compilation_is_in_queue(mh)) { if (PrintTieredEvents) {
src/hotspot/share/runtime/tieredThresholdPolicy.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File