src/hotspot/share/code/codeCache.cpp
changeset 54901 631d51796dbf
parent 54786 ebf733a324d4
child 54983 81becad91321
equal deleted inserted replaced
54900:e9f5e06a0dd7 54901:631d51796dbf
  1053   }
  1053   }
  1054 }
  1054 }
  1055 
  1055 
  1056 // Remove this method when zombied or unloaded.
  1056 // Remove this method when zombied or unloaded.
  1057 void CodeCache::unregister_old_nmethod(CompiledMethod* c) {
  1057 void CodeCache::unregister_old_nmethod(CompiledMethod* c) {
  1058   assert_locked_or_safepoint(CodeCache_lock);
  1058   assert_lock_strong(CodeCache_lock);
  1059   if (old_compiled_method_table != NULL) {
  1059   if (old_compiled_method_table != NULL) {
  1060     int index = old_compiled_method_table->find(c);
  1060     int index = old_compiled_method_table->find(c);
  1061     if (index != -1) {
  1061     if (index != -1) {
  1062       old_compiled_method_table->delete_at(index);
  1062       old_compiled_method_table->delete_at(index);
  1063     }
  1063     }
  1068   // Walk old method table and mark those on stack.
  1068   // Walk old method table and mark those on stack.
  1069   int length = 0;
  1069   int length = 0;
  1070   if (old_compiled_method_table != NULL) {
  1070   if (old_compiled_method_table != NULL) {
  1071     length = old_compiled_method_table->length();
  1071     length = old_compiled_method_table->length();
  1072     for (int i = 0; i < length; i++) {
  1072     for (int i = 0; i < length; i++) {
  1073       old_compiled_method_table->at(i)->metadata_do(f);
  1073       CompiledMethod* cm = old_compiled_method_table->at(i);
       
  1074       // Only walk alive nmethods, the dead ones will get removed by the sweeper.
       
  1075       if (cm->is_alive()) {
       
  1076         old_compiled_method_table->at(i)->metadata_do(f);
       
  1077       }
  1074     }
  1078     }
  1075   }
  1079   }
  1076   log_debug(redefine, class, nmethod)("Walked %d nmethods for mark_on_stack", length);
  1080   log_debug(redefine, class, nmethod)("Walked %d nmethods for mark_on_stack", length);
  1077 }
  1081 }
  1078 
  1082