< prev index next >

src/share/vm/code/nmethod.cpp

Print this page

        

*** 1329,1339 **** p2i(this), p2i(_method), p2i(cause)); 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_osr_method(); } // 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 --- 1329,1339 ---- p2i(this), p2i(_method), p2i(cause)); 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() && is_in_use()) { invalidate_osr_method(); } // 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
*** 1385,1394 **** --- 1385,1396 ---- NMethodSweeper::report_state_change(this); } void nmethod::invalidate_osr_method() { assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod"); + // Make sure this is invoked only once + assert(is_in_use(), "osr nmethod should be in use"); // Remove from list of active nmethods if (method() != NULL) method()->method_holder()->remove_osr_nmethod(this); }
*** 1436,1446 **** { // 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. --- 1438,1448 ---- { // 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() && is_in_use()) { // this effectively makes the osr nmethod not entrant invalidate_osr_method(); } // Enter critical section. Does not block for safepoint.
*** 1508,1518 **** // 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) { { ! // Flushing dependecies must be done before any possible // safepoint can sneak in, otherwise the oops used by the // dependency logic could have become stale. MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); if (nmethod_needs_unregister) { Universe::heap()->unregister_nmethod(this); --- 1510,1520 ---- // 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) { { ! // Flushing dependencies must be done before any possible // safepoint can sneak in, otherwise the oops used by the // dependency logic could have become stale. MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); if (nmethod_needs_unregister) { Universe::heap()->unregister_nmethod(this);
*** 1524,1534 **** flush_dependencies(NULL); } // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload // event and it hasn't already been reported for this nmethod then ! // report it now. The event may have been reported earilier if the GC // marked it for unloading). JvmtiDeferredEventQueue support means // we no longer go to a safepoint here. post_compiled_method_unload(); #ifdef ASSERT --- 1526,1536 ---- flush_dependencies(NULL); } // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload // event and it hasn't already been reported for this nmethod then ! // report it now. The event may have been reported earlier if the GC // marked it for unloading). JvmtiDeferredEventQueue support means // we no longer go to a safepoint here. post_compiled_method_unload(); #ifdef ASSERT
*** 1552,1573 **** return true; } void nmethod::flush() { // Note that there are no valid oops in the nmethod anymore. ! assert(is_zombie() || (is_osr_method() && is_unloaded()), "must be a zombie method"); ! assert(is_marked_for_reclamation() || (is_osr_method() && is_unloaded()), "must be marked for reclamation"); assert (!is_locked_by_vm(), "locked methods shouldn't be flushed"); assert_locked_or_safepoint(CodeCache_lock); // completely deallocate this method Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, p2i(this)); if (PrintMethodFlushing) { ! tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb", ! _compile_id, p2i(this), CodeCache::blob_count(), CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); } // We need to deallocate any ExceptionCache data. // Note that we do not need to grab the nmethod lock for this, it --- 1554,1577 ---- return true; } void nmethod::flush() { // Note that there are no valid oops in the nmethod anymore. ! assert(!is_osr_method() || is_unloaded() || is_zombie(), ! "osr nmethod must be unloaded or zombie before flushing"); ! assert(is_zombie() || is_osr_method(), "must be a zombie method"); ! assert(is_marked_for_reclamation() || is_osr_method(), "must be marked for reclamation"); assert (!is_locked_by_vm(), "locked methods shouldn't be flushed"); assert_locked_or_safepoint(CodeCache_lock); // completely deallocate this method Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, p2i(this)); if (PrintMethodFlushing) { ! tty->print_cr("*flushing %s nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT "/Free CodeCache:" SIZE_FORMAT "Kb", ! is_osr_method() ? "osr" : "",_compile_id, p2i(this), CodeCache::blob_count(), CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024); } // We need to deallocate any ExceptionCache data. // Note that we do not need to grab the nmethod lock for this, it
*** 2915,2928 **** if (WizardMode) { tty->print("((nmethod*) " INTPTR_FORMAT ") ", p2i(this)); tty->print(" for method " INTPTR_FORMAT , p2i(method())); tty->print(" { "); ! if (is_in_use()) tty->print("in_use "); ! if (is_not_entrant()) tty->print("not_entrant "); ! if (is_zombie()) tty->print("zombie "); ! if (is_unloaded()) tty->print("unloaded "); if (on_scavenge_root_list()) tty->print("scavenge_root "); tty->print_cr("}:"); } if (size () > 0) tty->print_cr(" total in heap [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", p2i(this), --- 2919,2929 ---- if (WizardMode) { tty->print("((nmethod*) " INTPTR_FORMAT ") ", p2i(this)); tty->print(" for method " INTPTR_FORMAT , p2i(method())); tty->print(" { "); ! tty->print_cr("%s ", state()); if (on_scavenge_root_list()) tty->print("scavenge_root "); tty->print_cr("}:"); } if (size () > 0) tty->print_cr(" total in heap [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", p2i(this),
< prev index next >