706 |
706 |
707 //------------------------split_out_instance----------------------------------- |
707 //------------------------split_out_instance----------------------------------- |
708 // Split out an instance type from a bottom phi. |
708 // Split out an instance type from a bottom phi. |
709 PhiNode* PhiNode::split_out_instance(const TypePtr* at, PhaseIterGVN *igvn) const { |
709 PhiNode* PhiNode::split_out_instance(const TypePtr* at, PhaseIterGVN *igvn) const { |
710 const TypeOopPtr *t_oop = at->isa_oopptr(); |
710 const TypeOopPtr *t_oop = at->isa_oopptr(); |
711 assert(t_oop != NULL && t_oop->is_instance(), "expecting instance oopptr"); |
711 assert(t_oop != NULL && t_oop->is_known_instance(), "expecting instance oopptr"); |
712 const TypePtr *t = adr_type(); |
712 const TypePtr *t = adr_type(); |
713 assert(type() == Type::MEMORY && |
713 assert(type() == Type::MEMORY && |
714 (t == TypePtr::BOTTOM || t == TypeRawPtr::BOTTOM || |
714 (t == TypePtr::BOTTOM || t == TypeRawPtr::BOTTOM || |
715 t->isa_oopptr() && !t->is_oopptr()->is_instance() && |
715 t->isa_oopptr() && !t->is_oopptr()->is_known_instance() && |
716 t->is_oopptr()->cast_to_instance(t_oop->instance_id()) == t_oop), |
716 t->is_oopptr()->cast_to_instance_id(t_oop->instance_id()) == t_oop), |
717 "bottom or raw memory required"); |
717 "bottom or raw memory required"); |
718 |
718 |
719 // Check if an appropriate node already exists. |
719 // Check if an appropriate node already exists. |
720 Node *region = in(0); |
720 Node *region = in(0); |
721 for (DUIterator_Fast kmax, k = region->fast_outs(kmax); k < kmax; k++) { |
721 for (DUIterator_Fast kmax, k = region->fast_outs(kmax); k < kmax; k++) { |
852 } |
852 } |
853 |
853 |
854 // Until we have harmony between classes and interfaces in the type |
854 // Until we have harmony between classes and interfaces in the type |
855 // lattice, we must tread carefully around phis which implicitly |
855 // lattice, we must tread carefully around phis which implicitly |
856 // convert the one to the other. |
856 // convert the one to the other. |
857 const TypeInstPtr* ttip = _type->isa_narrowoop() ? _type->isa_narrowoop()->make_oopptr()->isa_instptr() :_type->isa_instptr(); |
857 const TypePtr* ttp = _type->make_ptr(); |
|
858 const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL; |
858 bool is_intf = false; |
859 bool is_intf = false; |
859 if (ttip != NULL) { |
860 if (ttip != NULL) { |
860 ciKlass* k = ttip->klass(); |
861 ciKlass* k = ttip->klass(); |
861 if (k->is_loaded() && k->is_interface()) |
862 if (k->is_loaded() && k->is_interface()) |
862 is_intf = true; |
863 is_intf = true; |
871 // We assume that each input of an interface-valued Phi is a true |
872 // We assume that each input of an interface-valued Phi is a true |
872 // subtype of that interface. This might not be true of the meet |
873 // subtype of that interface. This might not be true of the meet |
873 // of all the input types. The lattice is not distributive in |
874 // of all the input types. The lattice is not distributive in |
874 // such cases. Ward off asserts in type.cpp by refusing to do |
875 // such cases. Ward off asserts in type.cpp by refusing to do |
875 // meets between interfaces and proper classes. |
876 // meets between interfaces and proper classes. |
876 const TypeInstPtr* tiip = ti->isa_narrowoop() ? ti->is_narrowoop()->make_oopptr()->isa_instptr() : ti->isa_instptr(); |
877 const TypePtr* tip = ti->make_ptr(); |
|
878 const TypeInstPtr* tiip = (tip != NULL) ? tip->isa_instptr() : NULL; |
877 if (tiip) { |
879 if (tiip) { |
878 bool ti_is_intf = false; |
880 bool ti_is_intf = false; |
879 ciKlass* k = tiip->klass(); |
881 ciKlass* k = tiip->klass(); |
880 if (k->is_loaded() && k->is_interface()) |
882 if (k->is_loaded() && k->is_interface()) |
881 ti_is_intf = true; |
883 ti_is_intf = true; |
928 // If we have an interface-typed Phi and we narrow to a class type, the join |
930 // If we have an interface-typed Phi and we narrow to a class type, the join |
929 // should report back the class. However, if we have a J/L/Object |
931 // should report back the class. However, if we have a J/L/Object |
930 // class-typed Phi and an interface flows in, it's possible that the meet & |
932 // class-typed Phi and an interface flows in, it's possible that the meet & |
931 // join report an interface back out. This isn't possible but happens |
933 // join report an interface back out. This isn't possible but happens |
932 // because the type system doesn't interact well with interfaces. |
934 // because the type system doesn't interact well with interfaces. |
933 const TypeInstPtr *jtip = jt->isa_narrowoop() ? jt->isa_narrowoop()->make_oopptr()->isa_instptr() : jt->isa_instptr(); |
935 const TypePtr *jtp = jt->make_ptr(); |
|
936 const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL; |
934 if( jtip && ttip ) { |
937 if( jtip && ttip ) { |
935 if( jtip->is_loaded() && jtip->klass()->is_interface() && |
938 if( jtip->is_loaded() && jtip->klass()->is_interface() && |
936 ttip->is_loaded() && !ttip->klass()->is_interface() ) { |
939 ttip->is_loaded() && !ttip->klass()->is_interface() ) { |
937 // Happens in a CTW of rt.jar, 320-341, no extra flags |
940 // Happens in a CTW of rt.jar, 320-341, no extra flags |
938 assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) || |
941 assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) || |
939 ft->isa_narrowoop() && ft->isa_narrowoop()->make_oopptr() == ttip->cast_to_ptr_type(jtip->ptr()), ""); |
942 ft->isa_narrowoop() && ft->make_ptr() == ttip->cast_to_ptr_type(jtip->ptr()), ""); |
940 jt = ft; |
943 jt = ft; |
941 } |
944 } |
942 } |
945 } |
943 if (jt != ft && jt->base() == ft->base()) { |
946 if (jt != ft && jt->base() == ft->base()) { |
944 if (jt->isa_int() && |
947 if (jt->isa_int() && |