856 // Until we have harmony between classes and interfaces in the type |
856 // Until we have harmony between classes and interfaces in the type |
857 // lattice, we must tread carefully around phis which implicitly |
857 // lattice, we must tread carefully around phis which implicitly |
858 // convert the one to the other. |
858 // convert the one to the other. |
859 const TypePtr* ttp = _type->make_ptr(); |
859 const TypePtr* ttp = _type->make_ptr(); |
860 const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL; |
860 const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL; |
|
861 const TypeKlassPtr* ttkp = (ttp != NULL) ? ttp->isa_klassptr() : NULL; |
861 bool is_intf = false; |
862 bool is_intf = false; |
862 if (ttip != NULL) { |
863 if (ttip != NULL) { |
863 ciKlass* k = ttip->klass(); |
864 ciKlass* k = ttip->klass(); |
|
865 if (k->is_loaded() && k->is_interface()) |
|
866 is_intf = true; |
|
867 } |
|
868 if (ttkp != NULL) { |
|
869 ciKlass* k = ttkp->klass(); |
864 if (k->is_loaded() && k->is_interface()) |
870 if (k->is_loaded() && k->is_interface()) |
865 is_intf = true; |
871 is_intf = true; |
866 } |
872 } |
867 |
873 |
868 // Default case: merge all inputs |
874 // Default case: merge all inputs |
919 // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows |
925 // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows |
920 // into a Phi which "knows" it's an Interface type we'll have to |
926 // into a Phi which "knows" it's an Interface type we'll have to |
921 // uplift the type. |
927 // uplift the type. |
922 if( !t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface() ) |
928 if( !t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface() ) |
923 { assert(ft == _type, ""); } // Uplift to interface |
929 { assert(ft == _type, ""); } // Uplift to interface |
|
930 else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() ) |
|
931 { assert(ft == _type, ""); } // Uplift to interface |
924 // Otherwise it's something stupid like non-overlapping int ranges |
932 // Otherwise it's something stupid like non-overlapping int ranges |
925 // found on dying counted loops. |
933 // found on dying counted loops. |
926 else |
934 else |
927 { assert(ft == Type::TOP, ""); } // Canonical empty value |
935 { assert(ft == Type::TOP, ""); } // Canonical empty value |
928 } |
936 } |
934 // class-typed Phi and an interface flows in, it's possible that the meet & |
942 // class-typed Phi and an interface flows in, it's possible that the meet & |
935 // join report an interface back out. This isn't possible but happens |
943 // join report an interface back out. This isn't possible but happens |
936 // because the type system doesn't interact well with interfaces. |
944 // because the type system doesn't interact well with interfaces. |
937 const TypePtr *jtp = jt->make_ptr(); |
945 const TypePtr *jtp = jt->make_ptr(); |
938 const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL; |
946 const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL; |
|
947 const TypeKlassPtr *jtkp = (jtp != NULL) ? jtp->isa_klassptr() : NULL; |
939 if( jtip && ttip ) { |
948 if( jtip && ttip ) { |
940 if( jtip->is_loaded() && jtip->klass()->is_interface() && |
949 if( jtip->is_loaded() && jtip->klass()->is_interface() && |
941 ttip->is_loaded() && !ttip->klass()->is_interface() ) { |
950 ttip->is_loaded() && !ttip->klass()->is_interface() ) { |
942 // Happens in a CTW of rt.jar, 320-341, no extra flags |
951 // Happens in a CTW of rt.jar, 320-341, no extra flags |
943 assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) || |
952 assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) || |
944 ft->isa_narrowoop() && ft->make_ptr() == ttip->cast_to_ptr_type(jtip->ptr()), ""); |
953 ft->isa_narrowoop() && ft->make_ptr() == ttip->cast_to_ptr_type(jtip->ptr()), ""); |
|
954 jt = ft; |
|
955 } |
|
956 } |
|
957 if( jtkp && ttkp ) { |
|
958 if( jtkp->is_loaded() && jtkp->klass()->is_interface() && |
|
959 ttkp->is_loaded() && !ttkp->klass()->is_interface() ) { |
|
960 assert(ft == ttkp->cast_to_ptr_type(jtkp->ptr()) || |
|
961 ft->isa_narrowoop() && ft->make_ptr() == ttkp->cast_to_ptr_type(jtkp->ptr()), ""); |
945 jt = ft; |
962 jt = ft; |
946 } |
963 } |
947 } |
964 } |
948 if (jt != ft && jt->base() == ft->base()) { |
965 if (jt != ft && jt->base() == ft->base()) { |
949 if (jt->isa_int() && |
966 if (jt->isa_int() && |