hotspot/src/share/vm/oops/cpCache.cpp
changeset 30289 10b7b61d759a
parent 29701 f638fc81a3d0
child 31592 43f48e165466
equal deleted inserted replaced
30288:476c276de939 30289:10b7b61d759a
   604 
   604 
   605 #if INCLUDE_JVMTI
   605 #if INCLUDE_JVMTI
   606 // RedefineClasses() API support:
   606 // RedefineClasses() API support:
   607 // If any entry of this ConstantPoolCache points to any of
   607 // If any entry of this ConstantPoolCache points to any of
   608 // old_methods, replace it with the corresponding new_method.
   608 // old_methods, replace it with the corresponding new_method.
   609 void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new_methods,
       
   610                                               int methods_length, bool * trace_name_printed) {
       
   611 
       
   612   if (methods_length == 0) {
       
   613     // nothing to do if there are no methods
       
   614     return;
       
   615   }
       
   616 
       
   617   // get shorthand for the interesting class
       
   618   Klass* old_holder = old_methods[0]->method_holder();
       
   619 
       
   620   for (int i = 0; i < length(); i++) {
       
   621     if (entry_at(i)->get_interesting_method_entry(old_holder) == NULL) {
       
   622       // skip uninteresting methods
       
   623       continue;
       
   624     }
       
   625 
       
   626     // The ConstantPoolCache contains entries for several different
       
   627     // things, but we only care about methods. In fact, we only care
       
   628     // about methods in the same class as the one that contains the
       
   629     // old_methods. At this point, we have an interesting entry.
       
   630 
       
   631     for (int j = 0; j < methods_length; j++) {
       
   632       Method* old_method = old_methods[j];
       
   633       Method* new_method = new_methods[j];
       
   634 
       
   635       if (entry_at(i)->adjust_method_entry(old_method, new_method,
       
   636           trace_name_printed)) {
       
   637         // current old_method matched this entry and we updated it so
       
   638         // break out and get to the next interesting entry if there one
       
   639         break;
       
   640       }
       
   641     }
       
   642   }
       
   643 }
       
   644 
       
   645 // If any entry of this ConstantPoolCache points to any of
       
   646 // old_methods, replace it with the corresponding new_method.
       
   647 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
   609 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
   648   for (int i = 0; i < length(); i++) {
   610   for (int i = 0; i < length(); i++) {
   649     ConstantPoolCacheEntry* entry = entry_at(i);
   611     ConstantPoolCacheEntry* entry = entry_at(i);
   650     Method* old_method = entry->get_interesting_method_entry(holder);
   612     Method* old_method = entry->get_interesting_method_entry(holder);
   651     if (old_method == NULL || !old_method->is_old()) {
   613     if (old_method == NULL || !old_method->is_old()) {