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() 649 nm->make_zombie(); 650 SWEEP(nm); 651 assert(result == None, "sanity"); 652 result = MadeZombie; 653 } 654 } else { 655 possibly_flush(nm); 656 // Clean-up all inline caches that point to zombie/non-reentrant methods 657 MutexLocker cl(CompiledIC_lock); 658 nm->cleanup_inline_caches(); 659 SWEEP(nm); 660 } 661 return result; 662 } 663 664 665 void NMethodSweeper::possibly_flush(nmethod* nm) { 666 if (UseCodeCacheFlushing) { 667 if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) { | 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 { 649 // Clean ICs of unloaded nmethods as well because they may reference other 650 // unloaded nmethods that may be flushed earlier in the sweeper cycle. 651 MutexLocker cl(CompiledIC_lock); 652 nm->cleanup_inline_caches(); 653 } 654 // Code cache state change is tracked in make_zombie() 655 nm->make_zombie(); 656 SWEEP(nm); 657 assert(result == None, "sanity"); 658 result = MadeZombie; 659 } 660 } else { 661 possibly_flush(nm); 662 // Clean-up all inline caches that point to zombie/non-reentrant methods 663 MutexLocker cl(CompiledIC_lock); 664 nm->cleanup_inline_caches(); 665 SWEEP(nm); 666 } 667 return result; 668 } 669 670 671 void NMethodSweeper::possibly_flush(nmethod* nm) { 672 if (UseCodeCacheFlushing) { 673 if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) { |