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