diff src/share/vm/oops/klass.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 1d1603768966
children be4ca325525a 069ab3f976d3 94ec88ca68e2
line wrap: on
line diff
--- a/src/share/vm/oops/klass.cpp	Thu Apr 14 23:06:33 2011 -0400
+++ b/src/share/vm/oops/klass.cpp	Fri Apr 15 09:36:28 2011 -0400
@@ -453,6 +453,14 @@
       ik->unlink_class();
     }
   }
+  // Clear the Java vtable if the oop has one.
+  // The vtable isn't shareable because it's in the wrong order wrt the methods
+  // once the method names get moved and resorted.
+  klassVtable* vt = vtable();
+  if (vt != NULL) {
+    assert(oop_is_instance() || oop_is_array(), "nothing else has vtable");
+    vt->clear_vtable();
+  }
   set_subklass(NULL);
   set_next_sibling(NULL);
 }