< prev index next >

src/hotspot/share/oops/arrayKlass.cpp

Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com


  93     set_name(name);
  94     set_super(Universe::is_bootstrapping() ? NULL : SystemDictionary::Object_klass());
  95     set_layout_helper(Klass::_lh_neutral_value);
  96     set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
  97     JFR_ONLY(INIT_ID(this);)
  98 }
  99 
 100 
 101 // Initialization of vtables and mirror object is done separatly from base_create_array_klass,
 102 // since a GC can happen. At this point all instance variables of the ArrayKlass must be setup.
 103 void ArrayKlass::complete_create_array_klass(ArrayKlass* k, Klass* super_klass, ModuleEntry* module_entry, TRAPS) {
 104   k->initialize_supers(super_klass, NULL, CHECK);
 105   k->vtable().initialize_vtable(false, CHECK);
 106 
 107   // During bootstrapping, before java.base is defined, the module_entry may not be present yet.
 108   // These classes will be put on a fixup list and their module fields will be patched once
 109   // java.base is defined.
 110   assert((module_entry != NULL) || ((module_entry == NULL) && !ModuleEntryTable::javabase_defined()),
 111          "module entry not available post " JAVA_BASE_NAME " definition");
 112   oop module = (module_entry != NULL) ? module_entry->module() : (oop)NULL;
 113   java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(THREAD, module), Handle(), CHECK);
 114 }
 115 
 116 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots,
 117                                                             Array<InstanceKlass*>* transitive_interfaces) {
 118   // interfaces = { cloneable_klass, serializable_klass };
 119   assert(num_extra_slots == 0, "sanity of primitive array type");
 120   assert(transitive_interfaces == NULL, "sanity");
 121   // Must share this for correct bootstrapping!
 122   set_secondary_supers(Universe::the_array_interfaces_array());
 123   return NULL;
 124 }
 125 
 126 objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
 127   check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_NULL);
 128   int size = objArrayOopDesc::object_size(length);
 129   Klass* k = array_klass(n+dimension(), CHECK_NULL);
 130   ArrayKlass* ak = ArrayKlass::cast(k);
 131   objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length,
 132                                                                 /* do_zero */ true, CHECK_NULL);
 133   // initialization to NULL not necessary, area already cleared




  93     set_name(name);
  94     set_super(Universe::is_bootstrapping() ? NULL : SystemDictionary::Object_klass());
  95     set_layout_helper(Klass::_lh_neutral_value);
  96     set_is_cloneable(); // All arrays are considered to be cloneable (See JLS 20.1.5)
  97     JFR_ONLY(INIT_ID(this);)
  98 }
  99 
 100 
 101 // Initialization of vtables and mirror object is done separatly from base_create_array_klass,
 102 // since a GC can happen. At this point all instance variables of the ArrayKlass must be setup.
 103 void ArrayKlass::complete_create_array_klass(ArrayKlass* k, Klass* super_klass, ModuleEntry* module_entry, TRAPS) {
 104   k->initialize_supers(super_klass, NULL, CHECK);
 105   k->vtable().initialize_vtable(false, CHECK);
 106 
 107   // During bootstrapping, before java.base is defined, the module_entry may not be present yet.
 108   // These classes will be put on a fixup list and their module fields will be patched once
 109   // java.base is defined.
 110   assert((module_entry != NULL) || ((module_entry == NULL) && !ModuleEntryTable::javabase_defined()),
 111          "module entry not available post " JAVA_BASE_NAME " definition");
 112   oop module = (module_entry != NULL) ? module_entry->module() : (oop)NULL;
 113   java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(THREAD, module), Handle(), Handle(), CHECK);
 114 }
 115 
 116 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots,
 117                                                             Array<InstanceKlass*>* transitive_interfaces) {
 118   // interfaces = { cloneable_klass, serializable_klass };
 119   assert(num_extra_slots == 0, "sanity of primitive array type");
 120   assert(transitive_interfaces == NULL, "sanity");
 121   // Must share this for correct bootstrapping!
 122   set_secondary_supers(Universe::the_array_interfaces_array());
 123   return NULL;
 124 }
 125 
 126 objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
 127   check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_NULL);
 128   int size = objArrayOopDesc::object_size(length);
 129   Klass* k = array_klass(n+dimension(), CHECK_NULL);
 130   ArrayKlass* ak = ArrayKlass::cast(k);
 131   objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length,
 132                                                                 /* do_zero */ true, CHECK_NULL);
 133   // initialization to NULL not necessary, area already cleared


< prev index next >