< prev index next >

src/share/vm/opto/cfgnode.cpp

Print this page




 927         }
 928       }
 929     } else if (l->in(LoopNode::LoopBackControl) != NULL &&
 930                in(LoopNode::EntryControl) != NULL &&
 931                phase->type(l->in(LoopNode::LoopBackControl)) == Type::TOP) {
 932       // During CCP, if we saturate the type of a counted loop's Phi
 933       // before the special code for counted loop above has a chance
 934       // to run (that is as long as the type of the backedge's control
 935       // is top), we might end up with non monotonic types
 936       return phase->type(in(LoopNode::EntryControl));
 937     }
 938   }
 939 
 940   // Until we have harmony between classes and interfaces in the type
 941   // lattice, we must tread carefully around phis which implicitly
 942   // convert the one to the other.
 943   const TypePtr* ttp = _type->make_ptr();
 944   const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL;
 945   const TypeKlassPtr* ttkp = (ttp != NULL) ? ttp->isa_klassptr() : NULL;
 946   bool is_intf = false;
 947   if (ttip != NULL) {
 948     ciKlass* k = ttip->klass();
 949     if (k->is_loaded() && k->is_interface())
 950       is_intf = true;
 951   }
 952   if (ttkp != NULL) {
 953     ciKlass* k = ttkp->klass();
 954     if (k->is_loaded() && k->is_interface())
 955       is_intf = true;
 956   }
 957 
 958   // Default case: merge all inputs
 959   const Type *t = Type::TOP;        // Merged type starting value
 960   for (uint i = 1; i < req(); ++i) {// For all paths in
 961     // Reachable control path?
 962     if (r->in(i) && phase->type(r->in(i)) == Type::CONTROL) {
 963       const Type* ti = phase->type(in(i));
 964       // We assume that each input of an interface-valued Phi is a true
 965       // subtype of that interface.  This might not be true of the meet
 966       // of all the input types.  The lattice is not distributive in
 967       // such cases.  Ward off asserts in type.cpp by refusing to do
 968       // meets between interfaces and proper classes.
 969       const TypePtr* tip = ti->make_ptr();
 970       const TypeInstPtr* tiip = (tip != NULL) ? tip->isa_instptr() : NULL;
 971       if (tiip) {
 972         bool ti_is_intf = false;
 973         ciKlass* k = tiip->klass();
 974         if (k->is_loaded() && k->is_interface())


 992   //   (Occurrences of this case suggest improvements to Value methods.)
 993   //
 994   // It is not possible to see Type::BOTTOM values as phi inputs,
 995   // because the ciTypeFlow pre-pass produces verifier-quality types.
 996   const Type* ft = t->filter_speculative(_type);  // Worst case type
 997 
 998 #ifdef ASSERT
 999   // The following logic has been moved into TypeOopPtr::filter.
1000   const Type* jt = t->join_speculative(_type);
1001   if (jt->empty()) {           // Emptied out???
1002 
1003     // Check for evil case of 't' being a class and '_type' expecting an
1004     // interface.  This can happen because the bytecodes do not contain
1005     // enough type info to distinguish a Java-level interface variable
1006     // from a Java-level object variable.  If we meet 2 classes which
1007     // both implement interface I, but their meet is at 'j/l/O' which
1008     // doesn't implement I, we have no way to tell if the result should
1009     // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
1010     // into a Phi which "knows" it's an Interface type we'll have to
1011     // uplift the type.
1012     if (!t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface()) {
1013       assert(ft == _type, ""); // Uplift to interface
1014     } else if (!t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface()) {
1015       assert(ft == _type, ""); // Uplift to interface
1016     } else {
1017       // We also have to handle 'evil cases' of interface- vs. class-arrays
1018       Type::get_arrays_base_elements(jt, _type, NULL, &ttip);
1019       if (!t->empty() && ttip != NULL && ttip->is_loaded() && ttip->klass()->is_interface()) {
1020           assert(ft == _type, "");   // Uplift to array of interface
1021       } else {
1022         // Otherwise it's something stupid like non-overlapping int ranges
1023         // found on dying counted loops.
1024         assert(ft == Type::TOP, ""); // Canonical empty value
1025       }
1026     }
1027   }
1028 
1029   else {
1030 
1031     // If we have an interface-typed Phi and we narrow to a class type, the join
1032     // should report back the class.  However, if we have a J/L/Object
1033     // class-typed Phi and an interface flows in, it's possible that the meet &
1034     // join report an interface back out.  This isn't possible but happens




 927         }
 928       }
 929     } else if (l->in(LoopNode::LoopBackControl) != NULL &&
 930                in(LoopNode::EntryControl) != NULL &&
 931                phase->type(l->in(LoopNode::LoopBackControl)) == Type::TOP) {
 932       // During CCP, if we saturate the type of a counted loop's Phi
 933       // before the special code for counted loop above has a chance
 934       // to run (that is as long as the type of the backedge's control
 935       // is top), we might end up with non monotonic types
 936       return phase->type(in(LoopNode::EntryControl));
 937     }
 938   }
 939 
 940   // Until we have harmony between classes and interfaces in the type
 941   // lattice, we must tread carefully around phis which implicitly
 942   // convert the one to the other.
 943   const TypePtr* ttp = _type->make_ptr();
 944   const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL;
 945   const TypeKlassPtr* ttkp = (ttp != NULL) ? ttp->isa_klassptr() : NULL;
 946   bool is_intf = false;
 947   if (ttip != NULL && ttip->is_loaded() && ttip->klass()->is_interface()) {


 948     is_intf = true;
 949   } else if (ttkp != NULL && ttkp->is_loaded() && ttkp->klass()->is_interface()) {



 950     is_intf = true;
 951   }
 952 
 953   // Default case: merge all inputs
 954   const Type *t = Type::TOP;        // Merged type starting value
 955   for (uint i = 1; i < req(); ++i) {// For all paths in
 956     // Reachable control path?
 957     if (r->in(i) && phase->type(r->in(i)) == Type::CONTROL) {
 958       const Type* ti = phase->type(in(i));
 959       // We assume that each input of an interface-valued Phi is a true
 960       // subtype of that interface.  This might not be true of the meet
 961       // of all the input types.  The lattice is not distributive in
 962       // such cases.  Ward off asserts in type.cpp by refusing to do
 963       // meets between interfaces and proper classes.
 964       const TypePtr* tip = ti->make_ptr();
 965       const TypeInstPtr* tiip = (tip != NULL) ? tip->isa_instptr() : NULL;
 966       if (tiip) {
 967         bool ti_is_intf = false;
 968         ciKlass* k = tiip->klass();
 969         if (k->is_loaded() && k->is_interface())


 987   //   (Occurrences of this case suggest improvements to Value methods.)
 988   //
 989   // It is not possible to see Type::BOTTOM values as phi inputs,
 990   // because the ciTypeFlow pre-pass produces verifier-quality types.
 991   const Type* ft = t->filter_speculative(_type);  // Worst case type
 992 
 993 #ifdef ASSERT
 994   // The following logic has been moved into TypeOopPtr::filter.
 995   const Type* jt = t->join_speculative(_type);
 996   if (jt->empty()) {           // Emptied out???
 997 
 998     // Check for evil case of 't' being a class and '_type' expecting an
 999     // interface.  This can happen because the bytecodes do not contain
1000     // enough type info to distinguish a Java-level interface variable
1001     // from a Java-level object variable.  If we meet 2 classes which
1002     // both implement interface I, but their meet is at 'j/l/O' which
1003     // doesn't implement I, we have no way to tell if the result should
1004     // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
1005     // into a Phi which "knows" it's an Interface type we'll have to
1006     // uplift the type.
1007     if (!t->empty() && ttip != NULL && ttip->is_loaded() && ttip->klass()->is_interface()) {
1008       assert(ft == _type, ""); // Uplift to interface
1009     } else if (!t->empty() && ttkp != NULL && ttkp->is_loaded() && ttkp->klass()->is_interface()) {
1010       assert(ft == _type, ""); // Uplift to interface
1011     } else {
1012       // We also have to handle 'evil cases' of interface- vs. class-arrays
1013       Type::get_arrays_base_elements(jt, _type, NULL, &ttip);
1014       if (!t->empty() && ttip != NULL && ttip->is_loaded() && ttip->klass()->is_interface()) {
1015           assert(ft == _type, "");   // Uplift to array of interface
1016       } else {
1017         // Otherwise it's something stupid like non-overlapping int ranges
1018         // found on dying counted loops.
1019         assert(ft == Type::TOP, ""); // Canonical empty value
1020       }
1021     }
1022   }
1023 
1024   else {
1025 
1026     // If we have an interface-typed Phi and we narrow to a class type, the join
1027     // should report back the class.  However, if we have a J/L/Object
1028     // class-typed Phi and an interface flows in, it's possible that the meet &
1029     // join report an interface back out.  This isn't possible but happens


< prev index next >