--- a/hotspot/src/share/vm/oops/arrayKlass.cpp Tue Mar 15 13:48:21 2016 -0700
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp Thu Mar 17 19:04:01 2016 +0000
@@ -95,11 +95,18 @@
// Initialization of vtables and mirror object is done separatly from base_create_array_klass,
// since a GC can happen. At this point all instance variables of the ArrayKlass must be setup.
-void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_klass, TRAPS) {
+void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_klass, ModuleEntry* module_entry, TRAPS) {
ResourceMark rm(THREAD);
k->initialize_supers(super_klass(), CHECK);
k->vtable()->initialize_vtable(false, CHECK);
- java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
+
+ // During bootstrapping, before java.base is defined, the module_entry may not be present yet.
+ // These classes will be put on a fixup list and their module fields will be patched once
+ // java.base is defined.
+ assert((module_entry != NULL) || ((module_entry == NULL) && !ModuleEntryTable::javabase_defined()),
+ "module entry not available post java.base definition");
+ oop module = (module_entry != NULL) ? JNIHandles::resolve(module_entry->module()) : (oop)NULL;
+ java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(THREAD, module), Handle(NULL), CHECK);
}
GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {