< prev index next >

src/hotspot/share/opto/subnode.cpp

Print this page




 817       return TypeInt::CC_LT;            // smaller
 818     } else if (lo0 > hi1) {
 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();


1089       phase->C->dependencies()->assert_leaf_type(ik);
1090     }
1091   }
1092 
1093   // Bypass the dependent load, and compare directly
1094   this->set_req(1,ldk2);
1095 
1096   return this;
1097 }
1098 
1099 // Checks if one operand is perturbed and returns it
1100 Node* CmpPNode::has_perturbed_operand() const {
1101   // We always perturbe the first operand
1102   AddPNode* addP = in(1)->isa_AddP();
1103   if (addP != NULL) {
1104     Node* base = addP->in(AddPNode::Base);
1105     if (base->is_top()) {
1106       // RawPtr comparison
1107       return NULL;
1108     }
1109     assert(EnableValhalla && UsePointerPerturbation, "unexpected perturbed oop");
1110     return in(1);
1111   }
1112   return NULL;
1113 }
1114 
1115 //=============================================================================
1116 //------------------------------sub--------------------------------------------
1117 // Simplify an CmpN (compare 2 pointers) node, based on local information.
1118 // If both inputs are constants, compare them.
1119 const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const {
1120   const TypePtr *r0 = t1->make_ptr(); // Handy access
1121   const TypePtr *r1 = t2->make_ptr();
1122 
1123   // Undefined inputs makes for an undefined result
1124   if ((r0 == NULL) || (r1 == NULL) ||
1125       TypePtr::above_centerline(r0->_ptr) ||
1126       TypePtr::above_centerline(r1->_ptr)) {
1127     return Type::TOP;
1128   }
1129   if (r0 == r1 && r0->singleton()) {




 817       return TypeInt::CC_LT;            // smaller
 818     } else if (lo0 > hi1) {
 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 (ACmpOnValues != 3 &&
 838       (t1->isa_valuetype() || t2->isa_valuetype() ||
 839        ((t1->is_valuetypeptr() || t2->is_valuetypeptr()) &&
 840         (!t1->maybe_null() || !t2->maybe_null())))) {
 841     // One operand is a value type and one operand is never null, fold to constant false
 842     return TypeInt::CC_GT;
 843   }
 844 
 845   const TypePtr *r0 = t1->is_ptr(); // Handy access
 846   const TypePtr *r1 = t2->is_ptr();
 847 
 848   // Undefined inputs makes for an undefined result
 849   if( TypePtr::above_centerline(r0->_ptr) ||
 850       TypePtr::above_centerline(r1->_ptr) )
 851     return Type::TOP;
 852 
 853   if (r0 == r1 && r0->singleton()) {
 854     // Equal pointer constants (klasses, nulls, etc.)
 855     return TypeInt::CC_EQ;
 856   }
 857 
 858   // See if it is 2 unrelated classes.
 859   const TypeOopPtr* p0 = r0->isa_oopptr();
 860   const TypeOopPtr* p1 = r1->isa_oopptr();


1090       phase->C->dependencies()->assert_leaf_type(ik);
1091     }
1092   }
1093 
1094   // Bypass the dependent load, and compare directly
1095   this->set_req(1,ldk2);
1096 
1097   return this;
1098 }
1099 
1100 // Checks if one operand is perturbed and returns it
1101 Node* CmpPNode::has_perturbed_operand() const {
1102   // We always perturbe the first operand
1103   AddPNode* addP = in(1)->isa_AddP();
1104   if (addP != NULL) {
1105     Node* base = addP->in(AddPNode::Base);
1106     if (base->is_top()) {
1107       // RawPtr comparison
1108       return NULL;
1109     }
1110     assert(EnableValhalla && ACmpOnValues == 1, "unexpected perturbed oop");
1111     return in(1);
1112   }
1113   return NULL;
1114 }
1115 
1116 //=============================================================================
1117 //------------------------------sub--------------------------------------------
1118 // Simplify an CmpN (compare 2 pointers) node, based on local information.
1119 // If both inputs are constants, compare them.
1120 const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const {
1121   const TypePtr *r0 = t1->make_ptr(); // Handy access
1122   const TypePtr *r1 = t2->make_ptr();
1123 
1124   // Undefined inputs makes for an undefined result
1125   if ((r0 == NULL) || (r1 == NULL) ||
1126       TypePtr::above_centerline(r0->_ptr) ||
1127       TypePtr::above_centerline(r1->_ptr)) {
1128     return Type::TOP;
1129   }
1130   if (r0 == r1 && r0->singleton()) {


< prev index next >