src/hotspot/share/oops/objArrayKlass.cpp
changeset 51329 9c68699bebe5
parent 51268 4ac20e5f96ce
child 51349 343f580476d6
equal deleted inserted replaced
51328:fad2334b2906 51329:9c68699bebe5
    65       // The element type has a direct super.  E.g., String[] has direct super of Object[].
    65       // The element type has a direct super.  E.g., String[] has direct super of Object[].
    66       super_klass = element_super->array_klass_or_null();
    66       super_klass = element_super->array_klass_or_null();
    67       bool supers_exist = super_klass != NULL;
    67       bool supers_exist = super_klass != NULL;
    68       // Also, see if the element has secondary supertypes.
    68       // Also, see if the element has secondary supertypes.
    69       // We need an array type for each.
    69       // We need an array type for each.
    70       Array<Klass*>* element_supers = element_klass->secondary_supers();
    70       const Array<Klass*>* element_supers = element_klass->secondary_supers();
    71       for( int i = element_supers->length()-1; i >= 0; i-- ) {
    71       for( int i = element_supers->length()-1; i >= 0; i-- ) {
    72         Klass* elem_super = element_supers->at(i);
    72         Klass* elem_super = element_supers->at(i);
    73         if (elem_super->array_klass_or_null() == NULL) {
    73         if (elem_super->array_klass_or_null() == NULL) {
    74           supers_exist = false;
    74           supers_exist = false;
    75           break;
    75           break;
   380   else
   380   else
   381     return Klass::can_be_primary_super_slow();
   381     return Klass::can_be_primary_super_slow();
   382 }
   382 }
   383 
   383 
   384 GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots,
   384 GrowableArray<Klass*>* ObjArrayKlass::compute_secondary_supers(int num_extra_slots,
   385                                                                Array<Klass*>* transitive_interfaces) {
   385                                                                Array<InstanceKlass*>* transitive_interfaces) {
   386   assert(transitive_interfaces == NULL, "sanity");
   386   assert(transitive_interfaces == NULL, "sanity");
   387   // interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... };
   387   // interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... };
   388   Array<Klass*>* elem_supers = element_klass()->secondary_supers();
   388   const Array<Klass*>* elem_supers = element_klass()->secondary_supers();
   389   int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length();
   389   int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length();
   390   int num_secondaries = num_extra_slots + 2 + num_elem_supers;
   390   int num_secondaries = num_extra_slots + 2 + num_elem_supers;
   391   if (num_secondaries == 2) {
   391   if (num_secondaries == 2) {
   392     // Must share this for correct bootstrapping!
   392     // Must share this for correct bootstrapping!
   393     set_secondary_supers(Universe::the_array_interfaces_array());
   393     set_secondary_supers(Universe::the_array_interfaces_array());
   395   } else {
   395   } else {
   396     GrowableArray<Klass*>* secondaries = new GrowableArray<Klass*>(num_elem_supers+2);
   396     GrowableArray<Klass*>* secondaries = new GrowableArray<Klass*>(num_elem_supers+2);
   397     secondaries->push(SystemDictionary::Cloneable_klass());
   397     secondaries->push(SystemDictionary::Cloneable_klass());
   398     secondaries->push(SystemDictionary::Serializable_klass());
   398     secondaries->push(SystemDictionary::Serializable_klass());
   399     for (int i = 0; i < num_elem_supers; i++) {
   399     for (int i = 0; i < num_elem_supers; i++) {
   400       Klass* elem_super = (Klass*) elem_supers->at(i);
   400       Klass* elem_super = elem_supers->at(i);
   401       Klass* array_super = elem_super->array_klass_or_null();
   401       Klass* array_super = elem_super->array_klass_or_null();
   402       assert(array_super != NULL, "must already have been created");
   402       assert(array_super != NULL, "must already have been created");
   403       secondaries->push(array_super);
   403       secondaries->push(array_super);
   404     }
   404     }
   405     return secondaries;
   405     return secondaries;