609 nmethod* const nm = entry.method(); |
609 nmethod* const nm = entry.method(); |
610 if (!nm->is_alive()) { |
610 if (!nm->is_alive()) { |
611 return; |
611 return; |
612 } |
612 } |
613 |
613 |
|
614 ZLocker<ZReentrantLock> locker(ZNMethodTable::lock_for_nmethod(nm)); |
|
615 |
614 if (nm->is_unloading()) { |
616 if (nm->is_unloading()) { |
615 // Unlinking of the dependencies must happen before the |
617 // Unlinking of the dependencies must happen before the |
616 // handshake separating unlink and purge. |
618 // handshake separating unlink and purge. |
617 nm->flush_dependencies(false /* delete_immediately */); |
619 nm->flush_dependencies(false /* delete_immediately */); |
|
620 |
|
621 // We don't need to take the lock when unlinking nmethods from |
|
622 // the Method, because it is only concurrently unlinked by |
|
623 // the entry barrier, which acquires the per nmethod lock. |
|
624 nm->unlink_from_method(false /* acquire_lock */); |
618 return; |
625 return; |
619 } |
626 } |
620 |
|
621 ZLocker<ZReentrantLock> locker(ZNMethodTable::lock_for_nmethod(nm)); |
|
622 |
627 |
623 // Heal oops and disarm |
628 // Heal oops and disarm |
624 ZNMethodOopClosure cl; |
629 ZNMethodOopClosure cl; |
625 ZNMethodTable::entry_oops_do(entry, &cl); |
630 ZNMethodTable::entry_oops_do(entry, &cl); |
626 ZNMethodTable::disarm_nmethod(nm); |
631 ZNMethodTable::disarm_nmethod(nm); |