< prev index next >

src/share/vm/classfile/javaClasses.cpp

Print this page




 785     {
 786       MutexLocker m1(Module_lock, THREAD);
 787       // Keep list of classes needing java.base module fixup
 788       if (!ModuleEntryTable::javabase_defined()) {
 789         if (fixup_module_field_list() == NULL) {
 790           GrowableArray<Klass*>* list =
 791             new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true);
 792           set_fixup_module_field_list(list);
 793         }
 794         k->class_loader_data()->inc_keep_alive();
 795         fixup_module_field_list()->push(k());
 796       } else {
 797         javabase_was_defined = true;
 798       }
 799     }
 800 
 801     // If java.base was already defined then patch this particular class with java.base.
 802     if (javabase_was_defined) {
 803       ModuleEntry *javabase_entry = ModuleEntryTable::javabase_moduleEntry();
 804       assert(javabase_entry != NULL && javabase_entry->module() != NULL,
 805              "Setting class module field, java.base should be defined");
 806       Handle javabase_handle(THREAD, JNIHandles::resolve(javabase_entry->module()));
 807       set_module(mirror(), javabase_handle());
 808     }
 809   } else {
 810     assert(Universe::is_module_initialized() ||
 811            (ModuleEntryTable::javabase_defined() &&
 812             (module() == JNIHandles::resolve(ModuleEntryTable::javabase_moduleEntry()->module()))),
 813            "Incorrect java.lang.reflect.Module specification while creating mirror");
 814     set_module(mirror(), module());
 815   }
 816 }
 817 
 818 void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
 819                                     Handle module, Handle protection_domain, TRAPS) {
 820   assert(k->java_mirror() == NULL, "should only assign mirror once");
 821   // Use this moment of initialization to cache modifier_flags also,
 822   // to support Class.getModifiers().  Instance classes recalculate
 823   // the cached flags after the class file is parsed, but before the
 824   // class is put into the system dictionary.
 825   int computed_modifiers = k->compute_modifier_flags(CHECK);




 785     {
 786       MutexLocker m1(Module_lock, THREAD);
 787       // Keep list of classes needing java.base module fixup
 788       if (!ModuleEntryTable::javabase_defined()) {
 789         if (fixup_module_field_list() == NULL) {
 790           GrowableArray<Klass*>* list =
 791             new (ResourceObj::C_HEAP, mtModule) GrowableArray<Klass*>(500, true);
 792           set_fixup_module_field_list(list);
 793         }
 794         k->class_loader_data()->inc_keep_alive();
 795         fixup_module_field_list()->push(k());
 796       } else {
 797         javabase_was_defined = true;
 798       }
 799     }
 800 
 801     // If java.base was already defined then patch this particular class with java.base.
 802     if (javabase_was_defined) {
 803       ModuleEntry *javabase_entry = ModuleEntryTable::javabase_moduleEntry();
 804       assert(javabase_entry != NULL && javabase_entry->module() != NULL,
 805              "Setting class module field, " JAVA_BASE_NAME " should be defined");
 806       Handle javabase_handle(THREAD, JNIHandles::resolve(javabase_entry->module()));
 807       set_module(mirror(), javabase_handle());
 808     }
 809   } else {
 810     assert(Universe::is_module_initialized() ||
 811            (ModuleEntryTable::javabase_defined() &&
 812             (module() == JNIHandles::resolve(ModuleEntryTable::javabase_moduleEntry()->module()))),
 813            "Incorrect java.lang.reflect.Module specification while creating mirror");
 814     set_module(mirror(), module());
 815   }
 816 }
 817 
 818 void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
 819                                     Handle module, Handle protection_domain, TRAPS) {
 820   assert(k->java_mirror() == NULL, "should only assign mirror once");
 821   // Use this moment of initialization to cache modifier_flags also,
 822   // to support Class.getModifiers().  Instance classes recalculate
 823   // the cached flags after the class file is parsed, but before the
 824   // class is put into the system dictionary.
 825   int computed_modifiers = k->compute_modifier_flags(CHECK);


< prev index next >