< prev index next >

src/share/vm/runtime/sweeper.cpp

Print this page




 596   if (nm->is_zombie()) {
 597     // All inline caches that referred to this nmethod were cleaned in the
 598     // previous sweeper cycle. Now flush the nmethod from the code cache.
 599     assert(!nm->is_locked_by_vm(), "must not flush locked nmethods");
 600     release_nmethod(nm);
 601     assert(result == None, "sanity");
 602     result = Flushed;
 603   } else if (nm->is_not_entrant()) {
 604     // If there are no current activations of this method on the
 605     // stack we can safely convert it to a zombie method
 606     if (nm->can_convert_to_zombie()) {
 607       // Clear ICStubs to prevent back patching stubs of zombie or flushed
 608       // nmethods during the next safepoint (see ICStub::finalize).
 609       {
 610         MutexLocker cl(CompiledIC_lock);
 611         nm->clear_ic_stubs();
 612       }
 613       // Code cache state change is tracked in make_zombie()
 614       nm->make_zombie();
 615       SWEEP(nm);
 616       if (nm->is_osr_method()) {



 617         // No inline caches will ever point to osr methods, so we can just remove it.
 618         // Make sure that we unregistered the nmethod with the heap and flushed all
 619         // dependencies before removing the nmethod (done in make_zombie()).
 620         assert(nm->is_zombie(), "nmethod must be unregistered");
 621         release_nmethod(nm);
 622         assert(result == None, "sanity");
 623         result = Flushed;
 624       } else {
 625         assert(result == None, "sanity");
 626         result = MadeZombie;
 627         assert(nm->is_zombie(), "nmethod must be zombie");
 628       }
 629     } else {
 630       // Still alive, clean up its inline caches
 631       MutexLocker cl(CompiledIC_lock);
 632       nm->cleanup_inline_caches();
 633       SWEEP(nm);
 634     }
 635   } else if (nm->is_unloaded()) {
 636     // Code is unloaded, so there are no activations on the stack.




 596   if (nm->is_zombie()) {
 597     // All inline caches that referred to this nmethod were cleaned in the
 598     // previous sweeper cycle. Now flush the nmethod from the code cache.
 599     assert(!nm->is_locked_by_vm(), "must not flush locked nmethods");
 600     release_nmethod(nm);
 601     assert(result == None, "sanity");
 602     result = Flushed;
 603   } else if (nm->is_not_entrant()) {
 604     // If there are no current activations of this method on the
 605     // stack we can safely convert it to a zombie method
 606     if (nm->can_convert_to_zombie()) {
 607       // Clear ICStubs to prevent back patching stubs of zombie or flushed
 608       // nmethods during the next safepoint (see ICStub::finalize).
 609       {
 610         MutexLocker cl(CompiledIC_lock);
 611         nm->clear_ic_stubs();
 612       }
 613       // Code cache state change is tracked in make_zombie()
 614       nm->make_zombie();
 615       SWEEP(nm);
 616       // The nmethod may have been locked by JVMTI after being made zombie (see
 617       // JvmtiDeferredEvent::compiled_method_unload_event()). If so, we cannot
 618       // flush the osr nmethod directly but have to wait for a later sweeper cycle.
 619       if (nm->is_osr_method() && !nm->is_locked_by_vm()) {
 620         // No inline caches will ever point to osr methods, so we can just remove it.
 621         // Make sure that we unregistered the nmethod with the heap and flushed all
 622         // dependencies before removing the nmethod (done in make_zombie()).
 623         assert(nm->is_zombie(), "nmethod must be unregistered");
 624         release_nmethod(nm);
 625         assert(result == None, "sanity");
 626         result = Flushed;
 627       } else {
 628         assert(result == None, "sanity");
 629         result = MadeZombie;
 630         assert(nm->is_zombie(), "nmethod must be zombie");
 631       }
 632     } else {
 633       // Still alive, clean up its inline caches
 634       MutexLocker cl(CompiledIC_lock);
 635       nm->cleanup_inline_caches();
 636       SWEEP(nm);
 637     }
 638   } else if (nm->is_unloaded()) {
 639     // Code is unloaded, so there are no activations on the stack.


< prev index next >