601 if (PrintMethodFlushing && Verbose) { 602 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm); 603 } 604 nm->mark_for_reclamation(); 605 // Keep track of code cache state change 606 _bytes_changed += nm->total_size(); 607 SWEEP(nm); 608 assert(result == None, "sanity"); 609 result = MarkedForReclamation; 610 } 611 } else if (nm->is_not_entrant()) { 612 // If there are no current activations of this method on the 613 // stack we can safely convert it to a zombie method 614 if (nm->can_not_entrant_be_converted()) { 615 // Clear ICStubs to prevent back patching stubs of zombie or unloaded 616 // nmethods during the next safepoint (see ICStub::finalize). 617 { 618 MutexLocker cl(CompiledIC_lock); 619 nm->clear_ic_stubs(); 620 } 621 // Acquiring the CompiledIC_lock may block for a safepoint and set the 622 // nmethod to zombie (see 'CodeCache::make_marked_nmethods_zombies'). 623 // Check if nmethod is still non-entrant at this point. 624 if (nm->is_not_entrant()) { 625 if (PrintMethodFlushing && Verbose) { 626 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm); 627 } 628 // Code cache state change is tracked in make_zombie() 629 nm->make_zombie(); 630 SWEEP(nm); 631 assert(result == None, "sanity"); 632 result = MadeZombie; 633 } 634 assert(nm->is_zombie(), "nmethod must be zombie"); 635 } else { 636 // Still alive, clean up its inline caches 637 MutexLocker cl(CompiledIC_lock); 638 nm->cleanup_inline_caches(); 639 SWEEP(nm); 640 } 641 } else if (nm->is_unloaded()) { 642 // Unloaded code, just make it a zombie 643 if (PrintMethodFlushing && Verbose) { 644 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (unloaded) being made zombie", nm->compile_id(), nm); 645 } 646 if (nm->is_osr_method()) { 647 SWEEP(nm); 648 // No inline caches will ever point to osr methods, so we can just remove it 649 release_nmethod(nm); 650 assert(result == None, "sanity"); 651 result = Flushed; 652 } else { 653 // Code cache state change is tracked in make_zombie() | 601 if (PrintMethodFlushing && Verbose) { 602 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm); 603 } 604 nm->mark_for_reclamation(); 605 // Keep track of code cache state change 606 _bytes_changed += nm->total_size(); 607 SWEEP(nm); 608 assert(result == None, "sanity"); 609 result = MarkedForReclamation; 610 } 611 } else if (nm->is_not_entrant()) { 612 // If there are no current activations of this method on the 613 // stack we can safely convert it to a zombie method 614 if (nm->can_not_entrant_be_converted()) { 615 // Clear ICStubs to prevent back patching stubs of zombie or unloaded 616 // nmethods during the next safepoint (see ICStub::finalize). 617 { 618 MutexLocker cl(CompiledIC_lock); 619 nm->clear_ic_stubs(); 620 } 621 if (PrintMethodFlushing && Verbose) { 622 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm); 623 } 624 // Code cache state change is tracked in make_zombie() 625 nm->make_zombie(); 626 SWEEP(nm); 627 assert(result == None, "sanity"); 628 result = MadeZombie; 629 assert(nm->is_zombie(), "nmethod must be zombie"); 630 } else { 631 // Still alive, clean up its inline caches 632 MutexLocker cl(CompiledIC_lock); 633 nm->cleanup_inline_caches(); 634 SWEEP(nm); 635 } 636 } else if (nm->is_unloaded()) { 637 // Unloaded code, just make it a zombie 638 if (PrintMethodFlushing && Verbose) { 639 tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (unloaded) being made zombie", nm->compile_id(), nm); 640 } 641 if (nm->is_osr_method()) { 642 SWEEP(nm); 643 // No inline caches will ever point to osr methods, so we can just remove it 644 release_nmethod(nm); 645 assert(result == None, "sanity"); 646 result = Flushed; 647 } else { 648 // Code cache state change is tracked in make_zombie() |