804
805 // also sets rewritten
806 rewrite_class(CHECK_false);
807 } else if (is_shared()) {
808 SystemDictionaryShared::check_verification_constraints(this, CHECK_false);
809 }
810
811 // relocate jsrs and link methods after they are all rewritten
812 link_methods(CHECK_false);
813
814 // Initialize the vtable and interface table after
815 // methods have been rewritten since rewrite may
816 // fabricate new Method*s.
817 // also does loader constraint checking
818 //
819 // initialize_vtable and initialize_itable need to be rerun for
820 // a shared class if the class is not loaded by the NULL classloader.
821 ClassLoaderData * loader_data = class_loader_data();
822 if (!(is_shared() &&
823 loader_data->is_the_null_class_loader_data())) {
824 ResourceMark rm(THREAD);
825 vtable().initialize_vtable(true, CHECK_false);
826 itable().initialize_itable(true, CHECK_false);
827 }
828 #ifdef ASSERT
829 else {
830 vtable().verify(tty, true);
831 // In case itable verification is ever added.
832 // itable().verify(tty, true);
833 }
834 #endif
835 set_init_state(linked);
836 if (JvmtiExport::should_post_class_prepare()) {
837 Thread *thread = THREAD;
838 assert(thread->is_Java_thread(), "thread->is_Java_thread()");
839 JvmtiExport::post_class_prepare((JavaThread *) thread, this);
840 }
841 }
842 }
843 return true;
844 }
2309 array_klasses()->remove_java_mirror();
2310 }
2311 }
2312
2313 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
2314 set_package(loader_data, CHECK);
2315 Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
2316
2317 Array<Method*>* methods = this->methods();
2318 int num_methods = methods->length();
2319 for (int index2 = 0; index2 < num_methods; ++index2) {
2320 methodHandle m(THREAD, methods->at(index2));
2321 m->restore_unshareable_info(CHECK);
2322 }
2323 if (JvmtiExport::has_redefined_a_class()) {
2324 // Reinitialize vtable because RedefineClasses may have changed some
2325 // entries in this vtable for super classes so the CDS vtable might
2326 // point to old or obsolete entries. RedefineClasses doesn't fix up
2327 // vtables in the shared system dictionary, only the main one.
2328 // It also redefines the itable too so fix that too.
2329 ResourceMark rm(THREAD);
2330 vtable().initialize_vtable(false, CHECK);
2331 itable().initialize_itable(false, CHECK);
2332 }
2333
2334 // restore constant pool resolved references
2335 constants()->restore_unshareable_info(CHECK);
2336
2337 if (array_klasses() != NULL) {
2338 // Array classes have null protection domain.
2339 // --> see ArrayKlass::complete_create_array_klass()
2340 array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
2341 }
2342 }
2343
2344 // returns true IFF is_in_error_state() has been changed as a result of this call.
2345 bool InstanceKlass::check_sharing_error_state() {
2346 assert(DumpSharedSpaces, "should only be called during dumping");
2347 bool old_state = is_in_error_state();
2348
2349 if (!is_in_error_state()) {
|
804
805 // also sets rewritten
806 rewrite_class(CHECK_false);
807 } else if (is_shared()) {
808 SystemDictionaryShared::check_verification_constraints(this, CHECK_false);
809 }
810
811 // relocate jsrs and link methods after they are all rewritten
812 link_methods(CHECK_false);
813
814 // Initialize the vtable and interface table after
815 // methods have been rewritten since rewrite may
816 // fabricate new Method*s.
817 // also does loader constraint checking
818 //
819 // initialize_vtable and initialize_itable need to be rerun for
820 // a shared class if the class is not loaded by the NULL classloader.
821 ClassLoaderData * loader_data = class_loader_data();
822 if (!(is_shared() &&
823 loader_data->is_the_null_class_loader_data())) {
824 vtable().initialize_vtable(true, CHECK_false);
825 itable().initialize_itable(true, CHECK_false);
826 }
827 #ifdef ASSERT
828 else {
829 vtable().verify(tty, true);
830 // In case itable verification is ever added.
831 // itable().verify(tty, true);
832 }
833 #endif
834 set_init_state(linked);
835 if (JvmtiExport::should_post_class_prepare()) {
836 Thread *thread = THREAD;
837 assert(thread->is_Java_thread(), "thread->is_Java_thread()");
838 JvmtiExport::post_class_prepare((JavaThread *) thread, this);
839 }
840 }
841 }
842 return true;
843 }
2308 array_klasses()->remove_java_mirror();
2309 }
2310 }
2311
2312 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
2313 set_package(loader_data, CHECK);
2314 Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
2315
2316 Array<Method*>* methods = this->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 vtable().initialize_vtable(false, CHECK);
2329 itable().initialize_itable(false, CHECK);
2330 }
2331
2332 // restore constant pool resolved references
2333 constants()->restore_unshareable_info(CHECK);
2334
2335 if (array_klasses() != NULL) {
2336 // Array classes have null protection domain.
2337 // --> see ArrayKlass::complete_create_array_klass()
2338 array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
2339 }
2340 }
2341
2342 // returns true IFF is_in_error_state() has been changed as a result of this call.
2343 bool InstanceKlass::check_sharing_error_state() {
2344 assert(DumpSharedSpaces, "should only be called during dumping");
2345 bool old_state = is_in_error_state();
2346
2347 if (!is_in_error_state()) {
|