< prev index next >

src/hotspot/share/code/nmethod.cpp


1265     assert(!found, "osr nmethod should have been invalidated");                                                                      
1266   }                                                                                                                                  
1267 #endif                                                                                                                               
1268 
1269   // When the nmethod becomes zombie it is no longer alive so the                                                                    
1270   // dependencies must be flushed.  nmethods in the not_entrant                                                                      
1271   // state will be flushed later when the transition to zombie                                                                       
1272   // happens or they get unloaded.                                                                                                   
1273   if (state == zombie) {                                                                                                             
1274     {                                                                                                                                
1275       // Flushing dependencies must be done before any possible                                                                      
1276       // safepoint can sneak in, otherwise the oops used by the                                                                      
1277       // dependency logic could have become stale.                                                                                   
1278       MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);                                                             
1279       if (nmethod_needs_unregister) {                                                                                                
1280         Universe::heap()->unregister_nmethod(this);                                                                                  
1281       }                                                                                                                              
1282       flush_dependencies(/*delete_immediately*/true);                                                                                
1283     }                                                                                                                                
1284 
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
1285     // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload                                                           
1286     // event and it hasn't already been reported for this nmethod then                                                               
1287     // report it now. The event may have been reported earlier if the GC                                                             
1288     // marked it for unloading). JvmtiDeferredEventQueue support means                                                               
1289     // we no longer go to a safepoint here.                                                                                          
1290     post_compiled_method_unload();                                                                                                   
1291 
1292 #ifdef ASSERT                                                                                                                        
1293     // It's no longer safe to access the oops section since zombie                                                                   
1294     // nmethods aren't scanned for GC.                                                                                               
1295     _oops_are_stale = true;                                                                                                          
1296 #endif                                                                                                                               
1297      // the Method may be reclaimed by class unloading now that the                                                                  
1298      // nmethod is in zombie state                                                                                                   
1299     set_method(NULL);                                                                                                                
1300   } else {                                                                                                                           
1301     assert(state == not_entrant, "other cases may need to be handled differently");                                                  
1302   }                                                                                                                                  
1303 

1265     assert(!found, "osr nmethod should have been invalidated");
1266   }
1267 #endif
1268 
1269   // When the nmethod becomes zombie it is no longer alive so the
1270   // dependencies must be flushed.  nmethods in the not_entrant
1271   // state will be flushed later when the transition to zombie
1272   // happens or they get unloaded.
1273   if (state == zombie) {
1274     {
1275       // Flushing dependencies must be done before any possible
1276       // safepoint can sneak in, otherwise the oops used by the
1277       // dependency logic could have become stale.
1278       MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
1279       if (nmethod_needs_unregister) {
1280         Universe::heap()->unregister_nmethod(this);
1281       }
1282       flush_dependencies(/*delete_immediately*/true);
1283     }
1284 
1285     // Clear ICStubs to prevent back patching stubs of zombie or flushed
1286     // nmethods during the next safepoint (see ICStub::finalize).
1287     {
1288       CompiledICLocker ml(this);
1289       clear_ic_stubs();
1290     }
1291 
1292     // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload
1293     // event and it hasn't already been reported for this nmethod then
1294     // report it now. The event may have been reported earlier if the GC
1295     // marked it for unloading). JvmtiDeferredEventQueue support means
1296     // we no longer go to a safepoint here.
1297     post_compiled_method_unload();
1298 
1299 #ifdef ASSERT
1300     // It's no longer safe to access the oops section since zombie
1301     // nmethods aren't scanned for GC.
1302     _oops_are_stale = true;
1303 #endif
1304      // the Method may be reclaimed by class unloading now that the
1305      // nmethod is in zombie state
1306     set_method(NULL);
1307   } else {
1308     assert(state == not_entrant, "other cases may need to be handled differently");
1309   }
1310 
< prev index next >