904 IRT_END 905 906 //------------------------------------------------------------------------------------------------------------------------ 907 // Miscellaneous 908 909 910 nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, address branch_bcp) { 911 nmethod* nm = frequency_counter_overflow_inner(thread, branch_bcp); 912 assert(branch_bcp != NULL || nm == NULL, "always returns null for non OSR requests"); 913 if (branch_bcp != NULL && nm != NULL) { 914 // This was a successful request for an OSR nmethod. Because 915 // frequency_counter_overflow_inner ends with a safepoint check, 916 // nm could have been unloaded so look it up again. It's unsafe 917 // to examine nm directly since it might have been freed and used 918 // for something else. 919 LastFrameAccessor last_frame(thread); 920 Method* method = last_frame.method(); 921 int bci = method->bci_from(last_frame.bcp()); 922 nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false); 923 } 924 #ifndef PRODUCT 925 if (TraceOnStackReplacement) { 926 if (nm != NULL) { 927 tty->print("OSR entry @ pc: " INTPTR_FORMAT ": ", p2i(nm->osr_entry())); 928 nm->print(); 929 } 930 } 931 #endif 932 return nm; 933 } 934 935 IRT_ENTRY(nmethod*, 936 InterpreterRuntime::frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp)) 937 // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized 938 // flag, in case this method triggers classloading which will call into Java. 939 UnlockFlagSaver fs(thread); 940 941 LastFrameAccessor last_frame(thread); 942 assert(last_frame.is_interpreted_frame(), "must come from interpreter"); 943 methodHandle method(thread, last_frame.method()); | 904 IRT_END 905 906 //------------------------------------------------------------------------------------------------------------------------ 907 // Miscellaneous 908 909 910 nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, address branch_bcp) { 911 nmethod* nm = frequency_counter_overflow_inner(thread, branch_bcp); 912 assert(branch_bcp != NULL || nm == NULL, "always returns null for non OSR requests"); 913 if (branch_bcp != NULL && nm != NULL) { 914 // This was a successful request for an OSR nmethod. Because 915 // frequency_counter_overflow_inner ends with a safepoint check, 916 // nm could have been unloaded so look it up again. It's unsafe 917 // to examine nm directly since it might have been freed and used 918 // for something else. 919 LastFrameAccessor last_frame(thread); 920 Method* method = last_frame.method(); 921 int bci = method->bci_from(last_frame.bcp()); 922 nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false); 923 } 924 if (thread->is_interp_only_mode()) { 925 // Normally we never get an nm if is_interp_only_mode() is true, because 926 // policy()->event has a check for this and won't compile the method when 927 // true. However, it's possible for is_interp_only_mode() to become true 928 // during the compilation. We don't want to return the nm in that case 929 // because we want to continue to execute interpreted. 930 nm = NULL; 931 } 932 #ifndef PRODUCT 933 if (TraceOnStackReplacement) { 934 if (nm != NULL) { 935 tty->print("OSR entry @ pc: " INTPTR_FORMAT ": ", p2i(nm->osr_entry())); 936 nm->print(); 937 } 938 } 939 #endif 940 return nm; 941 } 942 943 IRT_ENTRY(nmethod*, 944 InterpreterRuntime::frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp)) 945 // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized 946 // flag, in case this method triggers classloading which will call into Java. 947 UnlockFlagSaver fs(thread); 948 949 LastFrameAccessor last_frame(thread); 950 assert(last_frame.is_interpreted_frame(), "must come from interpreter"); 951 methodHandle method(thread, last_frame.method()); |