hotspot/src/share/vm/opto/convertnode.cpp
changeset 44331 61e01c0389ba
parent 35574 2b25eb88c8d6
equal deleted inserted replaced
44330:aaa5ce0d9d01 44331:61e01c0389ba
   292           }
   292           }
   293         }
   293         }
   294   }
   294   }
   295 
   295 
   296 #ifdef _LP64
   296 #ifdef _LP64
   297   // Convert ConvI2L(AddI(x, y)) to AddL(ConvI2L(x), ConvI2L(y)) or
   297   // Convert ConvI2L(AddI(x, y)) to AddL(ConvI2L(x), ConvI2L(y))
   298   // ConvI2L(CastII(AddI(x, y))) to AddL(ConvI2L(CastII(x)), ConvI2L(CastII(y))),
       
   299   // but only if x and y have subranges that cannot cause 32-bit overflow,
   298   // but only if x and y have subranges that cannot cause 32-bit overflow,
   300   // under the assumption that x+y is in my own subrange this->type().
   299   // under the assumption that x+y is in my own subrange this->type().
   301 
   300 
   302   // This assumption is based on a constraint (i.e., type assertion)
   301   // This assumption is based on a constraint (i.e., type assertion)
   303   // established in Parse::array_addressing or perhaps elsewhere.
   302   // established in Parse::array_addressing or perhaps elsewhere.
   317   // There's no common reason to "leak" a constant offset through the I2L.
   316   // There's no common reason to "leak" a constant offset through the I2L.
   318   // Addressing arithmetic will not absorb it as part of a 64-bit AddL.
   317   // Addressing arithmetic will not absorb it as part of a 64-bit AddL.
   319 
   318 
   320   Node* z = in(1);
   319   Node* z = in(1);
   321   int op = z->Opcode();
   320   int op = z->Opcode();
   322   Node* ctrl = NULL;
       
   323   if (op == Op_CastII && z->as_CastII()->has_range_check()) {
       
   324     // Skip CastII node but save control dependency
       
   325     ctrl = z->in(0);
       
   326     z = z->in(1);
       
   327     op = z->Opcode();
       
   328   }
       
   329   if (op == Op_AddI || op == Op_SubI) {
   321   if (op == Op_AddI || op == Op_SubI) {
   330     Node* x = z->in(1);
   322     Node* x = z->in(1);
   331     Node* y = z->in(2);
   323     Node* y = z->in(2);
   332     assert (x != z && y != z, "dead loop in ConvI2LNode::Ideal");
   324     assert (x != z && y != z, "dead loop in ConvI2LNode::Ideal");
   333     if (phase->type(x) == Type::TOP)  return this_changed;
   325     if (phase->type(x) == Type::TOP)  return this_changed;
   383       rylo = -ryhi;
   375       rylo = -ryhi;
   384       ryhi = -rylo0;
   376       ryhi = -rylo0;
   385     }
   377     }
   386     assert(rxlo == (int)rxlo && rxhi == (int)rxhi, "x should not overflow");
   378     assert(rxlo == (int)rxlo && rxhi == (int)rxhi, "x should not overflow");
   387     assert(rylo == (int)rylo && ryhi == (int)ryhi, "y should not overflow");
   379     assert(rylo == (int)rylo && ryhi == (int)ryhi, "y should not overflow");
   388     Node* cx = phase->C->constrained_convI2L(phase, x, TypeInt::make(rxlo, rxhi, widen), ctrl);
   380     Node* cx = phase->C->constrained_convI2L(phase, x, TypeInt::make(rxlo, rxhi, widen), NULL);
   389     Node* cy = phase->C->constrained_convI2L(phase, y, TypeInt::make(rylo, ryhi, widen), ctrl);
   381     Node* cy = phase->C->constrained_convI2L(phase, y, TypeInt::make(rylo, ryhi, widen), NULL);
   390     switch (op) {
   382     switch (op) {
   391       case Op_AddI:  return new AddLNode(cx, cy);
   383       case Op_AddI:  return new AddLNode(cx, cy);
   392       case Op_SubI:  return new SubLNode(cx, cy);
   384       case Op_SubI:  return new SubLNode(cx, cy);
   393       default:       ShouldNotReachHere();
   385       default:       ShouldNotReachHere();
   394     }
   386     }