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   }




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       Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
2806       assert(new_method != NULL, "method_with_idnum() should not be NULL");
2807       if (old_method != new_method) {
2808         default_methods()->at_put(index, new_method);
2809         if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
2810           if (!(*trace_name_printed)) {
2811             // RC_TRACE_MESG macro has an embedded ResourceMark
2812             RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
2813                            external_name(),
2814                            old_method->method_holder()->external_name()));
2815             *trace_name_printed = true;
2816           }
2817           RC_TRACE(0x00100000, ("default method update: %s(%s) ",
2818                                 new_method->name()->as_C_string(),
2819                                 new_method->signature()->as_C_string()));
2820         }
2821       }

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