1.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp Fri Oct 31 11:13:41 2014 -0700 1.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp Fri Oct 31 12:16:20 2014 +0100 1.3 @@ -196,7 +196,6 @@ 1.4 // Don't trigger other compiles in testing mode 1.5 return NULL; 1.6 } 1.7 - nmethod *osr_nm = NULL; 1.8 1.9 handle_counter_overflow(method()); 1.10 if (method() != inlinee()) { 1.11 @@ -210,14 +209,16 @@ 1.12 if (bci == InvocationEntryBci) { 1.13 method_invocation_event(method, inlinee, comp_level, nm, thread); 1.14 } else { 1.15 + // method == inlinee if the event originated in the main method 1.16 method_back_branch_event(method, inlinee, bci, comp_level, nm, thread); 1.17 - // method == inlinee if the event originated in the main method 1.18 - int highest_level = inlinee->highest_osr_comp_level(); 1.19 - if (highest_level > comp_level) { 1.20 - osr_nm = inlinee->lookup_osr_nmethod_for(bci, highest_level, false); 1.21 + // Check if event led to a higher level OSR compilation 1.22 + nmethod* osr_nm = inlinee->lookup_osr_nmethod_for(bci, comp_level, false); 1.23 + if (osr_nm != NULL && osr_nm->comp_level() > comp_level) { 1.24 + // Perform OSR with new nmethod 1.25 + return osr_nm; 1.26 } 1.27 } 1.28 - return osr_nm; 1.29 + return NULL; 1.30 } 1.31 1.32 // Check if the method can be compiled, change level if necessary