< prev index next >

src/share/vm/code/nmethod.cpp

Print this page

        

*** 1329,1340 **** --- 1329,1349 ---- if (!Universe::heap()->is_gc_active()) cause->klass()->print_on(log); } // Unlink the osr method, so we do not look this up again if (is_osr_method()) { + // Invalidate the osr nmethod only once + if (is_in_use()) { invalidate_osr_method(); } + #ifdef ASSERT + // Make sure osr nmethod is invalidated, i.e. not on the list + bool found = method()->method_holder()->remove_osr_nmethod(this); + assert(!found, "osr nmethod should have been invalidated"); + #endif + } + // If _method is already NULL the Method* is about to be unloaded, // so we don't have to break the cycle. Note that it is possible to // have the Method* live here, in case we unload the nmethod because // it is pointing to some oop (other than the Method*) being unloaded. if (_method != NULL) {
*** 1383,1402 **** NMethodSweeper::report_state_change(this); } void nmethod::invalidate_osr_method() { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); - #ifndef ASSERT - // Make sure osr nmethod is invalidated only once - if (!is_in_use()) { - return; - } - #endif // Remove from list of active nmethods if (method() != NULL) { ! bool removed = method()->method_holder()->remove_osr_nmethod(this); ! assert(!removed || is_in_use(), "unused osr nmethod should be invalidated"); } } void nmethod::log_state_change() const { if (LogCompilation) { --- 1392,1404 ---- NMethodSweeper::report_state_change(this); } void nmethod::invalidate_osr_method() { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); // Remove from list of active nmethods if (method() != NULL) { ! method()->method_holder()->remove_osr_nmethod(this); } } void nmethod::log_state_change() const { if (LogCompilation) {
*** 1441,1452 **** { // invalidate osr nmethod before acquiring the patching lock since // they both acquire leaf locks and we don't want a deadlock. // This logic is equivalent to the logic below for patching the ! // verified entry point of regular methods. ! if (is_osr_method()) { // this effectively makes the osr nmethod not entrant invalidate_osr_method(); } // Enter critical section. Does not block for safepoint. --- 1443,1455 ---- { // invalidate osr nmethod before acquiring the patching lock since // they both acquire leaf locks and we don't want a deadlock. // This logic is equivalent to the logic below for patching the ! // verified entry point of regular methods. We check that the ! // nmethod is in use to ensure that it is invalidated only once. ! if (is_osr_method() && is_in_use()) { // this effectively makes the osr nmethod not entrant invalidate_osr_method(); } // Enter critical section. Does not block for safepoint.
*** 1508,1517 **** --- 1511,1528 ---- HandleMark hm; method()->clear_code(); } } // leave critical region under Patching_lock + #ifdef ASSERT + if (is_osr_method()) { + // Make sure osr nmethod is invalidated, i.e. not on the list + bool found = method()->method_holder()->remove_osr_nmethod(this); + assert(!found, "osr nmethod should have been invalidated"); + } + #endif + // When the nmethod becomes zombie it is no longer alive so the // dependencies must be flushed. nmethods in the not_entrant // state will be flushed later when the transition to zombie // happens or they get unloaded. if (state == zombie) {
< prev index next >