1.1 --- a/src/share/vm/opto/type.cpp Wed Aug 25 10:31:45 2010 -0700 1.2 +++ b/src/share/vm/opto/type.cpp Thu Aug 26 11:05:25 2010 -0700 1.3 @@ -314,7 +314,7 @@ 1.4 mreg2type[Op_RegL] = TypeLong::LONG; 1.5 mreg2type[Op_RegFlags] = TypeInt::CC; 1.6 1.7 - TypeAryPtr::RANGE = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), current->env()->Object_klass(), false, arrayOopDesc::length_offset_in_bytes()); 1.8 + TypeAryPtr::RANGE = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), NULL /* current->env()->Object_klass() */, false, arrayOopDesc::length_offset_in_bytes()); 1.9 1.10 TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), NULL /*ciArrayKlass::make(o)*/, false, Type::OffsetBot); 1.11 1.12 @@ -3683,12 +3683,10 @@ 1.13 } 1.14 1.15 1.16 -//------------------------------klass------------------------------------------ 1.17 -// Return the defining klass for this class 1.18 -ciKlass* TypeAryPtr::klass() const { 1.19 - if( _klass ) return _klass; // Return cached value, if possible 1.20 - 1.21 - // Oops, need to compute _klass and cache it 1.22 +//----------------------compute_klass------------------------------------------ 1.23 +// Compute the defining klass for this class 1.24 +ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const { 1.25 + // Compute _klass based on element type. 1.26 ciKlass* k_ary = NULL; 1.27 const TypeInstPtr *tinst; 1.28 const TypeAryPtr *tary; 1.29 @@ -3715,11 +3713,39 @@ 1.30 } else { 1.31 // Cannot compute array klass directly from basic type, 1.32 // since subtypes of TypeInt all have basic type T_INT. 1.33 +#ifdef ASSERT 1.34 + if (verify && el->isa_int()) { 1.35 + // Check simple cases when verifying klass. 1.36 + BasicType bt = T_ILLEGAL; 1.37 + if (el == TypeInt::BYTE) { 1.38 + bt = T_BYTE; 1.39 + } else if (el == TypeInt::SHORT) { 1.40 + bt = T_SHORT; 1.41 + } else if (el == TypeInt::CHAR) { 1.42 + bt = T_CHAR; 1.43 + } else if (el == TypeInt::INT) { 1.44 + bt = T_INT; 1.45 + } else { 1.46 + return _klass; // just return specified klass 1.47 + } 1.48 + return ciTypeArrayKlass::make(bt); 1.49 + } 1.50 +#endif 1.51 assert(!el->isa_int(), 1.52 "integral arrays must be pre-equipped with a class"); 1.53 // Compute array klass directly from basic type 1.54 k_ary = ciTypeArrayKlass::make(el->basic_type()); 1.55 } 1.56 + return k_ary; 1.57 +} 1.58 + 1.59 +//------------------------------klass------------------------------------------ 1.60 +// Return the defining klass for this class 1.61 +ciKlass* TypeAryPtr::klass() const { 1.62 + if( _klass ) return _klass; // Return cached value, if possible 1.63 + 1.64 + // Oops, need to compute _klass and cache it 1.65 + ciKlass* k_ary = compute_klass(); 1.66 1.67 if( this != TypeAryPtr::OOPS ) { 1.68 // The _klass field acts as a cache of the underlying