提交 0f9d7325 编写于 作者: K kvn

6976400: "Meet Not Symmetric"

Summary: Use NULL as klass for TypeAryPtr::RANGE. Add klass verification into TypeAryPtr ctor.
Reviewed-by: never
上级 4f0e4610
...@@ -314,7 +314,7 @@ void Type::Initialize_shared(Compile* current) { ...@@ -314,7 +314,7 @@ void Type::Initialize_shared(Compile* current) {
mreg2type[Op_RegL] = TypeLong::LONG; mreg2type[Op_RegL] = TypeLong::LONG;
mreg2type[Op_RegFlags] = TypeInt::CC; mreg2type[Op_RegFlags] = TypeInt::CC;
TypeAryPtr::RANGE = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), current->env()->Object_klass(), false, arrayOopDesc::length_offset_in_bytes()); TypeAryPtr::RANGE = TypeAryPtr::make( TypePtr::BotPTR, TypeAry::make(Type::BOTTOM,TypeInt::POS), NULL /* current->env()->Object_klass() */, false, arrayOopDesc::length_offset_in_bytes());
TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), NULL /*ciArrayKlass::make(o)*/, false, Type::OffsetBot); TypeAryPtr::NARROWOOPS = TypeAryPtr::make(TypePtr::BotPTR, TypeAry::make(TypeNarrowOop::BOTTOM, TypeInt::POS), NULL /*ciArrayKlass::make(o)*/, false, Type::OffsetBot);
...@@ -3683,12 +3683,10 @@ int TypeKlassPtr::hash(void) const { ...@@ -3683,12 +3683,10 @@ int TypeKlassPtr::hash(void) const {
} }
//------------------------------klass------------------------------------------ //----------------------compute_klass------------------------------------------
// Return the defining klass for this class // Compute the defining klass for this class
ciKlass* TypeAryPtr::klass() const { ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {
if( _klass ) return _klass; // Return cached value, if possible // Compute _klass based on element type.
// Oops, need to compute _klass and cache it
ciKlass* k_ary = NULL; ciKlass* k_ary = NULL;
const TypeInstPtr *tinst; const TypeInstPtr *tinst;
const TypeAryPtr *tary; const TypeAryPtr *tary;
...@@ -3715,11 +3713,39 @@ ciKlass* TypeAryPtr::klass() const { ...@@ -3715,11 +3713,39 @@ ciKlass* TypeAryPtr::klass() const {
} else { } else {
// Cannot compute array klass directly from basic type, // Cannot compute array klass directly from basic type,
// since subtypes of TypeInt all have basic type T_INT. // since subtypes of TypeInt all have basic type T_INT.
#ifdef ASSERT
if (verify && el->isa_int()) {
// Check simple cases when verifying klass.
BasicType bt = T_ILLEGAL;
if (el == TypeInt::BYTE) {
bt = T_BYTE;
} else if (el == TypeInt::SHORT) {
bt = T_SHORT;
} else if (el == TypeInt::CHAR) {
bt = T_CHAR;
} else if (el == TypeInt::INT) {
bt = T_INT;
} else {
return _klass; // just return specified klass
}
return ciTypeArrayKlass::make(bt);
}
#endif
assert(!el->isa_int(), assert(!el->isa_int(),
"integral arrays must be pre-equipped with a class"); "integral arrays must be pre-equipped with a class");
// Compute array klass directly from basic type // Compute array klass directly from basic type
k_ary = ciTypeArrayKlass::make(el->basic_type()); k_ary = ciTypeArrayKlass::make(el->basic_type());
} }
return k_ary;
}
//------------------------------klass------------------------------------------
// Return the defining klass for this class
ciKlass* TypeAryPtr::klass() const {
if( _klass ) return _klass; // Return cached value, if possible
// Oops, need to compute _klass and cache it
ciKlass* k_ary = compute_klass();
if( this != TypeAryPtr::OOPS ) { if( this != TypeAryPtr::OOPS ) {
// The _klass field acts as a cache of the underlying // The _klass field acts as a cache of the underlying
......
...@@ -831,11 +831,30 @@ class TypeInstPtr : public TypeOopPtr { ...@@ -831,11 +831,30 @@ class TypeInstPtr : public TypeOopPtr {
//------------------------------TypeAryPtr------------------------------------- //------------------------------TypeAryPtr-------------------------------------
// Class of Java array pointers // Class of Java array pointers
class TypeAryPtr : public TypeOopPtr { class TypeAryPtr : public TypeOopPtr {
TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id ) : TypeOopPtr(AryPtr,ptr,k,xk,o,offset, instance_id), _ary(ary) {}; TypeAryPtr( PTR ptr, ciObject* o, const TypeAry *ary, ciKlass* k, bool xk, int offset, int instance_id ) : TypeOopPtr(AryPtr,ptr,k,xk,o,offset, instance_id), _ary(ary) {
#ifdef ASSERT
if (k != NULL) {
// Verify that specified klass and TypeAryPtr::klass() follow the same rules.
ciKlass* ck = compute_klass(true);
if (UseNewCode || k != ck) {
this->dump(); tty->cr();
tty->print(" k: ");
k->print(); tty->cr();
tty->print("ck: ");
if (ck != NULL) ck->print();
else tty->print("<NULL>");
tty->cr();
assert(false, "unexpected TypeAryPtr::_klass");
}
}
#endif
}
virtual bool eq( const Type *t ) const; virtual bool eq( const Type *t ) const;
virtual int hash() const; // Type specific hashing virtual int hash() const; // Type specific hashing
const TypeAry *_ary; // Array we point into const TypeAry *_ary; // Array we point into
ciKlass* compute_klass(DEBUG_ONLY(bool verify = false)) const;
public: public:
// Accessors // Accessors
ciKlass* klass() const; ciKlass* klass() const;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册