872 } else {
873 assert(k->is_instance_klass(), "Must be");
874
875 initialize_mirror_fields(k, mirror, protection_domain, THREAD);
876 if (HAS_PENDING_EXCEPTION) {
877 // If any of the fields throws an exception like OOM remove the klass field
878 // from the mirror so GC doesn't follow it after the klass has been deallocated.
879 // This mirror looks like a primitive type, which logically it is because it
880 // it represents no class.
881 java_lang_Class::set_klass(mirror(), NULL);
882 return;
883 }
884 }
885
886 // set the classLoader field in the java_lang_Class instance
887 assert(class_loader() == k->class_loader(), "should be same");
888 set_class_loader(mirror(), class_loader());
889
890 // Setup indirection from klass->mirror
891 // after any exceptions can happen during allocations.
892 k->set_java_mirror(mirror());
893
894 // Set the module field in the java_lang_Class instance. This must be done
895 // after the mirror is set.
896 set_mirror_module_field(k, mirror, module, THREAD);
897
898 if (comp_mirror() != NULL) {
899 // Set after k->java_mirror() is published, because compiled code running
900 // concurrently doesn't expect a k to have a null java_mirror.
901 release_set_array_klass(comp_mirror(), k);
902 }
903 } else {
904 assert(fixup_mirror_list() != NULL, "fixup_mirror_list not initialized");
905 fixup_mirror_list()->push(k);
906 }
907 }
908
909 void java_lang_Class::fixup_module_field(Klass* k, Handle module) {
910 assert(_module_offset != 0, "must have been computed already");
911 java_lang_Class::set_module(k->java_mirror(), module());
912 }
|
872 } else {
873 assert(k->is_instance_klass(), "Must be");
874
875 initialize_mirror_fields(k, mirror, protection_domain, THREAD);
876 if (HAS_PENDING_EXCEPTION) {
877 // If any of the fields throws an exception like OOM remove the klass field
878 // from the mirror so GC doesn't follow it after the klass has been deallocated.
879 // This mirror looks like a primitive type, which logically it is because it
880 // it represents no class.
881 java_lang_Class::set_klass(mirror(), NULL);
882 return;
883 }
884 }
885
886 // set the classLoader field in the java_lang_Class instance
887 assert(class_loader() == k->class_loader(), "should be same");
888 set_class_loader(mirror(), class_loader());
889
890 // Setup indirection from klass->mirror
891 // after any exceptions can happen during allocations.
892 k->set_java_mirror(mirror);
893
894 // Set the module field in the java_lang_Class instance. This must be done
895 // after the mirror is set.
896 set_mirror_module_field(k, mirror, module, THREAD);
897
898 if (comp_mirror() != NULL) {
899 // Set after k->java_mirror() is published, because compiled code running
900 // concurrently doesn't expect a k to have a null java_mirror.
901 release_set_array_klass(comp_mirror(), k);
902 }
903 } else {
904 assert(fixup_mirror_list() != NULL, "fixup_mirror_list not initialized");
905 fixup_mirror_list()->push(k);
906 }
907 }
908
909 void java_lang_Class::fixup_module_field(Klass* k, Handle module) {
910 assert(_module_offset != 0, "must have been computed already");
911 java_lang_Class::set_module(k->java_mirror(), module());
912 }
|