< prev index next >

src/hotspot/share/runtime/sweeper.cpp


699     if (cm->is_alive() && !cm->is_unloading()) {                                                                                     
700       // Clean inline caches that point to zombie/non-entrant/unloaded nmethods                                                      
701       cm->cleanup_inline_caches(false);                                                                                              
702       SWEEP(cm);                                                                                                                     
703     }                                                                                                                                
704     return result;                                                                                                                   
705   }                                                                                                                                  
706 
707   if (cm->is_zombie()) {                                                                                                             
708     // All inline caches that referred to this nmethod were cleaned in the                                                           
709     // previous sweeper cycle. Now flush the nmethod from the code cache.                                                            
710     assert(!cm->is_locked_by_vm(), "must not flush locked Compiled Methods");                                                        
711     release_compiled_method(cm);                                                                                                     
712     assert(result == None, "sanity");                                                                                                
713     result = Flushed;                                                                                                                
714   } else if (cm->is_not_entrant()) {                                                                                                 
715     // If there are no current activations of this method on the                                                                     
716     // stack we can safely convert it to a zombie method                                                                             
717     OrderAccess::loadload(); // _stack_traversal_mark and _state                                                                     
718     if (cm->can_convert_to_zombie()) {                                                                                               
719       // Clear ICStubs to prevent back patching stubs of zombie or flushed                                                           
720       // nmethods during the next safepoint (see ICStub::finalize).                                                                  
721       {                                                                                                                              
722         CompiledICLocker ml(cm);                                                                                                     
723         cm->clear_ic_stubs();                                                                                                        
724       }                                                                                                                              
725       // Code cache state change is tracked in make_zombie()                                                                         
726       cm->make_zombie();                                                                                                             
727       SWEEP(cm);                                                                                                                     
728       // The nmethod may have been locked by JVMTI after being made zombie (see                                                      
729       // JvmtiDeferredEvent::compiled_method_unload_event()). If so, we cannot                                                       
730       // flush the osr nmethod directly but have to wait for a later sweeper cycle.                                                  
731       if (cm->is_osr_method() && !cm->is_locked_by_vm()) {                                                                           
732         // No inline caches will ever point to osr methods, so we can just remove it.                                                
733         // Make sure that we unregistered the nmethod with the heap and flushed all                                                  
734         // dependencies before removing the nmethod (done in make_zombie()).                                                         
735         assert(cm->is_zombie(), "nmethod must be unregistered");                                                                     
736         release_compiled_method(cm);                                                                                                 
737         assert(result == None, "sanity");                                                                                            
738         result = Flushed;                                                                                                            
739       } else {                                                                                                                       
740         assert(result == None, "sanity");                                                                                            
741         result = MadeZombie;                                                                                                         
742         assert(cm->is_zombie(), "nmethod must be zombie");                                                                           
743       }                                                                                                                              

699     if (cm->is_alive() && !cm->is_unloading()) {
700       // Clean inline caches that point to zombie/non-entrant/unloaded nmethods
701       cm->cleanup_inline_caches(false);
702       SWEEP(cm);
703     }
704     return result;
705   }
706 
707   if (cm->is_zombie()) {
708     // All inline caches that referred to this nmethod were cleaned in the
709     // previous sweeper cycle. Now flush the nmethod from the code cache.
710     assert(!cm->is_locked_by_vm(), "must not flush locked Compiled Methods");
711     release_compiled_method(cm);
712     assert(result == None, "sanity");
713     result = Flushed;
714   } else if (cm->is_not_entrant()) {
715     // If there are no current activations of this method on the
716     // stack we can safely convert it to a zombie method
717     OrderAccess::loadload(); // _stack_traversal_mark and _state
718     if (cm->can_convert_to_zombie()) {






719       // Code cache state change is tracked in make_zombie()
720       cm->make_zombie();
721       SWEEP(cm);
722       // The nmethod may have been locked by JVMTI after being made zombie (see
723       // JvmtiDeferredEvent::compiled_method_unload_event()). If so, we cannot
724       // flush the osr nmethod directly but have to wait for a later sweeper cycle.
725       if (cm->is_osr_method() && !cm->is_locked_by_vm()) {
726         // No inline caches will ever point to osr methods, so we can just remove it.
727         // Make sure that we unregistered the nmethod with the heap and flushed all
728         // dependencies before removing the nmethod (done in make_zombie()).
729         assert(cm->is_zombie(), "nmethod must be unregistered");
730         release_compiled_method(cm);
731         assert(result == None, "sanity");
732         result = Flushed;
733       } else {
734         assert(result == None, "sanity");
735         result = MadeZombie;
736         assert(cm->is_zombie(), "nmethod must be zombie");
737       }
< prev index next >