< prev index next >

src/share/vm/opto/castnode.cpp

Print this page




 208             t = TypeInt::make(lo_int, hi_int, Type::WidenMax);
 209 
 210             res = res->filter_speculative(t);
 211 
 212             return res;
 213           }
 214         }
 215       }
 216     }
 217   }
 218   return res;
 219 }
 220 
 221 Node *CastIINode::Ideal(PhaseGVN *phase, bool can_reshape) {
 222   Node* progress = ConstraintCastNode::Ideal(phase, can_reshape);
 223   if (progress != NULL) {
 224     return progress;
 225   }
 226 
 227   // Similar to ConvI2LNode::Ideal() for the same reasons
 228   if (can_reshape && !phase->C->major_progress()) {



 229     const TypeInt* this_type = this->type()->is_int();
 230     const TypeInt* in_type = phase->type(in(1))->isa_int();
 231     if (in_type != NULL && this_type != NULL &&
 232         (in_type->_lo != this_type->_lo ||
 233          in_type->_hi != this_type->_hi)) {
 234       int lo1 = this_type->_lo;
 235       int hi1 = this_type->_hi;
 236       int w1  = this_type->_widen;
 237 
 238       if (lo1 >= 0) {
 239         // Keep a range assertion of >=0.
 240         lo1 = 0;        hi1 = max_jint;
 241       } else if (hi1 < 0) {
 242         // Keep a range assertion of <0.
 243         lo1 = min_jint; hi1 = -1;
 244       } else {
 245         lo1 = min_jint; hi1 = max_jint;
 246       }
 247       const TypeInt* wtype = TypeInt::make(MAX2(in_type->_lo, lo1),
 248                                            MIN2(in_type->_hi, hi1),




 208             t = TypeInt::make(lo_int, hi_int, Type::WidenMax);
 209 
 210             res = res->filter_speculative(t);
 211 
 212             return res;
 213           }
 214         }
 215       }
 216     }
 217   }
 218   return res;
 219 }
 220 
 221 Node *CastIINode::Ideal(PhaseGVN *phase, bool can_reshape) {
 222   Node* progress = ConstraintCastNode::Ideal(phase, can_reshape);
 223   if (progress != NULL) {
 224     return progress;
 225   }
 226 
 227   // Similar to ConvI2LNode::Ideal() for the same reasons
 228   // Do not narrow the type of range check dependent CastIINodes to
 229   // avoid corruption of the graph if a CastII is replaced by TOP but
 230   // the corresponding range check is not removed.
 231   if (can_reshape && !_range_check_dependency && !phase->C->major_progress()) {
 232     const TypeInt* this_type = this->type()->is_int();
 233     const TypeInt* in_type = phase->type(in(1))->isa_int();
 234     if (in_type != NULL && this_type != NULL &&
 235         (in_type->_lo != this_type->_lo ||
 236          in_type->_hi != this_type->_hi)) {
 237       int lo1 = this_type->_lo;
 238       int hi1 = this_type->_hi;
 239       int w1  = this_type->_widen;
 240 
 241       if (lo1 >= 0) {
 242         // Keep a range assertion of >=0.
 243         lo1 = 0;        hi1 = max_jint;
 244       } else if (hi1 < 0) {
 245         // Keep a range assertion of <0.
 246         lo1 = min_jint; hi1 = -1;
 247       } else {
 248         lo1 = min_jint; hi1 = max_jint;
 249       }
 250       const TypeInt* wtype = TypeInt::make(MAX2(in_type->_lo, lo1),
 251                                            MIN2(in_type->_hi, hi1),


< prev index next >