< prev index next >

src/hotspot/share/opto/type.cpp

Print this page




4605       // Integral array element types have irrelevant lattice relations.
4606       // It is the klass that determines array layout, not the element type.
4607       if (_klass == NULL)
4608         lazy_klass = tap->_klass;
4609       else if (tap->_klass == NULL || tap->_klass == _klass) {
4610         lazy_klass = _klass;
4611       } else {
4612         // Something like byte[int+] meets char[int+].
4613         // This must fall to bottom, not (int[-128..65535])[int+].
4614         instance_id = InstanceBot;
4615         tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable);
4616       }
4617     } else if (klass() != NULL && tap->klass() != NULL &&
4618                klass()->as_array_klass()->storage_properties().value() != tap->klass()->as_array_klass()->storage_properties().value()) {
4619       // Meeting value type arrays with conflicting storage properties
4620       if (tary->_elem->isa_valuetype()) {
4621         // Result is flattened
4622         off = Offset(elem()->isa_valuetype() ? offset() : tap->offset());
4623         field_off = elem()->isa_valuetype() ? field_offset() : tap->field_offset();
4624       } else if (tary->_elem->make_oopptr() != NULL && tary->_elem->make_oopptr()->isa_instptr() && below_centerline(ptr)) {
4625         // Result is non-flattened (fall back to object)
4626         off = Offset(flattened_offset()).meet(Offset(tap->flattened_offset()));
4627         field_off = Offset::bottom;
4628         tary = TypeAry::make(TypeInstPtr::BOTTOM, tary->_size, tary->_stable);
4629       }
4630     } else // Non integral arrays.
4631       // Must fall to bottom if exact klasses in upper lattice
4632       // are not equal or super klass is exact.
4633       if ((above_centerline(ptr) || ptr == Constant) && klass() != tap->klass() &&
4634           // meet with top[] and bottom[] are processed further down:
4635           tap->_klass != NULL && this->_klass != NULL &&
4636           // both are exact and not equal:
4637           ((tap->_klass_is_exact && this->_klass_is_exact) ||
4638            // 'tap' is exact and super or unrelated:
4639            (tap->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) ||
4640            // 'this' is exact and super or unrelated:
4641            (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) {
4642       if (above_centerline(ptr)) {
4643         tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable);
4644       }
4645       return make(NotNull, NULL, tary, lazy_klass, false, off, field_off, InstanceBot, speculative, depth);
4646     }
4647 
4648     bool xk = false;


5313   return ft;
5314 }
5315 
5316 //----------------------compute_klass------------------------------------------
5317 // Compute the defining klass for this class
5318 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
5319   // Compute _klass based on element type.
5320   ciKlass* k_ary = NULL;
5321   const TypeAryPtr *tary;
5322   const Type* el = elem();
5323   if (el->isa_narrowoop()) {
5324     el = el->make_ptr();
5325   }
5326 
5327   // Get element klass
5328   if (el->isa_instptr()) {
5329     // Compute object array klass from element klass
5330     bool null_free = el->is_valuetypeptr() && el->isa_instptr()->ptr() != TypePtr::TopPTR && !el->isa_instptr()->maybe_null();
5331     k_ary = ciArrayKlass::make(el->is_oopptr()->klass(), null_free);
5332   } else if (el->isa_valuetype()) {
5333     k_ary = ciArrayKlass::make(el->is_valuetype()->value_klass(), /* null_free */ true);
5334   } else if ((tary = el->isa_aryptr()) != NULL) {
5335     // Compute array klass from element klass
5336     ciKlass* k_elem = tary->klass();
5337     // If element type is something like bottom[], k_elem will be null.
5338     if (k_elem != NULL)
5339       k_ary = ciObjArrayKlass::make(k_elem);
5340   } else if ((el->base() == Type::Top) ||
5341              (el->base() == Type::Bottom)) {
5342     // element type of Bottom occurs from meet of basic type
5343     // and object; Top occurs when doing join on Bottom.
5344     // Leave k_ary at NULL.
5345   } else {
5346     // Cannot compute array klass directly from basic type,
5347     // since subtypes of TypeInt all have basic type T_INT.
5348 #ifdef ASSERT
5349     if (verify && el->isa_int()) {
5350       // Check simple cases when verifying klass.
5351       BasicType bt = T_ILLEGAL;
5352       if (el == TypeInt::BYTE) {
5353         bt = T_BYTE;




4605       // Integral array element types have irrelevant lattice relations.
4606       // It is the klass that determines array layout, not the element type.
4607       if (_klass == NULL)
4608         lazy_klass = tap->_klass;
4609       else if (tap->_klass == NULL || tap->_klass == _klass) {
4610         lazy_klass = _klass;
4611       } else {
4612         // Something like byte[int+] meets char[int+].
4613         // This must fall to bottom, not (int[-128..65535])[int+].
4614         instance_id = InstanceBot;
4615         tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable);
4616       }
4617     } else if (klass() != NULL && tap->klass() != NULL &&
4618                klass()->as_array_klass()->storage_properties().value() != tap->klass()->as_array_klass()->storage_properties().value()) {
4619       // Meeting value type arrays with conflicting storage properties
4620       if (tary->_elem->isa_valuetype()) {
4621         // Result is flattened
4622         off = Offset(elem()->isa_valuetype() ? offset() : tap->offset());
4623         field_off = elem()->isa_valuetype() ? field_offset() : tap->field_offset();
4624       } else if (tary->_elem->make_oopptr() != NULL && tary->_elem->make_oopptr()->isa_instptr() && below_centerline(ptr)) {
4625         // Result is non-flattened
4626         off = Offset(flattened_offset()).meet(Offset(tap->flattened_offset()));
4627         field_off = Offset::bottom;

4628       }
4629     } else // Non integral arrays.
4630       // Must fall to bottom if exact klasses in upper lattice
4631       // are not equal or super klass is exact.
4632       if ((above_centerline(ptr) || ptr == Constant) && klass() != tap->klass() &&
4633           // meet with top[] and bottom[] are processed further down:
4634           tap->_klass != NULL && this->_klass != NULL &&
4635           // both are exact and not equal:
4636           ((tap->_klass_is_exact && this->_klass_is_exact) ||
4637            // 'tap' is exact and super or unrelated:
4638            (tap->_klass_is_exact && !tap->klass()->is_subtype_of(klass())) ||
4639            // 'this' is exact and super or unrelated:
4640            (this->_klass_is_exact && !klass()->is_subtype_of(tap->klass())))) {
4641       if (above_centerline(ptr)) {
4642         tary = TypeAry::make(Type::BOTTOM, tary->_size, tary->_stable);
4643       }
4644       return make(NotNull, NULL, tary, lazy_klass, false, off, field_off, InstanceBot, speculative, depth);
4645     }
4646 
4647     bool xk = false;


5312   return ft;
5313 }
5314 
5315 //----------------------compute_klass------------------------------------------
5316 // Compute the defining klass for this class
5317 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
5318   // Compute _klass based on element type.
5319   ciKlass* k_ary = NULL;
5320   const TypeAryPtr *tary;
5321   const Type* el = elem();
5322   if (el->isa_narrowoop()) {
5323     el = el->make_ptr();
5324   }
5325 
5326   // Get element klass
5327   if (el->isa_instptr()) {
5328     // Compute object array klass from element klass
5329     bool null_free = el->is_valuetypeptr() && el->isa_instptr()->ptr() != TypePtr::TopPTR && !el->isa_instptr()->maybe_null();
5330     k_ary = ciArrayKlass::make(el->is_oopptr()->klass(), null_free);
5331   } else if (el->isa_valuetype()) {
5332     k_ary = ciArrayKlass::make(el->value_klass(), /* null_free */ true);
5333   } else if ((tary = el->isa_aryptr()) != NULL) {
5334     // Compute array klass from element klass
5335     ciKlass* k_elem = tary->klass();
5336     // If element type is something like bottom[], k_elem will be null.
5337     if (k_elem != NULL)
5338       k_ary = ciObjArrayKlass::make(k_elem);
5339   } else if ((el->base() == Type::Top) ||
5340              (el->base() == Type::Bottom)) {
5341     // element type of Bottom occurs from meet of basic type
5342     // and object; Top occurs when doing join on Bottom.
5343     // Leave k_ary at NULL.
5344   } else {
5345     // Cannot compute array klass directly from basic type,
5346     // since subtypes of TypeInt all have basic type T_INT.
5347 #ifdef ASSERT
5348     if (verify && el->isa_int()) {
5349       // Check simple cases when verifying klass.
5350       BasicType bt = T_ILLEGAL;
5351       if (el == TypeInt::BYTE) {
5352         bt = T_BYTE;


< prev index next >