< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page




 547   // Just null out the mirror.  The class_loader_data() no longer exists.
 548   _java_mirror = NULL;
 549 }
 550 
 551 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
 552   assert(is_klass(), "ensure C++ vtable is restored");
 553   assert(is_shared(), "must be set");
 554   JFR_ONLY(RESTORE_ID(this);)
 555   if (log_is_enabled(Trace, cds, unshareable)) {
 556     ResourceMark rm;
 557     log_trace(cds, unshareable)("restore: %s", external_name());
 558   }
 559 
 560   // If an exception happened during CDS restore, some of these fields may already be
 561   // set.  We leave the class on the CLD list, even if incomplete so that we don't
 562   // modify the CLD list outside a safepoint.
 563   if (class_loader_data() == NULL) {
 564     // Restore class_loader_data to the null class loader data
 565     set_class_loader_data(loader_data);
 566 
 567     // Workaround for suspected bug.  Make sure other threads see this assignment.
 568     // This shouldn't be necessary but the compiler thread seems to be behind
 569     // the times, even though this thread takes MethodCompileQueue_lock and the thread
 570     // that doesn't see this value also takes that lock.
 571     OrderAccess::fence();
 572 
 573     // Add to null class loader list first before creating the mirror
 574     // (same order as class file parsing)
 575     loader_data->add_class(this);
 576   }
 577 
 578   Handle loader(THREAD, loader_data->class_loader());
 579   ModuleEntry* module_entry = NULL;
 580   Klass* k = this;
 581   if (k->is_objArray_klass()) {
 582     k = ObjArrayKlass::cast(k)->bottom_klass();
 583   }
 584   // Obtain klass' module.
 585   if (k->is_instance_klass()) {
 586     InstanceKlass* ik = (InstanceKlass*) k;
 587     module_entry = ik->module();
 588   } else {
 589     module_entry = ModuleEntryTable::javabase_moduleEntry();
 590   }
 591   // Obtain java.lang.Module, if available
 592   Handle module_handle(THREAD, ((module_entry != NULL) ? module_entry->module() : (oop)NULL));




 547   // Just null out the mirror.  The class_loader_data() no longer exists.
 548   _java_mirror = NULL;
 549 }
 550 
 551 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
 552   assert(is_klass(), "ensure C++ vtable is restored");
 553   assert(is_shared(), "must be set");
 554   JFR_ONLY(RESTORE_ID(this);)
 555   if (log_is_enabled(Trace, cds, unshareable)) {
 556     ResourceMark rm;
 557     log_trace(cds, unshareable)("restore: %s", external_name());
 558   }
 559 
 560   // If an exception happened during CDS restore, some of these fields may already be
 561   // set.  We leave the class on the CLD list, even if incomplete so that we don't
 562   // modify the CLD list outside a safepoint.
 563   if (class_loader_data() == NULL) {
 564     // Restore class_loader_data to the null class loader data
 565     set_class_loader_data(loader_data);
 566 






 567     // Add to null class loader list first before creating the mirror
 568     // (same order as class file parsing)
 569     loader_data->add_class(this);
 570   }
 571 
 572   Handle loader(THREAD, loader_data->class_loader());
 573   ModuleEntry* module_entry = NULL;
 574   Klass* k = this;
 575   if (k->is_objArray_klass()) {
 576     k = ObjArrayKlass::cast(k)->bottom_klass();
 577   }
 578   // Obtain klass' module.
 579   if (k->is_instance_klass()) {
 580     InstanceKlass* ik = (InstanceKlass*) k;
 581     module_entry = ik->module();
 582   } else {
 583     module_entry = ModuleEntryTable::javabase_moduleEntry();
 584   }
 585   // Obtain java.lang.Module, if available
 586   Handle module_handle(THREAD, ((module_entry != NULL) ? module_entry->module() : (oop)NULL));


< prev index next >