# HG changeset patch # User kvn # Date 1214329409 25200 # Node ID 1e026f8da8279e8f764ac13758285d90fe6a413f # Parent 30369db7f5d249129d8af61dba73158681fedd21 6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode Summary: Remove DecodeNNode::decode() and EncodePNode::encode() methods. Reviewed-by: rasbold, never diff -r 30369db7f5d2 -r 1e026f8da827 src/cpu/sparc/vm/sparc.ad --- a/src/cpu/sparc/vm/sparc.ad Mon Jun 23 18:21:18 2008 -0700 +++ b/src/cpu/sparc/vm/sparc.ad Tue Jun 24 10:43:29 2008 -0700 @@ -5955,7 +5955,7 @@ // Convert oop pointer into compressed form instruct encodeHeapOop(iRegN dst, iRegP src) %{ - predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() != TypePtr::NotNull); + predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull); match(Set dst (EncodeP src)); format %{ "encode_heap_oop $src, $dst" %} ins_encode %{ @@ -5965,7 +5965,7 @@ %} instruct encodeHeapOop_not_null(iRegN dst, iRegP src) %{ - predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() == TypePtr::NotNull); + predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull); match(Set dst (EncodeP src)); format %{ "encode_heap_oop_not_null $src, $dst" %} ins_encode %{ diff -r 30369db7f5d2 -r 1e026f8da827 src/cpu/x86/vm/x86_64.ad --- a/src/cpu/x86/vm/x86_64.ad Mon Jun 23 18:21:18 2008 -0700 +++ b/src/cpu/x86/vm/x86_64.ad Tue Jun 24 10:43:29 2008 -0700 @@ -7060,7 +7060,7 @@ // Convert oop pointer into compressed form instruct encodeHeapOop(rRegN dst, rRegP src, rFlagsReg cr) %{ - predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() != TypePtr::NotNull); + predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull); match(Set dst (EncodeP src)); effect(KILL cr); format %{ "encode_heap_oop $dst,$src" %} @@ -7076,7 +7076,7 @@ %} instruct encodeHeapOop_not_null(rRegN dst, rRegP src, rFlagsReg cr) %{ - predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() == TypePtr::NotNull); + predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull); match(Set dst (EncodeP src)); effect(KILL cr); format %{ "encode_heap_oop_not_null $dst,$src" %} diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/cfgnode.cpp --- a/src/share/vm/opto/cfgnode.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/cfgnode.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -854,7 +854,8 @@ // Until we have harmony between classes and interfaces in the type // lattice, we must tread carefully around phis which implicitly // convert the one to the other. - const TypeInstPtr* ttip = _type->isa_narrowoop() ? _type->isa_narrowoop()->make_oopptr()->isa_instptr() :_type->isa_instptr(); + const TypePtr* ttp = _type->make_ptr(); + const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL; bool is_intf = false; if (ttip != NULL) { ciKlass* k = ttip->klass(); @@ -873,7 +874,8 @@ // of all the input types. The lattice is not distributive in // such cases. Ward off asserts in type.cpp by refusing to do // meets between interfaces and proper classes. - const TypeInstPtr* tiip = ti->isa_narrowoop() ? ti->is_narrowoop()->make_oopptr()->isa_instptr() : ti->isa_instptr(); + const TypePtr* tip = ti->make_ptr(); + const TypeInstPtr* tiip = (tip != NULL) ? tip->isa_instptr() : NULL; if (tiip) { bool ti_is_intf = false; ciKlass* k = tiip->klass(); @@ -930,13 +932,14 @@ // class-typed Phi and an interface flows in, it's possible that the meet & // join report an interface back out. This isn't possible but happens // because the type system doesn't interact well with interfaces. - const TypeInstPtr *jtip = jt->isa_narrowoop() ? jt->isa_narrowoop()->make_oopptr()->isa_instptr() : jt->isa_instptr(); + const TypePtr *jtp = jt->make_ptr(); + const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL; if( jtip && ttip ) { if( jtip->is_loaded() && jtip->klass()->is_interface() && ttip->is_loaded() && !ttip->klass()->is_interface() ) { // Happens in a CTW of rt.jar, 320-341, no extra flags assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) || - ft->isa_narrowoop() && ft->isa_narrowoop()->make_oopptr() == ttip->cast_to_ptr_type(jtip->ptr()), ""); + ft->isa_narrowoop() && ft->make_ptr() == ttip->cast_to_ptr_type(jtip->ptr()), ""); jt = ft; } } diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/compile.cpp --- a/src/share/vm/opto/compile.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/compile.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -2017,7 +2017,7 @@ for (uint i = 0; i < cnt; i++) { Node* m = r->raw_out(i); if (m!= NULL && m->Opcode() == Op_ConN && - m->bottom_type()->is_narrowoop()->make_oopptr() == t) { + m->bottom_type()->make_ptr() == t) { nn = m; break; } @@ -2070,7 +2070,7 @@ } } } else if (t->isa_oopptr()) { - in2 = ConNode::make(C, t->is_oopptr()->make_narrowoop()); + in2 = ConNode::make(C, t->make_narrowoop()); } } if( in2 != NULL ) { diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/connode.cpp --- a/src/share/vm/opto/connode.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/connode.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -570,23 +570,7 @@ if (t == TypeNarrowOop::NULL_PTR) return TypePtr::NULL_PTR; assert(t->isa_narrowoop(), "only narrowoop here"); - return t->is_narrowoop()->make_oopptr(); -} - -Node* DecodeNNode::decode(PhaseTransform* phase, Node* value) { - if (value->is_EncodeP()) { - // (DecodeN (EncodeP p)) -> p - return value->in(1); - } - const Type* newtype = value->bottom_type(); - if (newtype == TypeNarrowOop::NULL_PTR) { - return phase->transform(new (phase->C, 1) ConPNode(TypePtr::NULL_PTR)); - } else if (newtype->isa_narrowoop()) { - return phase->transform(new (phase->C, 2) DecodeNNode(value, newtype->is_narrowoop()->make_oopptr())); - } else { - ShouldNotReachHere(); - return NULL; // to make C++ compiler happy. - } + return t->make_ptr(); } Node* EncodePNode::Identity(PhaseTransform* phase) { @@ -606,24 +590,9 @@ if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR; assert(t->isa_oopptr(), "only oopptr here"); - return t->is_oopptr()->make_narrowoop(); + return t->make_narrowoop(); } -Node* EncodePNode::encode(PhaseTransform* phase, Node* value) { - if (value->is_DecodeN()) { - // (EncodeP (DecodeN p)) -> p - return value->in(1); - } - const Type* newtype = value->bottom_type(); - if (newtype == TypePtr::NULL_PTR) { - return phase->transform(new (phase->C, 1) ConNNode(TypeNarrowOop::NULL_PTR)); - } else if (newtype->isa_oopptr()) { - return phase->transform(new (phase->C, 2) EncodePNode(value, newtype->is_oopptr()->make_narrowoop())); - } else { - ShouldNotReachHere(); - return NULL; // to make C++ compiler happy. - } -} Node *EncodePNode::Ideal_DU_postCCP( PhaseCCP *ccp ) { return MemNode::Ideal_common_DU_postCCP(ccp, this, in(1)); diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/connode.hpp --- a/src/share/vm/opto/connode.hpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/connode.hpp Tue Jun 24 10:43:29 2008 -0700 @@ -280,7 +280,6 @@ virtual const Type *Value( PhaseTransform *phase ) const; virtual uint ideal_reg() const { return Op_RegN; } - static Node* encode(PhaseTransform* phase, Node* value); virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp ); }; @@ -300,8 +299,6 @@ virtual Node *Identity( PhaseTransform *phase ); virtual const Type *Value( PhaseTransform *phase ) const; virtual uint ideal_reg() const { return Op_RegP; } - - static Node* decode(PhaseTransform* phase, Node* value); }; //------------------------------Conv2BNode------------------------------------- diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/escape.cpp --- a/src/share/vm/opto/escape.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/escape.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -962,13 +962,8 @@ assert(tinst != NULL && tinst->is_instance() && tinst->instance_id() == elem , "instance type expected."); - const TypeOopPtr *tn_t = NULL; const Type *tn_type = igvn->type(tn); - if (tn_type->isa_narrowoop()) { - tn_t = tn_type->is_narrowoop()->make_oopptr()->isa_oopptr(); - } else { - tn_t = tn_type->isa_oopptr(); - } + const TypeOopPtr *tn_t = tn_type->make_ptr()->isa_oopptr(); if (tn_t != NULL && tinst->cast_to_instance(TypeOopPtr::UNKNOWN_INSTANCE)->higher_equal(tn_t)) { @@ -1921,9 +1916,7 @@ case Op_StoreN: { const Type *adr_type = phase->type(n->in(MemNode::Address)); - if (adr_type->isa_narrowoop()) { - adr_type = adr_type->is_narrowoop()->make_oopptr(); - } + adr_type = adr_type->make_ptr(); if (adr_type->isa_oopptr()) { add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); } else { @@ -1948,9 +1941,7 @@ case Op_CompareAndSwapN: { const Type *adr_type = phase->type(n->in(MemNode::Address)); - if (adr_type->isa_narrowoop()) { - adr_type = adr_type->is_narrowoop()->make_oopptr(); - } + adr_type = adr_type->make_ptr(); if (adr_type->isa_oopptr()) { add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); } else { @@ -2131,10 +2122,7 @@ case Op_CompareAndSwapN: { Node *adr = n->in(MemNode::Address); - const Type *adr_type = phase->type(adr); - if (adr_type->isa_narrowoop()) { - adr_type = adr_type->is_narrowoop()->make_oopptr(); - } + const Type *adr_type = phase->type(adr)->make_ptr(); #ifdef ASSERT if (!adr_type->isa_oopptr()) assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP"); diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/library_call.cpp --- a/src/share/vm/opto/library_call.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/library_call.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -2194,14 +2194,15 @@ pre_barrier(control(), base, adr, alias_idx, newval, value_type, 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())); + Node *oldval_enc = _gvn.transform(new (C, 2) EncodePNode(oldval, oldval->bottom_type()->make_narrowoop())); cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr, - EncodePNode::encode(&_gvn, newval), - EncodePNode::encode(&_gvn, oldval))); + newval_enc, oldval_enc)); } else #endif - { - cas = _gvn.transform(new (C, 5) CompareAndSwapPNode(control(), mem, adr, newval, oldval)); - } + { + cas = _gvn.transform(new (C, 5) CompareAndSwapPNode(control(), mem, adr, newval, oldval)); + } post_barrier(control(), cas, base, adr, alias_idx, newval, T_OBJECT, true); break; default: diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/machnode.cpp --- a/src/share/vm/opto/machnode.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/machnode.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -262,19 +262,19 @@ // Now we have collected every part of the ADLC MEMORY_INTER. // See if it adds up to a base + offset. if (index != NULL) { - const TypeNarrowOop* narrowoop = index->bottom_type()->isa_narrowoop(); - if (narrowoop != NULL) { // EncodeN, LoadN, LoadConN, LoadNKlass. + const Type* t_index = index->bottom_type(); + if (t_index->isa_narrowoop()) { // EncodeN, LoadN, LoadConN, LoadNKlass. // Memory references through narrow oops have a // funny base so grab the type from the index: // [R12 + narrow_oop_reg<<3 + offset] assert(base == NULL, "Memory references through narrow oops have no base"); offset = disp; - adr_type = narrowoop->make_oopptr()->add_offset(offset); + adr_type = t_index->make_ptr()->add_offset(offset); return NULL; } else if (!index->is_Con()) { disp = Type::OffsetBot; } else if (disp != Type::OffsetBot) { - const TypeX* ti = index->bottom_type()->isa_intptr_t(); + const TypeX* ti = t_index->isa_intptr_t(); if (ti == NULL) { disp = Type::OffsetBot; // a random constant?? } else { diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/macro.cpp --- a/src/share/vm/opto/macro.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/macro.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -598,7 +598,7 @@ field_type = TypeOopPtr::make_from_klass(elem_type->as_klass()); } if (UseCompressedOops) { - field_type = field_type->is_oopptr()->make_narrowoop(); + field_type = field_type->make_narrowoop(); basic_elem_type = T_NARROWOOP; } } else { @@ -666,9 +666,11 @@ if (UseCompressedOops && field_type->isa_narrowoop()) { // Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation // to be able scalar replace the allocation. - _igvn.set_delay_transform(false); - field_val = DecodeNNode::decode(&_igvn, field_val); - _igvn.set_delay_transform(true); + if (field_val->is_EncodeP()) { + field_val = field_val->in(1); + } else { + field_val = transform_later(new (C, 2) DecodeNNode(field_val, field_val->bottom_type()->make_ptr())); + } } sfpt->add_req(field_val); } diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/matcher.cpp --- a/src/share/vm/opto/matcher.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/matcher.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -1766,8 +1766,8 @@ } case Op_ConN: { // Convert narrow pointers above the centerline to NUL TypeNode *tn = n->as_Type(); // Constants derive from type nodes - const TypePtr* tp = tn->type()->is_narrowoop()->make_oopptr(); - if (tp->_ptr == TypePtr::AnyNull) { + const TypePtr* tp = tn->type()->make_ptr(); + if (tp && tp->_ptr == TypePtr::AnyNull) { tn->set_type(TypeNarrowOop::NULL_PTR); } break; diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/memnode.cpp --- a/src/share/vm/opto/memnode.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/memnode.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -769,15 +769,8 @@ case T_OBJECT: #ifdef _LP64 if (adr->bottom_type()->is_ptr_to_narrowoop()) { - const TypeNarrowOop* narrowtype; - if (rt->isa_narrowoop()) { - narrowtype = rt->is_narrowoop(); - } else { - narrowtype = rt->is_oopptr()->make_narrowoop(); - } - Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, narrowtype)); - - return DecodeNNode::decode(&gvn, load); + Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop())); + return new (C, 2) DecodeNNode(load, load->bottom_type()->make_ptr()); } else #endif { @@ -1631,9 +1624,8 @@ assert(adr_type != NULL, "expecting TypeOopPtr"); #ifdef _LP64 if (adr_type->is_ptr_to_narrowoop()) { - const TypeNarrowOop* narrowtype = tk->is_oopptr()->make_narrowoop(); - Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, narrowtype)); - return DecodeNNode::decode(&gvn, load_klass); + Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop())); + return new (C, 2) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr()); } #endif assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop"); @@ -1843,15 +1835,10 @@ //------------------------------Value------------------------------------------ const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const { const Type *t = klass_value_common(phase); - - if (t == TypePtr::NULL_PTR) { - return TypeNarrowOop::NULL_PTR; - } - if (t != Type::TOP && !t->isa_narrowoop()) { - assert(t->is_oopptr(), "sanity"); - t = t->is_oopptr()->make_narrowoop(); - } - return t; + if (t == Type::TOP) + return t; + + return t->make_narrowoop(); } //------------------------------Identity--------------------------------------- @@ -1864,7 +1851,7 @@ if( t == Type::TOP ) return x; if( t->isa_narrowoop()) return x; - return EncodePNode::encode(phase, x); + return phase->transform(new (phase->C, 2) EncodePNode(x, t->make_narrowoop())); } //------------------------------Value----------------------------------------- @@ -1930,14 +1917,13 @@ if (adr->bottom_type()->is_ptr_to_narrowoop() || (UseCompressedOops && val->bottom_type()->isa_klassptr() && adr->bottom_type()->isa_rawptr())) { - const TypePtr* type = val->bottom_type()->is_ptr(); - Node* cp = EncodePNode::encode(&gvn, val); - return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, cp); + val = gvn.transform(new (C, 2) EncodePNode(val, val->bottom_type()->make_narrowoop())); + return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, val); } else #endif - { - return new (C, 4) StorePNode(ctl, mem, adr, adr_type, val); - } + { + return new (C, 4) StorePNode(ctl, mem, adr, adr_type, val); + } } ShouldNotReachHere(); return (StoreNode*)NULL; diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/parse2.cpp --- a/src/share/vm/opto/parse2.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/parse2.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -67,12 +67,9 @@ const Type* elemtype = arytype->elem(); if (UseUniqueSubclasses && result2 != NULL) { - const Type* el = elemtype; - if (elemtype->isa_narrowoop()) { - el = elemtype->is_narrowoop()->make_oopptr(); - } - const TypeInstPtr* toop = el->isa_instptr(); - if (toop) { + const Type* el = elemtype->make_ptr(); + if (el && el->isa_instptr()) { + const TypeInstPtr* toop = el->is_instptr(); if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) { // If we load from "AbstractClass[]" we must see "ConcreteSubClass". const Type* subklass = Type::get_const_type(toop->klass()); diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/subnode.cpp --- a/src/share/vm/opto/subnode.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/subnode.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -743,8 +743,8 @@ // Simplify an CmpN (compare 2 pointers) node, based on local information. // If both inputs are constants, compare them. const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const { - const TypePtr *r0 = t1->is_narrowoop()->make_oopptr(); // Handy access - const TypePtr *r1 = t2->is_narrowoop()->make_oopptr(); + const TypePtr *r0 = t1->make_ptr(); // Handy access + const TypePtr *r1 = t2->make_ptr(); // Undefined inputs makes for an undefined result if( TypePtr::above_centerline(r0->_ptr) || diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/superword.cpp --- a/src/share/vm/opto/superword.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/superword.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -1424,9 +1424,9 @@ //---------------------------container_type--------------------------- // Smallest type containing range of values const Type* SuperWord::container_type(const Type* t) { - if (t->isa_narrowoop()) t = t->is_narrowoop()->make_oopptr(); - if (t->isa_aryptr()) { - t = t->is_aryptr()->elem(); + const Type* tp = t->make_ptr(); + if (tp && tp->isa_aryptr()) { + t = tp->is_aryptr()->elem(); } if (t->basic_type() == T_INT) { if (t->higher_equal(TypeInt::BOOL)) return TypeInt::BOOL; diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/type.cpp --- a/src/share/vm/opto/type.cpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/type.cpp Tue Jun 24 10:43:29 2008 -0700 @@ -168,7 +168,20 @@ const Type *Type::make( enum TYPES t ) { return (new Type(t))->hashcons(); } - +/* +//------------------------------make_ptr--------------------------------------- +// Returns this ptr type or the equivalent ptr type for this compressed pointer. +const TypePtr* Type::make_ptr() const { + return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() : is_ptr(); +} + +//------------------------------make_narrowoop--------------------------------- +// Returns this compressed pointer or the equivalent compressed version +// of this pointer type. +const TypeNarrowOop* Type::make_narrowoop() const { + return (_base == NarrowOop) ? is_narrowoop() : TypeNarrowOop::make(is_ptr()); +} +*/ //------------------------------cmp-------------------------------------------- int Type::cmp( const Type *const t1, const Type *const t2 ) { if( t1->_base != t2->_base ) @@ -491,14 +504,8 @@ // commutative and the lattice is symmetric. const Type *Type::meet( const Type *t ) const { if (isa_narrowoop() && t->isa_narrowoop()) { - const Type* result = is_narrowoop()->make_oopptr()->meet(t->is_narrowoop()->make_oopptr()); - if (result->isa_oopptr()) { - return result->isa_oopptr()->make_narrowoop(); - } else if (result == TypePtr::NULL_PTR) { - return TypeNarrowOop::NULL_PTR; - } else { - return result; - } + const Type* result = make_ptr()->meet(t->make_ptr()); + return result->make_narrowoop(); } const Type *mt = xmeet(t); @@ -1764,7 +1771,7 @@ //------------------------------make------------------------------------------- const TypeAry *TypeAry::make( const Type *elem, const TypeInt *size) { if (UseCompressedOops && elem->isa_oopptr()) { - elem = elem->is_oopptr()->make_narrowoop(); + elem = elem->make_narrowoop(); } size = normalize_array_size(size); return (TypeAry*)(new TypeAry(elem,size))->hashcons(); @@ -1849,9 +1856,8 @@ if (_elem == BOTTOM) return false; // general array not exact if (_elem == TOP ) return false; // inverted general array not exact const TypeOopPtr* toop = NULL; - if (UseCompressedOops) { - const TypeNarrowOop* noop = _elem->isa_narrowoop(); - if (noop) toop = noop->make_oopptr()->isa_oopptr(); + if (UseCompressedOops && _elem->isa_narrowoop()) { + toop = _elem->make_ptr()->isa_oopptr(); } else { toop = _elem->isa_oopptr(); } @@ -1861,16 +1867,18 @@ if (!tklass->is_loaded()) return false; // unloaded class const TypeInstPtr* tinst; if (_elem->isa_narrowoop()) - tinst = _elem->is_narrowoop()->make_oopptr()->isa_instptr(); + tinst = _elem->make_ptr()->isa_instptr(); else tinst = _elem->isa_instptr(); - if (tinst) return tklass->as_instance_klass()->is_final(); + if (tinst) + return tklass->as_instance_klass()->is_final(); const TypeAryPtr* tap; if (_elem->isa_narrowoop()) - tap = _elem->is_narrowoop()->make_oopptr()->isa_aryptr(); + tap = _elem->make_ptr()->isa_aryptr(); else tap = _elem->isa_aryptr(); - if (tap) return tap->ary()->ary_must_be_exact(); + if (tap) + return tap->ary()->ary_must_be_exact(); return false; } @@ -2579,10 +2587,6 @@ return make( _ptr, xadd_offset(offset) ); } -const TypeNarrowOop* TypeOopPtr::make_narrowoop() const { - return TypeNarrowOop::make(this); -} - int TypeOopPtr::meet_instance(int iid) const { if (iid == 0) { return (_instance_id < 0) ? _instance_id : UNKNOWN_INSTANCE; @@ -3494,7 +3498,7 @@ return this; case NarrowOop: { - const Type* result = _ooptype->xmeet(t->is_narrowoop()->make_oopptr()); + const Type* result = _ooptype->xmeet(t->make_ptr()); if (result->isa_ptr()) { return TypeNarrowOop::make(result->is_ptr()); } @@ -3604,7 +3608,7 @@ const TypeAryPtr *tary; const Type* el = elem(); if (el->isa_narrowoop()) { - el = el->is_narrowoop()->make_oopptr(); + el = el->make_ptr(); } // Get element klass diff -r 30369db7f5d2 -r 1e026f8da827 src/share/vm/opto/type.hpp --- a/src/share/vm/opto/type.hpp Mon Jun 23 18:21:18 2008 -0700 +++ b/src/share/vm/opto/type.hpp Tue Jun 24 10:43:29 2008 -0700 @@ -225,6 +225,12 @@ virtual bool is_finite() const; // Has a finite value virtual bool is_nan() const; // Is not a number (NaN) + // Returns this ptr type or the equivalent ptr type for this compressed pointer. + const TypePtr* make_ptr() const; + // Returns this compressed pointer or the equivalent compressed version + // of this pointer type. + const TypeNarrowOop* make_narrowoop() const; + // Special test for register pressure heuristic bool is_floatingpoint() const; // True if Float or Double base type @@ -718,9 +724,6 @@ virtual const TypePtr *add_offset( int offset ) const; - // returns the equivalent compressed version of this pointer type - virtual const TypeNarrowOop* make_narrowoop() const; - virtual const Type *xmeet( const Type *t ) const; virtual const Type *xdual() const; // Compute dual right now. @@ -911,7 +914,7 @@ // between the normal and the compressed form. class TypeNarrowOop : public Type { protected: - const TypePtr* _ooptype; + const TypePtr* _ooptype; // Could be TypePtr::NULL_PTR TypeNarrowOop( const TypePtr* ooptype): Type(NarrowOop), _ooptype(ooptype) { @@ -940,8 +943,8 @@ return make(TypeOopPtr::make_from_constant(con)); } - // returns the equivalent oopptr type for this compressed pointer - virtual const TypePtr *make_oopptr() const { + // returns the equivalent ptr type for this compressed pointer + const TypePtr *make_oopptr() const { return _ooptype; } @@ -1128,6 +1131,16 @@ return (TypeKlassPtr*)this; } +inline const TypePtr* Type::make_ptr() const { + return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() : + (isa_ptr() ? is_ptr() : NULL); +} + +inline const TypeNarrowOop* Type::make_narrowoop() const { + return (_base == NarrowOop) ? is_narrowoop() : + (isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL); +} + inline bool Type::is_floatingpoint() const { if( (_base == FloatCon) || (_base == FloatBot) || (_base == DoubleCon) || (_base == DoubleBot) )