src/share/vm/oops/instanceKlass.cpp

Print this page
rev 6841 : mq
rev 6842 : mq


2286 
2287 void InstanceKlass::remove_unshareable_info() {
2288   Klass::remove_unshareable_info();
2289   // Unlink the class
2290   if (is_linked()) {
2291     unlink_class();
2292   }
2293   init_implementor();
2294 
2295   constants()->remove_unshareable_info();
2296 
2297   for (int i = 0; i < methods()->length(); i++) {
2298     Method* m = methods()->at(i);
2299     m->remove_unshareable_info();
2300   }
2301 
2302   // do array classes also.
2303   array_klasses_do(remove_unshareable_in_class);
2304 }
2305 
2306 void restore_unshareable_in_class(Klass* k, TRAPS) {
2307   k->restore_unshareable_info(CHECK);


2308 }
2309 
2310 void InstanceKlass::restore_unshareable_info(TRAPS) {
2311   Klass::restore_unshareable_info(CHECK);
2312   instanceKlassHandle ik(THREAD, this);
2313 
2314   Array<Method*>* methods = ik->methods();
2315   int num_methods = methods->length();
2316   for (int index2 = 0; index2 < num_methods; ++index2) {
2317     methodHandle m(THREAD, methods->at(index2));
2318     m->restore_unshareable_info(CHECK);
2319   }
2320   if (JvmtiExport::has_redefined_a_class()) {
2321     // Reinitialize vtable because RedefineClasses may have changed some
2322     // entries in this vtable for super classes so the CDS vtable might
2323     // point to old or obsolete entries.  RedefineClasses doesn't fix up
2324     // vtables in the shared system dictionary, only the main one.
2325     // It also redefines the itable too so fix that too.
2326     ResourceMark rm(THREAD);
2327     ik->vtable()->initialize_vtable(false, CHECK);
2328     ik->itable()->initialize_itable(false, CHECK);
2329   }
2330 
2331   // restore constant pool resolved references
2332   ik->constants()->restore_unshareable_info(CHECK);
2333 
2334   ik->array_klasses_do(restore_unshareable_in_class, CHECK);
































2335 }
2336 
2337 static void clear_all_breakpoints(Method* m) {
2338   m->clear_all_breakpoints();
2339 }
2340 
2341 
2342 void InstanceKlass::notify_unload_class(InstanceKlass* ik) {
2343   // notify the debugger
2344   if (JvmtiExport::should_post_class_unload()) {
2345     JvmtiExport::post_class_unload(ik);
2346   }
2347 
2348   // notify ClassLoadingService of class unload
2349   ClassLoadingService::notify_class_unloaded(ik);
2350 }
2351 
2352 void InstanceKlass::release_C_heap_structures(InstanceKlass* ik) {
2353   // Clean up C heap
2354   ik->release_C_heap_structures();




2286 
2287 void InstanceKlass::remove_unshareable_info() {
2288   Klass::remove_unshareable_info();
2289   // Unlink the class
2290   if (is_linked()) {
2291     unlink_class();
2292   }
2293   init_implementor();
2294 
2295   constants()->remove_unshareable_info();
2296 
2297   for (int i = 0; i < methods()->length(); i++) {
2298     Method* m = methods()->at(i);
2299     m->remove_unshareable_info();
2300   }
2301 
2302   // do array classes also.
2303   array_klasses_do(remove_unshareable_in_class);
2304 }
2305 
2306 static void restore_unshareable_in_class(Klass* k, TRAPS) {
2307   // Array classes have null protection domain.
2308   // --> see ArrayKlass::complete_create_array_klass()
2309   k->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
2310 }
2311 
2312 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
2313   Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
2314   instanceKlassHandle ik(THREAD, this);
2315 
2316   Array<Method*>* methods = ik->methods();
2317   int num_methods = methods->length();
2318   for (int index2 = 0; index2 < num_methods; ++index2) {
2319     methodHandle m(THREAD, methods->at(index2));
2320     m->restore_unshareable_info(CHECK);
2321   }
2322   if (JvmtiExport::has_redefined_a_class()) {
2323     // Reinitialize vtable because RedefineClasses may have changed some
2324     // entries in this vtable for super classes so the CDS vtable might
2325     // point to old or obsolete entries.  RedefineClasses doesn't fix up
2326     // vtables in the shared system dictionary, only the main one.
2327     // It also redefines the itable too so fix that too.
2328     ResourceMark rm(THREAD);
2329     ik->vtable()->initialize_vtable(false, CHECK);
2330     ik->itable()->initialize_itable(false, CHECK);
2331   }
2332 
2333   // restore constant pool resolved references
2334   ik->constants()->restore_unshareable_info(CHECK);
2335 
2336   ik->array_klasses_do(restore_unshareable_in_class, CHECK);
2337 }
2338 
2339 // returns true IFF is_in_error_state() has been changed as a result of this call.
2340 bool InstanceKlass::check_sharing_error_state() {
2341   assert(DumpSharedSpaces, "should only be called during dumping");
2342   bool old_state = is_in_error_state();
2343 
2344   if (!is_in_error_state()) {
2345     bool bad = false;
2346     for (InstanceKlass* sup = java_super(); sup; sup = sup->java_super()) {
2347       if (sup->is_in_error_state()) {
2348         bad = true;
2349         break;
2350       }
2351     }
2352     if (!bad) {
2353       Array<Klass*>* interfaces = transitive_interfaces();
2354       for (int i = 0; i < interfaces->length(); i++) {
2355         Klass* iface = interfaces->at(i);
2356         if (InstanceKlass::cast(iface)->is_in_error_state()) {
2357           bad = true;
2358           break;
2359         }
2360       }
2361     }
2362 
2363     if (bad) {
2364       set_in_error_state();
2365     }
2366   }
2367 
2368   return (old_state != is_in_error_state());
2369 }
2370 
2371 static void clear_all_breakpoints(Method* m) {
2372   m->clear_all_breakpoints();
2373 }
2374 
2375 
2376 void InstanceKlass::notify_unload_class(InstanceKlass* ik) {
2377   // notify the debugger
2378   if (JvmtiExport::should_post_class_unload()) {
2379     JvmtiExport::post_class_unload(ik);
2380   }
2381 
2382   // notify ClassLoadingService of class unload
2383   ClassLoadingService::notify_class_unloaded(ik);
2384 }
2385 
2386 void InstanceKlass::release_C_heap_structures(InstanceKlass* ik) {
2387   // Clean up C heap
2388   ik->release_C_heap_structures();