src/share/vm/oops/instanceKlass.cpp

Print this page




2776     }
2777 
2778     Klass* ik = ioe->interface_klass();
2779     if (ik == holder) break;
2780   }
2781 
2782   itableMethodEntry* ime = ioe->first_method_entry(this);
2783   Method* m = ime[index].method();
2784   if (m == NULL) {
2785     THROW_NULL(vmSymbols::java_lang_AbstractMethodError());
2786   }
2787   return m;
2788 }
2789 
2790 
2791 #if INCLUDE_JVMTI
2792 // update default_methods for redefineclasses for methods that are
2793 // not yet in the vtable due to concurrent subclass define and superinterface
2794 // redefinition
2795 // Note: those in the vtable, should have been updated via adjust_method_entries
2796 void InstanceKlass::adjust_default_methods(Method** old_methods, Method** new_methods,
2797                                            int methods_length, bool* trace_name_printed) {
2798   // search the default_methods for uses of either obsolete or EMCP methods
2799   if (default_methods() != NULL) {
2800     for (int j = 0; j < methods_length; j++) {
2801       Method* old_method = old_methods[j];
2802       Method* new_method = new_methods[j];
2803 
2804       for (int index = 0; index < default_methods()->length(); index ++) {
2805         if (default_methods()->at(index) == old_method) {










2806           default_methods()->at_put(index, new_method);
2807           if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
2808             if (!(*trace_name_printed)) {
2809               // RC_TRACE_MESG macro has an embedded ResourceMark
2810               RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
2811                              external_name(),
2812                              old_method->method_holder()->external_name()));
2813               *trace_name_printed = true;
2814             }
2815             RC_TRACE(0x00100000, ("default method update: %s(%s) ",
2816                                   new_method->name()->as_C_string(),
2817                                   new_method->signature()->as_C_string()));
2818           }
2819         }
2820       }
2821     }
2822   }
2823 }
2824 #endif // INCLUDE_JVMTI
2825 
2826 // On-stack replacement stuff
2827 void InstanceKlass::add_osr_nmethod(nmethod* n) {
2828   // only one compilation can be active
2829   {
2830     // This is a short non-blocking critical region, so the no safepoint check is ok.
2831     MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
2832     assert(n->is_osr_method(), "wrong kind of nmethod");
2833     n->set_osr_link(osr_nmethods_head());
2834     set_osr_nmethods_head(n);
2835     // Raise the highest osr level if necessary
2836     if (TieredCompilation) {
2837       Method* m = n->method();
2838       m->set_highest_osr_comp_level(MAX2(m->highest_osr_comp_level(), n->comp_level()));
2839     }
2840   }
2841 




2776     }
2777 
2778     Klass* ik = ioe->interface_klass();
2779     if (ik == holder) break;
2780   }
2781 
2782   itableMethodEntry* ime = ioe->first_method_entry(this);
2783   Method* m = ime[index].method();
2784   if (m == NULL) {
2785     THROW_NULL(vmSymbols::java_lang_AbstractMethodError());
2786   }
2787   return m;
2788 }
2789 
2790 
2791 #if INCLUDE_JVMTI
2792 // update default_methods for redefineclasses for methods that are
2793 // not yet in the vtable due to concurrent subclass define and superinterface
2794 // redefinition
2795 // Note: those in the vtable, should have been updated via adjust_method_entries
2796 void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) {

2797   // search the default_methods for uses of either obsolete or EMCP methods
2798   if (default_methods() != NULL) {




2799     for (int index = 0; index < default_methods()->length(); index ++) {
2800       Method* old_method = default_methods()->at(index);
2801       if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
2802         continue; // skip uninteresting entries
2803       }
2804       assert(!old_method->is_deleted(), "default methods may not be deleted");
2805 
2806       Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
2807 
2808       assert(new_method != NULL, "method_with_idnum() should not be NULL");
2809       assert(old_method != new_method, "sanity check");
2810 
2811       default_methods()->at_put(index, new_method);
2812       if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
2813         if (!(*trace_name_printed)) {
2814           // RC_TRACE_MESG macro has an embedded ResourceMark
2815           RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
2816                          external_name(),
2817                          old_method->method_holder()->external_name()));
2818           *trace_name_printed = true;
2819         }
2820         RC_TRACE(0x00100000, ("default method update: %s(%s) ",
2821                               new_method->name()->as_C_string(),
2822                               new_method->signature()->as_C_string()));
2823       }
2824     }


2825   }
2826 }
2827 #endif // INCLUDE_JVMTI
2828 
2829 // On-stack replacement stuff
2830 void InstanceKlass::add_osr_nmethod(nmethod* n) {
2831   // only one compilation can be active
2832   {
2833     // This is a short non-blocking critical region, so the no safepoint check is ok.
2834     MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
2835     assert(n->is_osr_method(), "wrong kind of nmethod");
2836     n->set_osr_link(osr_nmethods_head());
2837     set_osr_nmethods_head(n);
2838     // Raise the highest osr level if necessary
2839     if (TieredCompilation) {
2840       Method* m = n->method();
2841       m->set_highest_osr_comp_level(MAX2(m->highest_osr_comp_level(), n->comp_level()));
2842     }
2843   }
2844