diff src/share/vm/classfile/systemDictionary.cpp @ 3245:8ce625481709

7032407: Crash in LinkResolver::runtime_resolve_virtual_method() Summary: Make CDS reorder vtables so that dump time vtables match run time order, so when redefine classes reinitializes them, they aren't in the wrong order. Reviewed-by: dcubed, acorn
author coleenp
date Fri, 15 Apr 2011 09:36:28 -0400
parents ed69575596ac
children 167b70ff3abc
line wrap: on
line diff
--- a/src/share/vm/classfile/systemDictionary.cpp	Thu Apr 14 23:06:33 2011 -0400
+++ b/src/share/vm/classfile/systemDictionary.cpp	Fri Apr 15 09:36:28 2011 -0400
@@ -1255,6 +1255,16 @@
         methodHandle m(THREAD, methodOop(methods->obj_at(index2)));
         m()->link_method(m, CHECK_(nh));
       }
+      if (JvmtiExport::has_redefined_a_class()) {
+        // Reinitialize vtable because RedefineClasses may have changed some
+        // entries in this vtable for super classes so the CDS vtable might
+        // point to old or obsolete entries.  RedefineClasses doesn't fix up
+        // vtables in the shared system dictionary, only the main one.
+        // It also redefines the itable too so fix that too.
+        ResourceMark rm(THREAD);
+        ik->vtable()->initialize_vtable(false, CHECK_(nh));
+        ik->itable()->initialize_itable(false, CHECK_(nh));
+      }
     }
 
     if (TraceClassLoading) {