hotspot/src/share/vm/code/nmethod.cpp
changeset 37289 9989add27bf4
parent 36844 ce97bc269a80
child 37296 613278eb2a1e
equal deleted inserted replaced
37286:67b04a68b881 37289:9989add27bf4
  1136       ic->clear_ic_stub();
  1136       ic->clear_ic_stub();
  1137     }
  1137     }
  1138   }
  1138   }
  1139 }
  1139 }
  1140 
  1140 
  1141 
  1141 void nmethod::cleanup_inline_caches(bool clean_all/*=false*/) {
  1142 void nmethod::cleanup_inline_caches() {
       
  1143   assert_locked_or_safepoint(CompiledIC_lock);
  1142   assert_locked_or_safepoint(CompiledIC_lock);
  1144 
  1143 
  1145   // If the method is not entrant or zombie then a JMP is plastered over the
  1144   // If the method is not entrant or zombie then a JMP is plastered over the
  1146   // first few bytes.  If an oop in the old code was there, that oop
  1145   // first few bytes.  If an oop in the old code was there, that oop
  1147   // should not get GC'd.  Skip the first few bytes of oops on
  1146   // should not get GC'd.  Skip the first few bytes of oops on
  1167         // Ok, to lookup references to zombies here
  1166         // Ok, to lookup references to zombies here
  1168         CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
  1167         CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
  1169         if( cb != NULL && cb->is_nmethod() ) {
  1168         if( cb != NULL && cb->is_nmethod() ) {
  1170           nmethod* nm = (nmethod*)cb;
  1169           nmethod* nm = (nmethod*)cb;
  1171           // Clean inline caches pointing to zombie, non-entrant and unloaded methods
  1170           // Clean inline caches pointing to zombie, non-entrant and unloaded methods
  1172           if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(is_alive());
  1171           if (clean_all || !nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(is_alive());
  1173         }
  1172         }
  1174         break;
  1173         break;
  1175       }
  1174       }
  1176       case relocInfo::static_call_type: {
  1175       case relocInfo::static_call_type: {
  1177         CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
  1176         CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
  1178         CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
  1177         CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
  1179         if( cb != NULL && cb->is_nmethod() ) {
  1178         if( cb != NULL && cb->is_nmethod() ) {
  1180           nmethod* nm = (nmethod*)cb;
  1179           nmethod* nm = (nmethod*)cb;
  1181           // Clean inline caches pointing to zombie, non-entrant and unloaded methods
  1180           // Clean inline caches pointing to zombie, non-entrant and unloaded methods
  1182           if (!nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean();
  1181           if (clean_all || !nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean();
  1183         }
  1182         }
  1184         break;
  1183         break;
  1185       }
  1184       }
  1186     }
  1185     }
  1187   }
  1186   }