src/share/vm/opto/cfgnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/cfgnode.cpp

Print this page
rev 5645 : 8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
Summary: type methods shouldn't always operate on speculative part
Reviewed-by:


 934   const Type *t = Type::TOP;        // Merged type starting value
 935   for (uint i = 1; i < req(); ++i) {// For all paths in
 936     // Reachable control path?
 937     if (r->in(i) && phase->type(r->in(i)) == Type::CONTROL) {
 938       const Type* ti = phase->type(in(i));
 939       // We assume that each input of an interface-valued Phi is a true
 940       // subtype of that interface.  This might not be true of the meet
 941       // of all the input types.  The lattice is not distributive in
 942       // such cases.  Ward off asserts in type.cpp by refusing to do
 943       // meets between interfaces and proper classes.
 944       const TypePtr* tip = ti->make_ptr();
 945       const TypeInstPtr* tiip = (tip != NULL) ? tip->isa_instptr() : NULL;
 946       if (tiip) {
 947         bool ti_is_intf = false;
 948         ciKlass* k = tiip->klass();
 949         if (k->is_loaded() && k->is_interface())
 950           ti_is_intf = true;
 951         if (is_intf != ti_is_intf)
 952           { t = _type; break; }
 953       }
 954       t = t->meet(ti);
 955     }
 956   }
 957 
 958   // The worst-case type (from ciTypeFlow) should be consistent with "t".
 959   // That is, we expect that "t->higher_equal(_type)" holds true.
 960   // There are various exceptions:
 961   // - Inputs which are phis might in fact be widened unnecessarily.
 962   //   For example, an input might be a widened int while the phi is a short.
 963   // - Inputs might be BotPtrs but this phi is dependent on a null check,
 964   //   and postCCP has removed the cast which encodes the result of the check.
 965   // - The type of this phi is an interface, and the inputs are classes.
 966   // - Value calls on inputs might produce fuzzy results.
 967   //   (Occurrences of this case suggest improvements to Value methods.)
 968   //
 969   // It is not possible to see Type::BOTTOM values as phi inputs,
 970   // because the ciTypeFlow pre-pass produces verifier-quality types.
 971   const Type* ft = t->filter(_type);  // Worst case type
 972 
 973 #ifdef ASSERT
 974   // The following logic has been moved into TypeOopPtr::filter.
 975   const Type* jt = t->join(_type);
 976   if( jt->empty() ) {           // Emptied out???
 977 
 978     // Check for evil case of 't' being a class and '_type' expecting an
 979     // interface.  This can happen because the bytecodes do not contain
 980     // enough type info to distinguish a Java-level interface variable
 981     // from a Java-level object variable.  If we meet 2 classes which
 982     // both implement interface I, but their meet is at 'j/l/O' which
 983     // doesn't implement I, we have no way to tell if the result should
 984     // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
 985     // into a Phi which "knows" it's an Interface type we'll have to
 986     // uplift the type.
 987     if( !t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface() )
 988       { assert(ft == _type, ""); } // Uplift to interface
 989     else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() )
 990       { assert(ft == _type, ""); } // Uplift to interface
 991     // Otherwise it's something stupid like non-overlapping int ranges
 992     // found on dying counted loops.
 993     else
 994       { assert(ft == Type::TOP, ""); } // Canonical empty value
 995   }


1740     //
1741     // This occurs as a result of unsuccessful split_thru_phi and
1742     // interferes with taking advantage of addressing modes. See the
1743     // clone_shift_expressions code in matcher.cpp
1744     Node* addp = in(1);
1745     const Type* type = addp->in(AddPNode::Base)->bottom_type();
1746     Node* y = addp->in(AddPNode::Offset);
1747     if (y != NULL && addp->in(AddPNode::Base) == addp->in(AddPNode::Address)) {
1748       // make sure that all the inputs are similar to the first one,
1749       // i.e. AddP with base == address and same offset as first AddP
1750       bool doit = true;
1751       for (uint i = 2; i < req(); i++) {
1752         if (in(i) == NULL ||
1753             in(i)->Opcode() != Op_AddP ||
1754             in(i)->in(AddPNode::Base) != in(i)->in(AddPNode::Address) ||
1755             in(i)->in(AddPNode::Offset) != y) {
1756           doit = false;
1757           break;
1758         }
1759         // Accumulate type for resulting Phi
1760         type = type->meet(in(i)->in(AddPNode::Base)->bottom_type());
1761       }
1762       Node* base = NULL;
1763       if (doit) {
1764         // Check for neighboring AddP nodes in a tree.
1765         // If they have a base, use that it.
1766         for (DUIterator_Fast kmax, k = this->fast_outs(kmax); k < kmax; k++) {
1767           Node* u = this->fast_out(k);
1768           if (u->is_AddP()) {
1769             Node* base2 = u->in(AddPNode::Base);
1770             if (base2 != NULL && !base2->is_top()) {
1771               if (base == NULL)
1772                 base = base2;
1773               else if (base != base2)
1774                 { doit = false; break; }
1775             }
1776           }
1777         }
1778       }
1779       if (doit) {
1780         if (base == NULL) {




 934   const Type *t = Type::TOP;        // Merged type starting value
 935   for (uint i = 1; i < req(); ++i) {// For all paths in
 936     // Reachable control path?
 937     if (r->in(i) && phase->type(r->in(i)) == Type::CONTROL) {
 938       const Type* ti = phase->type(in(i));
 939       // We assume that each input of an interface-valued Phi is a true
 940       // subtype of that interface.  This might not be true of the meet
 941       // of all the input types.  The lattice is not distributive in
 942       // such cases.  Ward off asserts in type.cpp by refusing to do
 943       // meets between interfaces and proper classes.
 944       const TypePtr* tip = ti->make_ptr();
 945       const TypeInstPtr* tiip = (tip != NULL) ? tip->isa_instptr() : NULL;
 946       if (tiip) {
 947         bool ti_is_intf = false;
 948         ciKlass* k = tiip->klass();
 949         if (k->is_loaded() && k->is_interface())
 950           ti_is_intf = true;
 951         if (is_intf != ti_is_intf)
 952           { t = _type; break; }
 953       }
 954       t = t->meet(ti, true);
 955     }
 956   }
 957 
 958   // The worst-case type (from ciTypeFlow) should be consistent with "t".
 959   // That is, we expect that "t->higher_equal(_type)" holds true.
 960   // There are various exceptions:
 961   // - Inputs which are phis might in fact be widened unnecessarily.
 962   //   For example, an input might be a widened int while the phi is a short.
 963   // - Inputs might be BotPtrs but this phi is dependent on a null check,
 964   //   and postCCP has removed the cast which encodes the result of the check.
 965   // - The type of this phi is an interface, and the inputs are classes.
 966   // - Value calls on inputs might produce fuzzy results.
 967   //   (Occurrences of this case suggest improvements to Value methods.)
 968   //
 969   // It is not possible to see Type::BOTTOM values as phi inputs,
 970   // because the ciTypeFlow pre-pass produces verifier-quality types.
 971   const Type* ft = t->filter(_type, true);  // Worst case type
 972 
 973 #ifdef ASSERT
 974   // The following logic has been moved into TypeOopPtr::filter.
 975   const Type* jt = t->join(_type, true);
 976   if( jt->empty() ) {           // Emptied out???
 977 
 978     // Check for evil case of 't' being a class and '_type' expecting an
 979     // interface.  This can happen because the bytecodes do not contain
 980     // enough type info to distinguish a Java-level interface variable
 981     // from a Java-level object variable.  If we meet 2 classes which
 982     // both implement interface I, but their meet is at 'j/l/O' which
 983     // doesn't implement I, we have no way to tell if the result should
 984     // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
 985     // into a Phi which "knows" it's an Interface type we'll have to
 986     // uplift the type.
 987     if( !t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface() )
 988       { assert(ft == _type, ""); } // Uplift to interface
 989     else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() )
 990       { assert(ft == _type, ""); } // Uplift to interface
 991     // Otherwise it's something stupid like non-overlapping int ranges
 992     // found on dying counted loops.
 993     else
 994       { assert(ft == Type::TOP, ""); } // Canonical empty value
 995   }


1740     //
1741     // This occurs as a result of unsuccessful split_thru_phi and
1742     // interferes with taking advantage of addressing modes. See the
1743     // clone_shift_expressions code in matcher.cpp
1744     Node* addp = in(1);
1745     const Type* type = addp->in(AddPNode::Base)->bottom_type();
1746     Node* y = addp->in(AddPNode::Offset);
1747     if (y != NULL && addp->in(AddPNode::Base) == addp->in(AddPNode::Address)) {
1748       // make sure that all the inputs are similar to the first one,
1749       // i.e. AddP with base == address and same offset as first AddP
1750       bool doit = true;
1751       for (uint i = 2; i < req(); i++) {
1752         if (in(i) == NULL ||
1753             in(i)->Opcode() != Op_AddP ||
1754             in(i)->in(AddPNode::Base) != in(i)->in(AddPNode::Address) ||
1755             in(i)->in(AddPNode::Offset) != y) {
1756           doit = false;
1757           break;
1758         }
1759         // Accumulate type for resulting Phi
1760         type = type->meet(in(i)->in(AddPNode::Base)->bottom_type(), true);
1761       }
1762       Node* base = NULL;
1763       if (doit) {
1764         // Check for neighboring AddP nodes in a tree.
1765         // If they have a base, use that it.
1766         for (DUIterator_Fast kmax, k = this->fast_outs(kmax); k < kmax; k++) {
1767           Node* u = this->fast_out(k);
1768           if (u->is_AddP()) {
1769             Node* base2 = u->in(AddPNode::Base);
1770             if (base2 != NULL && !base2->is_top()) {
1771               if (base == NULL)
1772                 base = base2;
1773               else if (base != base2)
1774                 { doit = false; break; }
1775             }
1776           }
1777         }
1778       }
1779       if (doit) {
1780         if (base == NULL) {


src/share/vm/opto/cfgnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File