1160 } |
1160 } |
1161 } |
1161 } |
1162 |
1162 |
1163 |
1163 |
1164 void nmethod::cleanup_inline_caches() { |
1164 void nmethod::cleanup_inline_caches() { |
1165 |
|
1166 assert_locked_or_safepoint(CompiledIC_lock); |
1165 assert_locked_or_safepoint(CompiledIC_lock); |
1167 |
1166 |
1168 // If the method is not entrant or zombie then a JMP is plastered over the |
1167 // If the method is not entrant or zombie then a JMP is plastered over the |
1169 // first few bytes. If an oop in the old code was there, that oop |
1168 // first few bytes. If an oop in the old code was there, that oop |
1170 // should not get GC'd. Skip the first few bytes of oops on |
1169 // should not get GC'd. Skip the first few bytes of oops on |
1176 // This means that the low_boundary is going to be a little too high. |
1175 // This means that the low_boundary is going to be a little too high. |
1177 // This shouldn't matter, since oops of non-entrant methods are never used. |
1176 // This shouldn't matter, since oops of non-entrant methods are never used. |
1178 // In fact, why are we bothering to look at oops in a non-entrant method?? |
1177 // In fact, why are we bothering to look at oops in a non-entrant method?? |
1179 } |
1178 } |
1180 |
1179 |
1181 // Find all calls in an nmethod, and clear the ones that points to zombie methods |
1180 // Find all calls in an nmethod and clear the ones that point to non-entrant, |
|
1181 // zombie and unloaded nmethods. |
1182 ResourceMark rm; |
1182 ResourceMark rm; |
1183 RelocIterator iter(this, low_boundary); |
1183 RelocIterator iter(this, low_boundary); |
1184 while(iter.next()) { |
1184 while(iter.next()) { |
1185 switch(iter.type()) { |
1185 switch(iter.type()) { |
1186 case relocInfo::virtual_call_type: |
1186 case relocInfo::virtual_call_type: |
1188 CompiledIC *ic = CompiledIC_at(&iter); |
1188 CompiledIC *ic = CompiledIC_at(&iter); |
1189 // Ok, to lookup references to zombies here |
1189 // Ok, to lookup references to zombies here |
1190 CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); |
1190 CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); |
1191 if( cb != NULL && cb->is_nmethod() ) { |
1191 if( cb != NULL && cb->is_nmethod() ) { |
1192 nmethod* nm = (nmethod*)cb; |
1192 nmethod* nm = (nmethod*)cb; |
1193 // Clean inline caches pointing to both zombie and not_entrant methods |
1193 // Clean inline caches pointing to zombie, non-entrant and unloaded methods |
1194 if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(); |
1194 if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(); |
1195 } |
1195 } |
1196 break; |
1196 break; |
1197 } |
1197 } |
1198 case relocInfo::static_call_type: { |
1198 case relocInfo::static_call_type: { |
1199 CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc()); |
1199 CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc()); |
1200 CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination()); |
1200 CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination()); |
1201 if( cb != NULL && cb->is_nmethod() ) { |
1201 if( cb != NULL && cb->is_nmethod() ) { |
1202 nmethod* nm = (nmethod*)cb; |
1202 nmethod* nm = (nmethod*)cb; |
1203 // Clean inline caches pointing to both zombie and not_entrant methods |
1203 // Clean inline caches pointing to zombie, non-entrant and unloaded methods |
1204 if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean(); |
1204 if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean(); |
1205 } |
1205 } |
1206 break; |
1206 break; |
1207 } |
1207 } |
1208 } |
1208 } |
2705 void nmethod::verify() { |
2705 void nmethod::verify() { |
2706 |
2706 |
2707 // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant |
2707 // Hmm. OSR methods can be deopted but not marked as zombie or not_entrant |
2708 // seems odd. |
2708 // seems odd. |
2709 |
2709 |
2710 if( is_zombie() || is_not_entrant() ) |
2710 if (is_zombie() || is_not_entrant() || is_unloaded()) |
2711 return; |
2711 return; |
2712 |
2712 |
2713 // Make sure all the entry points are correctly aligned for patching. |
2713 // Make sure all the entry points are correctly aligned for patching. |
2714 NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point()); |
2714 NativeJump::check_verified_entry_alignment(entry_point(), verified_entry_point()); |
2715 |
2715 |