src/hotspot/share/code/codeCache.cpp
changeset 54150 5529640c5f67
parent 54122 4b1426ed1c44
child 54355 f226ab0b7f21
equal deleted inserted replaced
54149:c61f09122d3b 54150:5529640c5f67
   665   while(iter.next()) {
   665   while(iter.next()) {
   666     f(iter.method());
   666     f(iter.method());
   667   }
   667   }
   668 }
   668 }
   669 
   669 
   670 void CodeCache::metadata_do(void f(Metadata* m)) {
   670 void CodeCache::metadata_do(MetadataClosure* f) {
   671   assert_locked_or_safepoint(CodeCache_lock);
   671   assert_locked_or_safepoint(CodeCache_lock);
   672   NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
   672   NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
   673   while(iter.next()) {
   673   while(iter.next()) {
   674     iter.method()->metadata_do(f);
   674     iter.method()->metadata_do(f);
   675   }
   675   }
  1059     CompiledMethod* nm = iter.method();
  1059     CompiledMethod* nm = iter.method();
  1060     if (nm->is_marked_for_deoptimization()) {
  1060     if (nm->is_marked_for_deoptimization()) {
  1061       // ...Already marked in the previous pass; count it here.
  1061       // ...Already marked in the previous pass; count it here.
  1062       // Also counts AOT compiled methods, already marked.
  1062       // Also counts AOT compiled methods, already marked.
  1063       number_of_marked_CodeBlobs++;
  1063       number_of_marked_CodeBlobs++;
  1064     } else if (nm->is_evol_dependent()) {
  1064     } else if (nm->has_evol_metadata()) {
  1065       ResourceMark rm;
  1065       ResourceMark rm;
  1066       nm->mark_for_deoptimization();
  1066       nm->mark_for_deoptimization();
  1067       number_of_marked_CodeBlobs++;
  1067       number_of_marked_CodeBlobs++;
  1068     } else  {
  1068     } else {
  1069       // flush caches in case they refer to a redefined Method*
  1069       // Inline caches that refer to an nmethod are deoptimized already, because
  1070       nm->clear_inline_caches();
  1070       // the Method* is walked in the metadata section of the nmethod.
       
  1071       assert(!nm->is_evol_dependent(), "should no longer be necessary");
  1071     }
  1072     }
  1072   }
  1073   }
  1073 
  1074 
  1074   // return total count of nmethods marked for deoptimization, if zero the caller
  1075   // return total count of nmethods marked for deoptimization, if zero the caller
  1075   // can skip deoptimization
  1076   // can skip deoptimization