1.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp Mon Aug 31 05:27:29 2009 -0700 1.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp Wed Sep 02 00:04:29 2009 -0700 1.3 @@ -849,8 +849,25 @@ 1.4 } 1.5 #endif // !PRODUCT 1.6 1.7 +nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, address branch_bcp) { 1.8 + nmethod* nm = frequency_counter_overflow_inner(thread, branch_bcp); 1.9 + assert(branch_bcp != NULL || nm == NULL, "always returns null for non OSR requests"); 1.10 + if (branch_bcp != NULL && nm != NULL) { 1.11 + // This was a successful request for an OSR nmethod. Because 1.12 + // frequency_counter_overflow_inner ends with a safepoint check, 1.13 + // nm could have been unloaded so look it up again. It's unsafe 1.14 + // to examine nm directly since it might have been freed and used 1.15 + // for something else. 1.16 + frame fr = thread->last_frame(); 1.17 + methodOop method = fr.interpreter_frame_method(); 1.18 + int bci = method->bci_from(fr.interpreter_frame_bcp()); 1.19 + nm = method->lookup_osr_nmethod_for(bci); 1.20 + } 1.21 + return nm; 1.22 +} 1.23 + 1.24 IRT_ENTRY(nmethod*, 1.25 - InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, address branch_bcp)) 1.26 + InterpreterRuntime::frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp)) 1.27 // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized 1.28 // flag, in case this method triggers classloading which will call into Java. 1.29 UnlockFlagSaver fs(thread); 1.30 @@ -923,7 +940,6 @@ 1.31 } 1.32 BiasedLocking::revoke(objects_to_revoke); 1.33 } 1.34 - 1.35 return osr_nm; 1.36 } 1.37 }