提交 ccc4166c 编写于 作者: N never

6856025: assert(_base >= OopPtr && _base <= KlassPtr,"Not a Java pointer")

Reviewed-by: kvn
上级 95f21e03
...@@ -1367,11 +1367,11 @@ void ArchDesc::declareClasses(FILE *fp) { ...@@ -1367,11 +1367,11 @@ void ArchDesc::declareClasses(FILE *fp) {
else if (!strcmp(oper->ideal_type(_globalNames), "ConN")) { else if (!strcmp(oper->ideal_type(_globalNames), "ConN")) {
// Access the locally stored constant // Access the locally stored constant
fprintf(fp," virtual intptr_t constant() const {"); 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"); fprintf(fp, " }\n");
// Generate query to determine if this pointer is an oop // Generate query to determine if this pointer is an oop
fprintf(fp," virtual bool constant_is_oop() const {"); 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"); fprintf(fp, " }\n");
} }
else if (!strcmp(oper->ideal_type(_globalNames), "ConL")) { else if (!strcmp(oper->ideal_type(_globalNames), "ConL")) {
......
...@@ -1480,7 +1480,7 @@ Node* GraphKit::store_oop_to_unknown(Node* ctl, ...@@ -1480,7 +1480,7 @@ Node* GraphKit::store_oop_to_unknown(Node* ctl,
} }
} }
} else if (adr_type->isa_aryptr()) { } 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) { if (val_type == NULL) {
val_type = TypeInstPtr::BOTTOM; val_type = TypeInstPtr::BOTTOM;
......
...@@ -2393,7 +2393,7 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) { ...@@ -2393,7 +2393,7 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) {
case T_OBJECT: case T_OBJECT:
// reference stores need a store barrier. // reference stores need a store barrier.
// (They don't if CAS fails, but it isn't worth checking.) // (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 #ifdef _LP64
if (adr->bottom_type()->is_ptr_to_narrowoop()) { if (adr->bottom_type()->is_ptr_to_narrowoop()) {
Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop())); Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop()));
......
...@@ -1565,7 +1565,7 @@ void Parse::do_one_bytecode() { ...@@ -1565,7 +1565,7 @@ void Parse::do_one_bytecode() {
c = pop(); // Oop to store c = pop(); // Oop to store
b = pop(); // index (already used) b = pop(); // index (already used)
a = pop(); // the array itself 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; const TypeAryPtr* adr_type = TypeAryPtr::OOPS;
Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT); Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT);
break; break;
......
...@@ -361,7 +361,7 @@ Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, in ...@@ -361,7 +361,7 @@ Node* Parse::expand_multianewarray(ciArrayKlass* array_klass, Node* *lengths, in
guarantee(length_con >= 0, "non-constant multianewarray"); guarantee(length_con >= 0, "non-constant multianewarray");
ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass(); ciArrayKlass* array_klass_1 = array_klass->as_obj_array_klass()->element_klass()->as_array_klass();
const TypePtr* adr_type = TypeAryPtr::OOPS; 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); const intptr_t header = arrayOopDesc::base_offset_in_bytes(T_OBJECT);
for (jint i = 0; i < length_con; i++) { for (jint i = 0; i < length_con; i++) {
Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs); Node* elem = expand_multianewarray(array_klass_1, &lengths[1], ndimensions-1, nargs);
......
...@@ -3484,27 +3484,27 @@ const TypeNarrowOop* TypeNarrowOop::make(const TypePtr* type) { ...@@ -3484,27 +3484,27 @@ const TypeNarrowOop* TypeNarrowOop::make(const TypePtr* type) {
//------------------------------hash------------------------------------------- //------------------------------hash-------------------------------------------
// Type-specific hashing function. // Type-specific hashing function.
int TypeNarrowOop::hash(void) const { int TypeNarrowOop::hash(void) const {
return _ooptype->hash() + 7; return _ptrtype->hash() + 7;
} }
bool TypeNarrowOop::eq( const Type *t ) const { bool TypeNarrowOop::eq( const Type *t ) const {
const TypeNarrowOop* tc = t->isa_narrowoop(); const TypeNarrowOop* tc = t->isa_narrowoop();
if (tc != NULL) { if (tc != NULL) {
if (_ooptype->base() != tc->_ooptype->base()) { if (_ptrtype->base() != tc->_ptrtype->base()) {
return false; return false;
} }
return tc->_ooptype->eq(_ooptype); return tc->_ptrtype->eq(_ptrtype);
} }
return false; return false;
} }
bool TypeNarrowOop::singleton(void) const { // TRUE if type is a singleton bool TypeNarrowOop::singleton(void) const { // TRUE if type is a singleton
return _ooptype->singleton(); return _ptrtype->singleton();
} }
bool TypeNarrowOop::empty(void) const { bool TypeNarrowOop::empty(void) const {
return _ooptype->empty(); return _ptrtype->empty();
} }
//------------------------------xmeet------------------------------------------ //------------------------------xmeet------------------------------------------
...@@ -3538,7 +3538,7 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const { ...@@ -3538,7 +3538,7 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const {
return this; return this;
case NarrowOop: { case NarrowOop: {
const Type* result = _ooptype->xmeet(t->make_ptr()); const Type* result = _ptrtype->xmeet(t->make_ptr());
if (result->isa_ptr()) { if (result->isa_ptr()) {
return TypeNarrowOop::make(result->is_ptr()); return TypeNarrowOop::make(result->is_ptr());
} }
...@@ -3554,13 +3554,13 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const { ...@@ -3554,13 +3554,13 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const {
} }
const Type *TypeNarrowOop::xdual() const { // Compute dual right now. 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); return new TypeNarrowOop(odual);
} }
const Type *TypeNarrowOop::filter( const Type *kills ) const { const Type *TypeNarrowOop::filter( const Type *kills ) const {
if (kills->isa_narrowoop()) { 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()) if (ft->empty())
return Type::TOP; // Canonical empty value return Type::TOP; // Canonical empty value
if (ft->isa_ptr()) { if (ft->isa_ptr()) {
...@@ -3568,7 +3568,7 @@ const Type *TypeNarrowOop::filter( const Type *kills ) const { ...@@ -3568,7 +3568,7 @@ const Type *TypeNarrowOop::filter( const Type *kills ) const {
} }
return ft; return ft;
} else if (kills->isa_ptr()) { } else if (kills->isa_ptr()) {
const Type* ft = _ooptype->join(kills); const Type* ft = _ptrtype->join(kills);
if (ft->empty()) if (ft->empty())
return Type::TOP; // Canonical empty value return Type::TOP; // Canonical empty value
return ft; return ft;
...@@ -3579,13 +3579,13 @@ const Type *TypeNarrowOop::filter( const Type *kills ) const { ...@@ -3579,13 +3579,13 @@ const Type *TypeNarrowOop::filter( const Type *kills ) const {
intptr_t TypeNarrowOop::get_con() const { intptr_t TypeNarrowOop::get_con() const {
return _ooptype->get_con(); return _ptrtype->get_con();
} }
#ifndef PRODUCT #ifndef PRODUCT
void TypeNarrowOop::dump2( Dict & d, uint depth, outputStream *st ) const { void TypeNarrowOop::dump2( Dict & d, uint depth, outputStream *st ) const {
st->print("narrowoop: "); st->print("narrowoop: ");
_ooptype->dump2(d, depth, st); _ptrtype->dump2(d, depth, st);
} }
#endif #endif
......
...@@ -232,6 +232,11 @@ public: ...@@ -232,6 +232,11 @@ public:
// Returns this ptr type or the equivalent ptr type for this compressed pointer. // Returns this ptr type or the equivalent ptr type for this compressed pointer.
const TypePtr* make_ptr() const; 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 // Returns this compressed pointer or the equivalent compressed version
// of this pointer type. // of this pointer type.
const TypeNarrowOop* make_narrowoop() const; const TypeNarrowOop* make_narrowoop() const;
...@@ -932,13 +937,13 @@ public: ...@@ -932,13 +937,13 @@ public:
// between the normal and the compressed form. // between the normal and the compressed form.
class TypeNarrowOop : public Type { class TypeNarrowOop : public Type {
protected: protected:
const TypePtr* _ooptype; // Could be TypePtr::NULL_PTR const TypePtr* _ptrtype; // Could be TypePtr::NULL_PTR
TypeNarrowOop( const TypePtr* ooptype): Type(NarrowOop), TypeNarrowOop( const TypePtr* ptrtype): Type(NarrowOop),
_ooptype(ooptype) { _ptrtype(ptrtype) {
assert(ooptype->offset() == 0 || assert(ptrtype->offset() == 0 ||
ooptype->offset() == OffsetBot || ptrtype->offset() == OffsetBot ||
ooptype->offset() == OffsetTop, "no real offsets"); ptrtype->offset() == OffsetTop, "no real offsets");
} }
public: public:
virtual bool eq( const Type *t ) const; virtual bool eq( const Type *t ) const;
...@@ -962,8 +967,8 @@ public: ...@@ -962,8 +967,8 @@ public:
} }
// returns the equivalent ptr type for this compressed pointer // returns the equivalent ptr type for this compressed pointer
const TypePtr *make_oopptr() const { const TypePtr *get_ptrtype() const {
return _ooptype; return _ptrtype;
} }
static const TypeNarrowOop *BOTTOM; static const TypeNarrowOop *BOTTOM;
...@@ -1150,10 +1155,14 @@ inline const TypeKlassPtr *Type::is_klassptr() const { ...@@ -1150,10 +1155,14 @@ inline const TypeKlassPtr *Type::is_klassptr() const {
} }
inline const TypePtr* Type::make_ptr() 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); (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 { inline const TypeNarrowOop* Type::make_narrowoop() const {
return (_base == NarrowOop) ? is_narrowoop() : return (_base == NarrowOop) ? is_narrowoop() :
(isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL); (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册