8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)

Keep class in CLD::_klasses list and mirror created for CDS classes if OOM during restore_shareable_info(). This keeps pointers consistent for CMS.

Reviewed-by: ehelin, stefank, jmasa, iklam
This commit is contained in:
Coleen Phillimore 2014-04-08 13:58:38 -04:00
parent eea84b4feb
commit c8990959f2
14 changed files with 109 additions and 139 deletions

View file

@ -1289,17 +1289,18 @@ void InstanceKlass::do_local_static_fields(FieldClosure* cl) {
}
void InstanceKlass::do_local_static_fields(void f(fieldDescriptor*, TRAPS), TRAPS) {
void InstanceKlass::do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle mirror, TRAPS) {
instanceKlassHandle h_this(THREAD, this);
do_local_static_fields_impl(h_this, f, CHECK);
do_local_static_fields_impl(h_this, f, mirror, CHECK);
}
void InstanceKlass::do_local_static_fields_impl(instanceKlassHandle this_k, void f(fieldDescriptor* fd, TRAPS), TRAPS) {
void InstanceKlass::do_local_static_fields_impl(instanceKlassHandle this_k,
void f(fieldDescriptor* fd, Handle, TRAPS), Handle mirror, TRAPS) {
for (JavaFieldStream fs(this_k()); !fs.done(); fs.next()) {
if (fs.access_flags().is_static()) {
fieldDescriptor& fd = fs.field_descriptor();
f(&fd, CHECK);
f(&fd, mirror, CHECK);
}
}
}
@ -2240,9 +2241,7 @@ void InstanceKlass::restore_unshareable_info(TRAPS) {
int num_methods = methods->length();
for (int index2 = 0; index2 < num_methods; ++index2) {
methodHandle m(THREAD, methods->at(index2));
m()->link_method(m, CHECK);
// restore method's vtable by calling a virtual function
m->restore_vtable();
m->restore_unshareable_info(CHECK);
}
if (JvmtiExport::has_redefined_a_class()) {
// Reinitialize vtable because RedefineClasses may have changed some