From d38d0b0bdcf3620502c088a47c07ae933ec5b589 Mon Sep 17 00:00:00 2001 From: kvn Date: Tue, 24 Jun 2008 10:43:29 -0700 Subject: [PATCH] 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 --- src/cpu/sparc/vm/sparc.ad | 4 +-- src/cpu/x86/vm/x86_64.ad | 4 +-- src/share/vm/opto/cfgnode.cpp | 11 ++++--- src/share/vm/opto/compile.cpp | 4 +-- src/share/vm/opto/connode.cpp | 35 ++-------------------- src/share/vm/opto/connode.hpp | 3 -- src/share/vm/opto/escape.cpp | 20 +++---------- src/share/vm/opto/library_call.cpp | 11 +++---- src/share/vm/opto/machnode.cpp | 8 ++--- src/share/vm/opto/macro.cpp | 10 ++++--- src/share/vm/opto/matcher.cpp | 4 +-- src/share/vm/opto/memnode.cpp | 40 ++++++++----------------- src/share/vm/opto/parse2.cpp | 9 ++---- src/share/vm/opto/subnode.cpp | 4 +-- src/share/vm/opto/superword.cpp | 6 ++-- src/share/vm/opto/type.cpp | 48 ++++++++++++++++-------------- src/share/vm/opto/type.hpp | 25 ++++++++++++---- 17 files changed, 103 insertions(+), 143 deletions(-) diff --git a/src/cpu/sparc/vm/sparc.ad b/src/cpu/sparc/vm/sparc.ad index 39e854ee5..9d4bb2b15 100644 --- a/src/cpu/sparc/vm/sparc.ad +++ b/src/cpu/sparc/vm/sparc.ad @@ -5955,7 +5955,7 @@ instruct storeA8B(memory mem, regD src) %{ // 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(iRegN dst, iRegP src) %{ %} 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 --git a/src/cpu/x86/vm/x86_64.ad b/src/cpu/x86/vm/x86_64.ad index 41d1abfec..4f16521a8 100644 --- a/src/cpu/x86/vm/x86_64.ad +++ b/src/cpu/x86/vm/x86_64.ad @@ -7060,7 +7060,7 @@ instruct castP2X(rRegL dst, rRegP src) // 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(rRegN dst, rRegP src, rFlagsReg cr) %{ %} 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 --git a/src/share/vm/opto/cfgnode.cpp b/src/share/vm/opto/cfgnode.cpp index 0f5a7323d..873e339ab 100644 --- a/src/share/vm/opto/cfgnode.cpp +++ b/src/share/vm/opto/cfgnode.cpp @@ -854,7 +854,8 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const { // 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 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const { // 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 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const { // 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 --git a/src/share/vm/opto/compile.cpp b/src/share/vm/opto/compile.cpp index 29484546d..6f3c160d7 100644 --- a/src/share/vm/opto/compile.cpp +++ b/src/share/vm/opto/compile.cpp @@ -2017,7 +2017,7 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { 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 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { } } } 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 --git a/src/share/vm/opto/connode.cpp b/src/share/vm/opto/connode.cpp index f86204e26..caa1f1beb 100644 --- a/src/share/vm/opto/connode.cpp +++ b/src/share/vm/opto/connode.cpp @@ -570,23 +570,7 @@ const Type *DecodeNNode::Value( PhaseTransform *phase ) const { 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 @@ const Type *EncodePNode::Value( PhaseTransform *phase ) const { 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 --git a/src/share/vm/opto/connode.hpp b/src/share/vm/opto/connode.hpp index cd690a3f8..0591959d1 100644 --- a/src/share/vm/opto/connode.hpp +++ b/src/share/vm/opto/connode.hpp @@ -280,7 +280,6 @@ class EncodePNode : public TypeNode { 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 @@ class DecodeNNode : public TypeNode { 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 --git a/src/share/vm/opto/escape.cpp b/src/share/vm/opto/escape.cpp index 181c0d5ad..90a3f0d63 100644 --- a/src/share/vm/opto/escape.cpp +++ b/src/share/vm/opto/escape.cpp @@ -962,13 +962,8 @@ void ConnectionGraph::split_unique_types(GrowableArray &alloc_worklist) 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 @@ void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase) 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 @@ void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase) 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 @@ void ConnectionGraph::build_connection_graph(Node *n, PhaseTransform *phase) { 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 --git a/src/share/vm/opto/library_call.cpp b/src/share/vm/opto/library_call.cpp index 381fb3759..60f28189e 100644 --- a/src/share/vm/opto/library_call.cpp +++ b/src/share/vm/opto/library_call.cpp @@ -2194,14 +2194,15 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) { 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 --git a/src/share/vm/opto/machnode.cpp b/src/share/vm/opto/machnode.cpp index aad78e892..e5e8fdbe9 100644 --- a/src/share/vm/opto/machnode.cpp +++ b/src/share/vm/opto/machnode.cpp @@ -262,19 +262,19 @@ const Node* MachNode::get_base_and_disp(intptr_t &offset, const TypePtr* &adr_ty // 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 --git a/src/share/vm/opto/macro.cpp b/src/share/vm/opto/macro.cpp index fde6b01a4..ea6d07225 100644 --- a/src/share/vm/opto/macro.cpp +++ b/src/share/vm/opto/macro.cpp @@ -598,7 +598,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray 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 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray 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 --git a/src/share/vm/opto/matcher.cpp b/src/share/vm/opto/matcher.cpp index ac58b2bb4..f0a2d8aa6 100644 --- a/src/share/vm/opto/matcher.cpp +++ b/src/share/vm/opto/matcher.cpp @@ -1766,8 +1766,8 @@ void Matcher::find_shared( Node *n ) { } 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 --git a/src/share/vm/opto/memnode.cpp b/src/share/vm/opto/memnode.cpp index 9ab85ff84..6114bdaf2 100644 --- a/src/share/vm/opto/memnode.cpp +++ b/src/share/vm/opto/memnode.cpp @@ -769,15 +769,8 @@ Node *LoadNode::make( PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const Type 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 @@ Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* a 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 @@ Node* LoadNode::klass_identity_common(PhaseTransform *phase ) { //------------------------------Value------------------------------------------ const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const { const Type *t = klass_value_common(phase); + if (t == Type::TOP) + return t; - 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; + return t->make_narrowoop(); } //------------------------------Identity--------------------------------------- @@ -1864,7 +1851,7 @@ Node* LoadNKlassNode::Identity( PhaseTransform *phase ) { 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 @@ StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, cons 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 --git a/src/share/vm/opto/parse2.cpp b/src/share/vm/opto/parse2.cpp index c515f2e32..69bb03000 100644 --- a/src/share/vm/opto/parse2.cpp +++ b/src/share/vm/opto/parse2.cpp @@ -67,12 +67,9 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) { 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 --git a/src/share/vm/opto/subnode.cpp b/src/share/vm/opto/subnode.cpp index 6a530b3a7..1a74e2f4e 100644 --- a/src/share/vm/opto/subnode.cpp +++ b/src/share/vm/opto/subnode.cpp @@ -743,8 +743,8 @@ Node *CmpPNode::Ideal( PhaseGVN *phase, bool can_reshape ) { // 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 --git a/src/share/vm/opto/superword.cpp b/src/share/vm/opto/superword.cpp index 5e3a7bb70..a37430b17 100644 --- a/src/share/vm/opto/superword.cpp +++ b/src/share/vm/opto/superword.cpp @@ -1424,9 +1424,9 @@ int SuperWord::memory_alignment(MemNode* s, int iv_adjust_in_bytes) { //---------------------------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 --git a/src/share/vm/opto/type.cpp b/src/share/vm/opto/type.cpp index 61cb04d4e..2dad47b2d 100644 --- a/src/share/vm/opto/type.cpp +++ b/src/share/vm/opto/type.cpp @@ -168,7 +168,20 @@ const Type* Type::get_typeflow_type(ciType* type) { 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 @@ bool Type::is_nan() const { // 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 @@ inline const TypeInt* normalize_array_size(const TypeInt* size) { //------------------------------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 @@ bool TypeAry::ary_must_be_exact() const { 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 @@ bool TypeAry::ary_must_be_exact() const { 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 @@ const TypePtr *TypeOopPtr::add_offset( int offset ) const { 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 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const { 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 @@ ciKlass* TypeAryPtr::klass() const { 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 --git a/src/share/vm/opto/type.hpp b/src/share/vm/opto/type.hpp index 2769ee78a..38bdb6e45 100644 --- a/src/share/vm/opto/type.hpp +++ b/src/share/vm/opto/type.hpp @@ -225,6 +225,12 @@ public: 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 @@ public: 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 @@ public: // 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 @@ public: 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 @@ inline const TypeKlassPtr *Type::is_klassptr() const { 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) ) -- GitLab