697 // Skip methods that are currently referenced by the VM |
697 // Skip methods that are currently referenced by the VM |
698 if (cm->is_locked_by_vm()) { |
698 if (cm->is_locked_by_vm()) { |
699 // But still remember to clean-up inline caches for alive nmethods |
699 // But still remember to clean-up inline caches for alive nmethods |
700 if (cm->is_alive() && !cm->is_unloading()) { |
700 if (cm->is_alive() && !cm->is_unloading()) { |
701 // Clean inline caches that point to zombie/non-entrant/unloaded nmethods |
701 // Clean inline caches that point to zombie/non-entrant/unloaded nmethods |
702 CompiledICLocker ml(cm); |
|
703 cm->cleanup_inline_caches(false); |
702 cm->cleanup_inline_caches(false); |
704 SWEEP(cm); |
703 SWEEP(cm); |
705 } |
704 } |
706 return result; |
705 return result; |
707 } |
706 } |
743 result = MadeZombie; |
742 result = MadeZombie; |
744 assert(cm->is_zombie(), "nmethod must be zombie"); |
743 assert(cm->is_zombie(), "nmethod must be zombie"); |
745 } |
744 } |
746 } else { |
745 } else { |
747 // Still alive, clean up its inline caches |
746 // Still alive, clean up its inline caches |
748 CompiledICLocker ml(cm); |
|
749 cm->cleanup_inline_caches(false); |
747 cm->cleanup_inline_caches(false); |
750 SWEEP(cm); |
748 SWEEP(cm); |
751 } |
749 } |
752 } else if (cm->is_unloaded()) { |
750 } else if (cm->is_unloaded()) { |
753 // Code is unloaded, so there are no activations on the stack. |
751 // Code is unloaded, so there are no activations on the stack. |
754 // Convert the nmethod to zombie or flush it directly in the OSR case. |
752 // Convert the nmethod to zombie or flush it directly in the OSR case. |
755 { |
753 |
756 // Clean ICs of unloaded nmethods as well because they may reference other |
754 // Clean ICs of unloaded nmethods as well because they may reference other |
757 // unloaded nmethods that may be flushed earlier in the sweeper cycle. |
755 // unloaded nmethods that may be flushed earlier in the sweeper cycle. |
758 CompiledICLocker ml(cm); |
756 cm->cleanup_inline_caches(false); |
759 cm->cleanup_inline_caches(false); |
|
760 } |
|
761 if (cm->is_osr_method()) { |
757 if (cm->is_osr_method()) { |
762 SWEEP(cm); |
758 SWEEP(cm); |
763 // No inline caches will ever point to osr methods, so we can just remove it |
759 // No inline caches will ever point to osr methods, so we can just remove it |
764 release_compiled_method(cm); |
760 release_compiled_method(cm); |
765 assert(result == None, "sanity"); |
761 assert(result == None, "sanity"); |