819 return TypeInt::CC_GT; // greater
820 } else if (hi0 == lo1 && lo0 == hi1) {
821 return TypeInt::CC_EQ; // Equal results
822 } else if (lo0 >= hi1) {
823 return TypeInt::CC_GE;
824 } else if (hi0 <= lo1) {
825 return TypeInt::CC_LE;
826 }
827 }
828
829 return TypeInt::CC; // else use worst case results
830 }
831
832 //=============================================================================
833 //------------------------------sub--------------------------------------------
834 // Simplify an CmpP (compare 2 pointers) node, based on local information.
835 // If both inputs are constants, compare them.
836 const Type *CmpPNode::sub( const Type *t1, const Type *t2 ) const {
837 if (t1->isa_valuetype() || t2->isa_valuetype() ||
838 ((t1->is_valuetypeptr() || t2->is_valuetypeptr()) &&
839 (!t1->is_ptr()->maybe_null() || !t2->is_ptr()->maybe_null()))) {
840 // One operand is a value type and one operand is never null, fold to constant false
841 return TypeInt::CC_GT;
842 }
843
844 const TypePtr *r0 = t1->is_ptr(); // Handy access
845 const TypePtr *r1 = t2->is_ptr();
846
847 // Undefined inputs makes for an undefined result
848 if( TypePtr::above_centerline(r0->_ptr) ||
849 TypePtr::above_centerline(r1->_ptr) )
850 return Type::TOP;
851
852 if (r0 == r1 && r0->singleton()) {
853 // Equal pointer constants (klasses, nulls, etc.)
854 return TypeInt::CC_EQ;
855 }
856
857 // See if it is 2 unrelated classes.
858 const TypeOopPtr* p0 = r0->isa_oopptr();
859 const TypeOopPtr* p1 = r1->isa_oopptr();
|
819 return TypeInt::CC_GT; // greater
820 } else if (hi0 == lo1 && lo0 == hi1) {
821 return TypeInt::CC_EQ; // Equal results
822 } else if (lo0 >= hi1) {
823 return TypeInt::CC_GE;
824 } else if (hi0 <= lo1) {
825 return TypeInt::CC_LE;
826 }
827 }
828
829 return TypeInt::CC; // else use worst case results
830 }
831
832 //=============================================================================
833 //------------------------------sub--------------------------------------------
834 // Simplify an CmpP (compare 2 pointers) node, based on local information.
835 // If both inputs are constants, compare them.
836 const Type *CmpPNode::sub( const Type *t1, const Type *t2 ) const {
837 if (t1->isa_valuetype() || t2->isa_valuetype() ||
838 ((t1->is_valuetypeptr() || t2->is_valuetypeptr()) &&
839 (!t1->maybe_null() || !t2->maybe_null()))) {
840 // One operand is a value type and one operand is never null, fold to constant false
841 return TypeInt::CC_GT;
842 }
843
844 const TypePtr *r0 = t1->is_ptr(); // Handy access
845 const TypePtr *r1 = t2->is_ptr();
846
847 // Undefined inputs makes for an undefined result
848 if( TypePtr::above_centerline(r0->_ptr) ||
849 TypePtr::above_centerline(r1->_ptr) )
850 return Type::TOP;
851
852 if (r0 == r1 && r0->singleton()) {
853 // Equal pointer constants (klasses, nulls, etc.)
854 return TypeInt::CC_EQ;
855 }
856
857 // See if it is 2 unrelated classes.
858 const TypeOopPtr* p0 = r0->isa_oopptr();
859 const TypeOopPtr* p1 = r1->isa_oopptr();
|