From ccc4166cb1a571aae993eaafc56cd3626d1ed39b Mon Sep 17 00:00:00 2001 From: never Date: Wed, 1 Jul 2009 12:22:23 -0700 Subject: [PATCH] 6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer") Reviewed-by: kvn --- src/share/vm/adlc/output_h.cpp | 4 ++-- src/share/vm/opto/graphKit.cpp | 2 +- src/share/vm/opto/library_call.cpp | 2 +- src/share/vm/opto/parse2.cpp | 2 +- src/share/vm/opto/parse3.cpp | 2 +- src/share/vm/opto/type.cpp | 22 +++++++++++----------- src/share/vm/opto/type.hpp | 27 ++++++++++++++++++--------- 7 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/share/vm/adlc/output_h.cpp b/src/share/vm/adlc/output_h.cpp index 4668d68f9..23f0827b2 100644 --- a/src/share/vm/adlc/output_h.cpp +++ b/src/share/vm/adlc/output_h.cpp @@ -1367,11 +1367,11 @@ void ArchDesc::declareClasses(FILE *fp) { else if (!strcmp(oper->ideal_type(_globalNames), "ConN")) { // Access the locally stored constant fprintf(fp," virtual intptr_t constant() const {"); - fprintf(fp, " return _c0->make_oopptr()->get_con();"); + fprintf(fp, " return _c0->get_ptrtype()->get_con();"); fprintf(fp, " }\n"); // Generate query to determine if this pointer is an oop fprintf(fp," virtual bool constant_is_oop() const {"); - fprintf(fp, " return _c0->make_oopptr()->isa_oop_ptr();"); + fprintf(fp, " return _c0->get_ptrtype()->isa_oop_ptr();"); fprintf(fp, " }\n"); } else if (!strcmp(oper->ideal_type(_globalNames), "ConL")) { diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp index 5bf9a759c..83646c54e 100644 --- a/src/share/vm/opto/graphKit.cpp +++ b/src/share/vm/opto/graphKit.cpp @@ -1480,7 +1480,7 @@ Node* GraphKit::store_oop_to_unknown(Node* ctl, } } } else if (adr_type->isa_aryptr()) { - val_type = adr_type->is_aryptr()->elem()->isa_oopptr(); + val_type = adr_type->is_aryptr()->elem()->make_oopptr(); } if (val_type == NULL) { val_type = TypeInstPtr::BOTTOM; diff --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp index 483c070e3..dc674f938 100644 --- a/src/share/vm/opto/library_call.cpp +++ b/src/share/vm/opto/library_call.cpp @@ -2393,7 +2393,7 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) { case T_OBJECT: // reference stores need a store barrier. // (They don't if CAS fails, but it isn't worth checking.) - pre_barrier(control(), base, adr, alias_idx, newval, value_type->is_oopptr(), T_OBJECT); + pre_barrier(control(), base, adr, alias_idx, newval, value_type->make_oopptr(), T_OBJECT); #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop())); diff --git a/src/share/vm/opto/parse2.cpp b/src/share/vm/opto/parse2.cpp index 19e486d83..40675d41c 100644 --- a/src/share/vm/opto/parse2.cpp +++ b/src/share/vm/opto/parse2.cpp @@ -1565,7 +1565,7 @@ void Parse::do_one_bytecode() { c = pop(); // Oop to store b = pop(); // index (already used) a = pop(); // the array itself - const TypeOopPtr* elemtype = _gvn.type(a)->is_aryptr()->elem()->is_oopptr(); + const TypeOopPtr* elemtype = _gvn.type(a)->is_aryptr()->elem()->make_oopptr(); const TypeAryPtr* adr_type = TypeAryPtr::OOPS; Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT); break; diff --git a/src/share/vm/opto/parse3.cpp b/src/share/vm/opto/parse3.cpp index 960b95c1c..0869ee6b6 100644 --- a/src/share/vm/opto/parse3.cpp +++ b/src/share/vm/opto/parse3.cpp @@ -361,7 +361,7 @@ Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, in guarantee(length_con >= 0, "non-constant multianewarray"); ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass(); const TypePtr* adr_type = TypeAryPtr::OOPS; - const TypeOopPtr* elemtype = _gvn.type(array)->is_aryptr()->elem()->is_oopptr(); + const TypeOopPtr* elemtype = _gvn.type(array)->is_aryptr()->elem()->make_oopptr(); const intptr_t header = arrayOopDesc::base_offset_in_bytes(T_OBJECT); for (jint i = 0; i < length_con; i++) { Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs); diff --git a/src/share/vm/opto/type.cpp b/src/share/vm/opto/type.cpp index 3c32c348c..1db520a42 100644 --- a/src/share/vm/opto/type.cpp +++ b/src/share/vm/opto/type.cpp @@ -3484,27 +3484,27 @@ const TypeNarrowOop* TypeNarrowOop::make(const TypePtr* type) { //------------------------------hash------------------------------------------- // Type-specific hashing function. int TypeNarrowOop::hash(void) const { - return _ooptype->hash() + 7; + return _ptrtype->hash() + 7; } bool TypeNarrowOop::eq( const Type *t ) const { const TypeNarrowOop* tc = t->isa_narrowoop(); if (tc != NULL) { - if (_ooptype->base() != tc->_ooptype->base()) { + if (_ptrtype->base() != tc->_ptrtype->base()) { return false; } - return tc->_ooptype->eq(_ooptype); + return tc->_ptrtype->eq(_ptrtype); } return false; } bool TypeNarrowOop::singleton(void) const { // TRUE if type is a singleton - return _ooptype->singleton(); + return _ptrtype->singleton(); } bool TypeNarrowOop::empty(void) const { - return _ooptype->empty(); + return _ptrtype->empty(); } //------------------------------xmeet------------------------------------------ @@ -3538,7 +3538,7 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const { return this; case NarrowOop: { - const Type* result = _ooptype->xmeet(t->make_ptr()); + const Type* result = _ptrtype->xmeet(t->make_ptr()); if (result->isa_ptr()) { return TypeNarrowOop::make(result->is_ptr()); } @@ -3554,13 +3554,13 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const { } const Type *TypeNarrowOop::xdual() const { // Compute dual right now. - const TypePtr* odual = _ooptype->dual()->is_ptr(); + const TypePtr* odual = _ptrtype->dual()->is_ptr(); return new TypeNarrowOop(odual); } const Type *TypeNarrowOop::filter( const Type *kills ) const { if (kills->isa_narrowoop()) { - const Type* ft =_ooptype->filter(kills->is_narrowoop()->_ooptype); + const Type* ft =_ptrtype->filter(kills->is_narrowoop()->_ptrtype); if (ft->empty()) return Type::TOP; // Canonical empty value if (ft->isa_ptr()) { @@ -3568,7 +3568,7 @@ const Type *TypeNarrowOop::filter( const Type *kills ) const { } return ft; } else if (kills->isa_ptr()) { - const Type* ft = _ooptype->join(kills); + const Type* ft = _ptrtype->join(kills); if (ft->empty()) return Type::TOP; // Canonical empty value return ft; @@ -3579,13 +3579,13 @@ const Type *TypeNarrowOop::filter( const Type *kills ) const { intptr_t TypeNarrowOop::get_con() const { - return _ooptype->get_con(); + return _ptrtype->get_con(); } #ifndef PRODUCT void TypeNarrowOop::dump2( Dict & d, uint depth, outputStream *st ) const { st->print("narrowoop: "); - _ooptype->dump2(d, depth, st); + _ptrtype->dump2(d, depth, st); } #endif diff --git a/src/share/vm/opto/type.hpp b/src/share/vm/opto/type.hpp index 1683c384b..064191491 100644 --- a/src/share/vm/opto/type.hpp +++ b/src/share/vm/opto/type.hpp @@ -232,6 +232,11 @@ public: // Returns this ptr type or the equivalent ptr type for this compressed pointer. const TypePtr* make_ptr() const; + + // Returns this oopptr type or the equivalent oopptr type for this compressed pointer. + // Asserts if the underlying type is not an oopptr or narrowoop. + const TypeOopPtr* make_oopptr() const; + // Returns this compressed pointer or the equivalent compressed version // of this pointer type. const TypeNarrowOop* make_narrowoop() const; @@ -932,13 +937,13 @@ public: // between the normal and the compressed form. class TypeNarrowOop : public Type { protected: - const TypePtr* _ooptype; // Could be TypePtr::NULL_PTR + const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR - TypeNarrowOop( const TypePtr* ooptype): Type(NarrowOop), - _ooptype(ooptype) { - assert(ooptype->offset() == 0 || - ooptype->offset() == OffsetBot || - ooptype->offset() == OffsetTop, "no real offsets"); + TypeNarrowOop( const TypePtr* ptrtype): Type(NarrowOop), + _ptrtype(ptrtype) { + assert(ptrtype->offset() == 0 || + ptrtype->offset() == OffsetBot || + ptrtype->offset() == OffsetTop, "no real offsets"); } public: virtual bool eq( const Type *t ) const; @@ -962,8 +967,8 @@ public: } // returns the equivalent ptr type for this compressed pointer - const TypePtr *make_oopptr() const { - return _ooptype; + const TypePtr *get_ptrtype() const { + return _ptrtype; } static const TypeNarrowOop *BOTTOM; @@ -1150,10 +1155,14 @@ inline const TypeKlassPtr *Type::is_klassptr() const { } inline const TypePtr* Type::make_ptr() const { - return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() : + return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype() : (isa_ptr() ? is_ptr() : NULL); } +inline const TypeOopPtr* Type::make_oopptr() const { + return (_base == NarrowOop) ? is_narrowoop()->get_ptrtype()->is_oopptr() : is_oopptr(); +} + inline const TypeNarrowOop* Type::make_narrowoop() const { return (_base == NarrowOop) ? is_narrowoop() : (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL); -- GitLab