src/hotspot/share/gc/z/zNMethodTable.cpp
changeset 53282 cb7fff9105a8
parent 52939 9a8585f60c32
child 53500 f618cfbaf35b
equal deleted inserted replaced
53281:672b629e1f72 53282:cb7fff9105a8
   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);