src/hotspot/share/opto/castnode.cpp
changeset 58019 86b95fc6ca32
parent 54327 a4d19817609c
equal deleted inserted replaced
58018:a3c63a9dfb2c 58019:86b95fc6ca32
    61       if( t1 == Type::TOP )  assert(ft == Type::TOP, "special case #1");
    61       if( t1 == Type::TOP )  assert(ft == Type::TOP, "special case #1");
    62       const Type* rt = t1->join_speculative(_type);
    62       const Type* rt = t1->join_speculative(_type);
    63       if (rt->empty())       assert(ft == Type::TOP, "special case #2");
    63       if (rt->empty())       assert(ft == Type::TOP, "special case #2");
    64       break;
    64       break;
    65     }
    65     }
       
    66     case Op_CastLL:
       
    67     {
       
    68       const Type* t1 = phase->type(in(1));
       
    69       if (t1 == Type::TOP)   assert(ft == Type::TOP, "special case #1");
       
    70       const Type* rt = t1->join_speculative(_type);
       
    71       if (rt->empty())       assert(ft == Type::TOP, "special case #2");
       
    72       break;
       
    73     }
    66     case Op_CastPP:
    74     case Op_CastPP:
    67     if (phase->type(in(1)) == TypePtr::NULL_PTR &&
    75     if (phase->type(in(1)) == TypePtr::NULL_PTR &&
    68         _type->isa_ptr() && _type->is_ptr()->_ptr == TypePtr::NotNull)
    76         _type->isa_ptr() && _type->is_ptr()->_ptr == TypePtr::NotNull)
    69     assert(ft == Type::TOP, "special case #3");
    77     assert(ft == Type::TOP, "special case #3");
    70     break;
    78     break;
    91 
    99 
    92 Node* ConstraintCastNode::make_cast(int opcode, Node* c, Node *n, const Type *t, bool carry_dependency) {
   100 Node* ConstraintCastNode::make_cast(int opcode, Node* c, Node *n, const Type *t, bool carry_dependency) {
    93   switch(opcode) {
   101   switch(opcode) {
    94   case Op_CastII: {
   102   case Op_CastII: {
    95     Node* cast = new CastIINode(n, t, carry_dependency);
   103     Node* cast = new CastIINode(n, t, carry_dependency);
       
   104     cast->set_req(0, c);
       
   105     return cast;
       
   106   }
       
   107   case Op_CastLL: {
       
   108     Node* cast = new CastLLNode(n, t, carry_dependency);
    96     cast->set_req(0, c);
   109     cast->set_req(0, c);
    97     return cast;
   110     return cast;
    98   }
   111   }
    99   case Op_CastPP: {
   112   case Op_CastPP: {
   100     Node* cast = new CastPPNode(n, t, carry_dependency);
   113     Node* cast = new CastPPNode(n, t, carry_dependency);
   277     st->print(" range check dependency");
   290     st->print(" range check dependency");
   278   }
   291   }
   279 }
   292 }
   280 #endif
   293 #endif
   281 
   294 
       
   295 Node* CastLLNode::Ideal(PhaseGVN* phase, bool can_reshape) {
       
   296   Node* progress = ConstraintCastNode::Ideal(phase, can_reshape);
       
   297   if (progress != NULL) {
       
   298     return progress;
       
   299   }
       
   300 
       
   301   // Same as in CastIINode::Ideal but for TypeLong instead of TypeInt
       
   302   if (can_reshape && !phase->C->major_progress()) {
       
   303     const TypeLong* this_type = this->type()->is_long();
       
   304     const TypeLong* in_type = phase->type(in(1))->isa_long();
       
   305     if (in_type != NULL && this_type != NULL &&
       
   306         (in_type->_lo != this_type->_lo ||
       
   307          in_type->_hi != this_type->_hi)) {
       
   308       jlong lo1 = this_type->_lo;
       
   309       jlong hi1 = this_type->_hi;
       
   310       int w1  = this_type->_widen;
       
   311 
       
   312       if (lo1 >= 0) {
       
   313         // Keep a range assertion of >=0.
       
   314         lo1 = 0;         hi1 = max_jlong;
       
   315       } else if (hi1 < 0) {
       
   316         // Keep a range assertion of <0.
       
   317         lo1 = min_jlong; hi1 = -1;
       
   318       } else {
       
   319         lo1 = min_jlong; hi1 = max_jlong;
       
   320       }
       
   321       const TypeLong* wtype = TypeLong::make(MAX2(in_type->_lo, lo1),
       
   322                                              MIN2(in_type->_hi, hi1),
       
   323                                              MAX2((int)in_type->_widen, w1));
       
   324       if (wtype != type()) {
       
   325         set_type(wtype);
       
   326         return this;
       
   327       }
       
   328     }
       
   329   }
       
   330   return NULL;
       
   331 }
       
   332 
       
   333 
   282 //=============================================================================
   334 //=============================================================================
   283 //------------------------------Identity---------------------------------------
   335 //------------------------------Identity---------------------------------------
   284 // If input is already higher or equal to cast type, then this is an identity.
   336 // If input is already higher or equal to cast type, then this is an identity.
   285 Node* CheckCastPPNode::Identity(PhaseGVN* phase) {
   337 Node* CheckCastPPNode::Identity(PhaseGVN* phase) {
   286   Node* dom = dominating_cast(phase, phase);
   338   Node* dom = dominating_cast(phase, phase);