1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
662 !klass1->as_obj_array_klass()->base_element_klass()->is_interface())) { |
662 !klass1->as_obj_array_klass()->base_element_klass()->is_interface())) { |
663 bool unrelated_classes = false; |
663 bool unrelated_classes = false; |
664 // See if neither subclasses the other, or if the class on top |
664 // See if neither subclasses the other, or if the class on top |
665 // is precise. In either of these cases, the compare is known |
665 // is precise. In either of these cases, the compare is known |
666 // to fail if at least one of the pointers is provably not null. |
666 // to fail if at least one of the pointers is provably not null. |
667 if (klass0->equals(klass1) || // if types are unequal but klasses are |
667 if (klass0->equals(klass1)) { // if types are unequal but klasses are equal |
668 !klass0->is_java_klass() || // types not part of Java language? |
|
669 !klass1->is_java_klass()) { // types not part of Java language? |
|
670 // Do nothing; we know nothing for imprecise types |
668 // Do nothing; we know nothing for imprecise types |
671 } else if (klass0->is_subtype_of(klass1)) { |
669 } else if (klass0->is_subtype_of(klass1)) { |
672 // If klass1's type is PRECISE, then classes are unrelated. |
670 // If klass1's type is PRECISE, then classes are unrelated. |
673 unrelated_classes = xklass1; |
671 unrelated_classes = xklass1; |
674 } else if (klass1->is_subtype_of(klass0)) { |
672 } else if (klass1->is_subtype_of(klass0)) { |
742 if (mirror_type->is_classless()) { |
740 if (mirror_type->is_classless()) { |
743 return phase->makecon(TypePtr::NULL_PTR); |
741 return phase->makecon(TypePtr::NULL_PTR); |
744 } |
742 } |
745 |
743 |
746 // return the ConP(Foo.klass) |
744 // return the ConP(Foo.klass) |
747 assert(mirror_type->is_klass(), "mirror_type should represent a klassOop"); |
745 assert(mirror_type->is_klass(), "mirror_type should represent a Klass*"); |
748 return phase->makecon(TypeKlassPtr::make(mirror_type->as_klass())); |
746 return phase->makecon(TypeKlassPtr::make(mirror_type->as_klass())); |
749 } |
747 } |
750 |
748 |
751 //------------------------------Ideal------------------------------------------ |
749 //------------------------------Ideal------------------------------------------ |
752 // Normalize comparisons between Java mirror loads to compare the klass instead. |
750 // Normalize comparisons between Java mirror loads to compare the klass instead. |
889 !klass1->is_interface()) { |
887 !klass1->is_interface()) { |
890 bool unrelated_classes = false; |
888 bool unrelated_classes = false; |
891 // See if neither subclasses the other, or if the class on top |
889 // See if neither subclasses the other, or if the class on top |
892 // is precise. In either of these cases, the compare is known |
890 // is precise. In either of these cases, the compare is known |
893 // to fail if at least one of the pointers is provably not null. |
891 // to fail if at least one of the pointers is provably not null. |
894 if (klass0->equals(klass1) || // if types are unequal but klasses are |
892 if (klass0->equals(klass1)) { // if types are unequal but klasses are equal |
895 !klass0->is_java_klass() || // types not part of Java language? |
|
896 !klass1->is_java_klass()) { // types not part of Java language? |
|
897 // Do nothing; we know nothing for imprecise types |
893 // Do nothing; we know nothing for imprecise types |
898 } else if (klass0->is_subtype_of(klass1)) { |
894 } else if (klass0->is_subtype_of(klass1)) { |
899 // If klass1's type is PRECISE, then classes are unrelated. |
895 // If klass1's type is PRECISE, then classes are unrelated. |
900 unrelated_classes = xklass1; |
896 unrelated_classes = xklass1; |
901 } else if (klass1->is_subtype_of(klass0)) { |
897 } else if (klass1->is_subtype_of(klass0)) { |