src/share/vm/oops/instanceKlass.cpp

Print this page

        

@@ -2791,20 +2791,22 @@
 #if INCLUDE_JVMTI
 // update default_methods for redefineclasses for methods that are
 // not yet in the vtable due to concurrent subclass define and superinterface
 // redefinition
 // Note: those in the vtable, should have been updated via adjust_method_entries
-void InstanceKlass::adjust_default_methods(Method** old_methods, Method** new_methods,
-                                           int methods_length, bool* trace_name_printed) {
+void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) {
   // search the default_methods for uses of either obsolete or EMCP methods
   if (default_methods() != NULL) {
-    for (int j = 0; j < methods_length; j++) {
-      Method* old_method = old_methods[j];
-      Method* new_method = new_methods[j];
-
       for (int index = 0; index < default_methods()->length(); index ++) {
-        if (default_methods()->at(index) == old_method) {
+      Method* old_method = default_methods()->at(index);
+      if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+        continue; // skip uninteresting entries
+      }
+      assert(!old_method->is_deleted(), "default methods may not be deleted");
+      Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+      assert(new_method != NULL, "method_with_idnum() should not be NULL");
+      if (old_method != new_method) {
           default_methods()->at_put(index, new_method);
           if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
             if (!(*trace_name_printed)) {
               // RC_TRACE_MESG macro has an embedded ResourceMark
               RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",

@@ -2815,11 +2817,10 @@
             RC_TRACE(0x00100000, ("default method update: %s(%s) ",
                                   new_method->name()->as_C_string(),
                                   new_method->signature()->as_C_string()));
           }
         }
-      }
     }
   }
 }
 #endif // INCLUDE_JVMTI