7032407: Crash in LinkResolver::runtime_resolve_virtual_method()

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
This commit is contained in:
Coleen Phillimore 2011-04-15 09:36:28 -04:00
parent 2a5436b3d3
commit 8acea1848a
7 changed files with 75 additions and 13 deletions

View file

@ -1255,6 +1255,16 @@ instanceKlassHandle SystemDictionary::load_shared_class(
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) {