comparison src/share/vm/opto/type.cpp @ 1761:14b92b91f460

6976400: "Meet Not Symmetric" Summary: Use NULL as klass for TypeAryPtr::RANGE. Add klass verification into TypeAryPtr ctor. Reviewed-by: never
author kvn
date Thu, 26 Aug 2010 11:05:25 -0700
parents d678e3277048
children 114e6b93e9e1
comparison
equal deleted inserted replaced
1749:b4099f5786da 1761:14b92b91f460
312 mreg2type[Op_RegF] = Type::FLOAT; 312 mreg2type[Op_RegF] = Type::FLOAT;
313 mreg2type[Op_RegD] = Type::DOUBLE; 313 mreg2type[Op_RegD] = Type::DOUBLE;
314 mreg2type[Op_RegL] = TypeLong::LONG; 314 mreg2type[Op_RegL] = TypeLong::LONG;
315 mreg2type[Op_RegFlags] = TypeInt::CC; 315 mreg2type[Op_RegFlags] = TypeInt::CC;
316 316
317 TypeAryPtr::RANGE = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), current->env()->Object_klass(), false, arrayOopDesc::length_offset_in_bytes()); 317 TypeAryPtr::RANGE = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), NULL /* current->env()->Object_klass() */, false, arrayOopDesc::length_offset_in_bytes());
318 318
319 TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), NULL /*ciArrayKlass::make(o)*/, false, Type::OffsetBot); 319 TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), NULL /*ciArrayKlass::make(o)*/, false, Type::OffsetBot);
320 320
321 #ifdef _LP64 321 #ifdef _LP64
322 if (UseCompressedOops) { 322 if (UseCompressedOops) {
3681 int TypeKlassPtr::hash(void) const { 3681 int TypeKlassPtr::hash(void) const {
3682 return klass()->hash() + TypeOopPtr::hash(); 3682 return klass()->hash() + TypeOopPtr::hash();
3683 } 3683 }
3684 3684
3685 3685
3686 //------------------------------klass------------------------------------------ 3686 //----------------------compute_klass------------------------------------------
3687 // Return the defining klass for this class 3687 // Compute the defining klass for this class
3688 ciKlass* TypeAryPtr::klass() const { 3688 ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
3689 if( _klass ) return _klass; // Return cached value, if possible 3689 // Compute _klass based on element type.
3690
3691 // Oops, need to compute _klass and cache it
3692 ciKlass* k_ary = NULL; 3690 ciKlass* k_ary = NULL;
3693 const TypeInstPtr *tinst; 3691 const TypeInstPtr *tinst;
3694 const TypeAryPtr *tary; 3692 const TypeAryPtr *tary;
3695 const Type* el = elem(); 3693 const Type* el = elem();
3696 if (el->isa_narrowoop()) { 3694 if (el->isa_narrowoop()) {
3713 // and object; Top occurs when doing join on Bottom. 3711 // and object; Top occurs when doing join on Bottom.
3714 // Leave k_ary at NULL. 3712 // Leave k_ary at NULL.
3715 } else { 3713 } else {
3716 // Cannot compute array klass directly from basic type, 3714 // Cannot compute array klass directly from basic type,
3717 // since subtypes of TypeInt all have basic type T_INT. 3715 // since subtypes of TypeInt all have basic type T_INT.
3716 #ifdef ASSERT
3717 if (verify && el->isa_int()) {
3718 // Check simple cases when verifying klass.
3719 BasicType bt = T_ILLEGAL;
3720 if (el == TypeInt::BYTE) {
3721 bt = T_BYTE;
3722 } else if (el == TypeInt::SHORT) {
3723 bt = T_SHORT;
3724 } else if (el == TypeInt::CHAR) {
3725 bt = T_CHAR;
3726 } else if (el == TypeInt::INT) {
3727 bt = T_INT;
3728 } else {
3729 return _klass; // just return specified klass
3730 }
3731 return ciTypeArrayKlass::make(bt);
3732 }
3733 #endif
3718 assert(!el->isa_int(), 3734 assert(!el->isa_int(),
3719 "integral arrays must be pre-equipped with a class"); 3735 "integral arrays must be pre-equipped with a class");
3720 // Compute array klass directly from basic type 3736 // Compute array klass directly from basic type
3721 k_ary = ciTypeArrayKlass::make(el->basic_type()); 3737 k_ary = ciTypeArrayKlass::make(el->basic_type());
3722 } 3738 }
3739 return k_ary;
3740 }
3741
3742 //------------------------------klass------------------------------------------
3743 // Return the defining klass for this class
3744 ciKlass* TypeAryPtr::klass() const {
3745 if( _klass ) return _klass; // Return cached value, if possible
3746
3747 // Oops, need to compute _klass and cache it
3748 ciKlass* k_ary = compute_klass();
3723 3749
3724 if( this != TypeAryPtr::OOPS ) { 3750 if( this != TypeAryPtr::OOPS ) {
3725 // The _klass field acts as a cache of the underlying 3751 // The _klass field acts as a cache of the underlying
3726 // ciKlass for this array type. In order to set the field, 3752 // ciKlass for this array type. In order to set the field,
3727 // we need to cast away const-ness. 3753 // we need to cast away const-ness.