134 // If it is first time, we see nmethod then we mark it. Otherwise, |
134 // If it is first time, we see nmethod then we mark it. Otherwise, |
135 // we reclame it. When we have seen a zombie method twice, we know that |
135 // we reclame it. When we have seen a zombie method twice, we know that |
136 // there are no inline caches that referes to it. |
136 // there are no inline caches that referes to it. |
137 if (nm->is_marked_for_reclamation()) { |
137 if (nm->is_marked_for_reclamation()) { |
138 assert(!nm->is_locked_by_vm(), "must not flush locked nmethods"); |
138 assert(!nm->is_locked_by_vm(), "must not flush locked nmethods"); |
|
139 if (PrintMethodFlushing && Verbose) { |
|
140 tty->print_cr("### Nmethod 0x%x (marked for reclamation) being flushed", nm); |
|
141 } |
139 nm->flush(); |
142 nm->flush(); |
140 } else { |
143 } else { |
|
144 if (PrintMethodFlushing && Verbose) { |
|
145 tty->print_cr("### Nmethod 0x%x (zombie) being marked for reclamation", nm); |
|
146 } |
141 nm->mark_for_reclamation(); |
147 nm->mark_for_reclamation(); |
142 _rescan = true; |
148 _rescan = true; |
143 } |
149 } |
144 } else if (nm->is_not_entrant()) { |
150 } else if (nm->is_not_entrant()) { |
145 // If there is no current activations of this method on the |
151 // If there is no current activations of this method on the |
146 // stack we can safely convert it to a zombie method |
152 // stack we can safely convert it to a zombie method |
147 if (nm->can_not_entrant_be_converted()) { |
153 if (nm->can_not_entrant_be_converted()) { |
|
154 if (PrintMethodFlushing && Verbose) { |
|
155 tty->print_cr("### Nmethod 0x%x (not entrant) being made zombie", nm); |
|
156 } |
148 nm->make_zombie(); |
157 nm->make_zombie(); |
149 _rescan = true; |
158 _rescan = true; |
150 } else { |
159 } else { |
151 // Still alive, clean up its inline caches |
160 // Still alive, clean up its inline caches |
152 nm->cleanup_inline_caches(); |
161 nm->cleanup_inline_caches(); |
155 // long time we don't want to keep rescanning at every safepoint. |
164 // long time we don't want to keep rescanning at every safepoint. |
156 _not_entrant_seen_on_stack++; |
165 _not_entrant_seen_on_stack++; |
157 } |
166 } |
158 } else if (nm->is_unloaded()) { |
167 } else if (nm->is_unloaded()) { |
159 // Unloaded code, just make it a zombie |
168 // Unloaded code, just make it a zombie |
160 if (nm->is_osr_only_method()) { |
169 if (PrintMethodFlushing && Verbose) |
|
170 tty->print_cr("### Nmethod 0x%x (unloaded) being made zombie", nm); |
|
171 if (nm->is_osr_method()) { |
161 // No inline caches will ever point to osr methods, so we can just remove it |
172 // No inline caches will ever point to osr methods, so we can just remove it |
162 nm->flush(); |
173 nm->flush(); |
163 } else { |
174 } else { |
164 nm->make_zombie(); |
175 nm->make_zombie(); |
165 _rescan = true; |
176 _rescan = true; |