2469 _nest_host = NULL;
2470 _package_entry = NULL;
2471 _dep_context_last_cleaned = 0;
2472 }
2473
2474 void InstanceKlass::remove_java_mirror() {
2475 Klass::remove_java_mirror();
2476
2477 // do array classes also.
2478 if (array_klasses() != NULL) {
2479 array_klasses()->remove_java_mirror();
2480 }
2481 }
2482
2483 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain,
2484 PackageEntry* pkg_entry, TRAPS) {
2485 // SystemDictionary::add_to_hierarchy() sets the init_state to loaded
2486 // before the InstanceKlass is added to the SystemDictionary. Make
2487 // sure the current state is <loaded.
2488 assert(!is_loaded(), "invalid init state");
2489 set_package(loader_data, pkg_entry, CHECK);
2490 Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
2491
2492 Array<Method*>* methods = this->methods();
2493 int num_methods = methods->length();
2494 for (int index = 0; index < num_methods; ++index) {
2495 methods->at(index)->restore_unshareable_info(CHECK);
2496 }
2497 if (JvmtiExport::has_redefined_a_class()) {
2498 // Reinitialize vtable because RedefineClasses may have changed some
2499 // entries in this vtable for super classes so the CDS vtable might
2500 // point to old or obsolete entries. RedefineClasses doesn't fix up
2501 // vtables in the shared system dictionary, only the main one.
2502 // It also redefines the itable too so fix that too.
2503 vtable().initialize_vtable(false, CHECK);
2504 itable().initialize_itable(false, CHECK);
2505 }
2506
2507 // restore constant pool resolved references
2508 constants()->restore_unshareable_info(CHECK);
2509
2516 // Initialize current biased locking state.
2517 if (UseBiasedLocking && BiasedLocking::enabled()) {
2518 set_prototype_header(markWord::biased_locking_prototype());
2519 }
2520 }
2521
2522 void InstanceKlass::set_shared_class_loader_type(s2 loader_type) {
2523 switch (loader_type) {
2524 case ClassLoader::BOOT_LOADER:
2525 _misc_flags |= _misc_is_shared_boot_class;
2526 break;
2527 case ClassLoader::PLATFORM_LOADER:
2528 _misc_flags |= _misc_is_shared_platform_class;
2529 break;
2530 case ClassLoader::APP_LOADER:
2531 _misc_flags |= _misc_is_shared_app_class;
2532 break;
2533 default:
2534 ShouldNotReachHere();
2535 break;
2536 }
2537 }
2538
2539 #if INCLUDE_JVMTI
2540 static void clear_all_breakpoints(Method* m) {
2541 m->clear_all_breakpoints();
2542 }
2543 #endif
2544
2545 void InstanceKlass::unload_class(InstanceKlass* ik) {
2546 // Release dependencies.
2547 ik->dependencies().remove_all_dependents();
2548
2549 // notify the debugger
2550 if (JvmtiExport::should_post_class_unload()) {
2551 JvmtiExport::post_class_unload(ik);
2552 }
2553
2554 // notify ClassLoadingService of class unload
2555 ClassLoadingService::notify_class_unloaded(ik);
|
2469 _nest_host = NULL;
2470 _package_entry = NULL;
2471 _dep_context_last_cleaned = 0;
2472 }
2473
2474 void InstanceKlass::remove_java_mirror() {
2475 Klass::remove_java_mirror();
2476
2477 // do array classes also.
2478 if (array_klasses() != NULL) {
2479 array_klasses()->remove_java_mirror();
2480 }
2481 }
2482
2483 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain,
2484 PackageEntry* pkg_entry, TRAPS) {
2485 // SystemDictionary::add_to_hierarchy() sets the init_state to loaded
2486 // before the InstanceKlass is added to the SystemDictionary. Make
2487 // sure the current state is <loaded.
2488 assert(!is_loaded(), "invalid init state");
2489 set_package(ClassLoaderData::class_loader_data_or_null(loader_data->class_loader()), pkg_entry, CHECK);
2490 Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
2491
2492 Array<Method*>* methods = this->methods();
2493 int num_methods = methods->length();
2494 for (int index = 0; index < num_methods; ++index) {
2495 methods->at(index)->restore_unshareable_info(CHECK);
2496 }
2497 if (JvmtiExport::has_redefined_a_class()) {
2498 // Reinitialize vtable because RedefineClasses may have changed some
2499 // entries in this vtable for super classes so the CDS vtable might
2500 // point to old or obsolete entries. RedefineClasses doesn't fix up
2501 // vtables in the shared system dictionary, only the main one.
2502 // It also redefines the itable too so fix that too.
2503 vtable().initialize_vtable(false, CHECK);
2504 itable().initialize_itable(false, CHECK);
2505 }
2506
2507 // restore constant pool resolved references
2508 constants()->restore_unshareable_info(CHECK);
2509
2516 // Initialize current biased locking state.
2517 if (UseBiasedLocking && BiasedLocking::enabled()) {
2518 set_prototype_header(markWord::biased_locking_prototype());
2519 }
2520 }
2521
2522 void InstanceKlass::set_shared_class_loader_type(s2 loader_type) {
2523 switch (loader_type) {
2524 case ClassLoader::BOOT_LOADER:
2525 _misc_flags |= _misc_is_shared_boot_class;
2526 break;
2527 case ClassLoader::PLATFORM_LOADER:
2528 _misc_flags |= _misc_is_shared_platform_class;
2529 break;
2530 case ClassLoader::APP_LOADER:
2531 _misc_flags |= _misc_is_shared_app_class;
2532 break;
2533 default:
2534 ShouldNotReachHere();
2535 break;
2536 }
2537 }
2538
2539 void InstanceKlass::assign_class_loader_type() {
2540 ClassLoaderData *cld = class_loader_data();
2541 if (cld->is_boot_class_loader_data()) {
2542 set_shared_class_loader_type(ClassLoader::BOOT_LOADER);
2543 }
2544 else if (cld->is_platform_class_loader_data()) {
2545 set_shared_class_loader_type(ClassLoader::PLATFORM_LOADER);
2546 }
2547 else if (cld->is_system_class_loader_data()) {
2548 set_shared_class_loader_type(ClassLoader::APP_LOADER);
2549 }
2550 }
2551
2552 #if INCLUDE_JVMTI
2553 static void clear_all_breakpoints(Method* m) {
2554 m->clear_all_breakpoints();
2555 }
2556 #endif
2557
2558 void InstanceKlass::unload_class(InstanceKlass* ik) {
2559 // Release dependencies.
2560 ik->dependencies().remove_all_dependents();
2561
2562 // notify the debugger
2563 if (JvmtiExport::should_post_class_unload()) {
2564 JvmtiExport::post_class_unload(ik);
2565 }
2566
2567 // notify ClassLoadingService of class unload
2568 ClassLoadingService::notify_class_unloaded(ik);
|