hotspot/src/share/vm/opto/movenode.cpp
changeset 35551 36ef3841fb34
parent 34174 4db2fb26dc49
equal deleted inserted replaced
35550:633a22d66bd7 35551:36ef3841fb34
   119 }
   119 }
   120 
   120 
   121 //------------------------------Identity---------------------------------------
   121 //------------------------------Identity---------------------------------------
   122 // Conditional-move is an identity if both inputs are the same, or the test
   122 // Conditional-move is an identity if both inputs are the same, or the test
   123 // true or false.
   123 // true or false.
   124 Node *CMoveNode::Identity( PhaseTransform *phase ) {
   124 Node* CMoveNode::Identity(PhaseGVN* phase) {
   125   if( phase->eqv(in(IfFalse),in(IfTrue)) ) // C-moving identical inputs?
   125   if( phase->eqv(in(IfFalse),in(IfTrue)) ) // C-moving identical inputs?
   126   return in(IfFalse);         // Then it doesn't matter
   126   return in(IfFalse);         // Then it doesn't matter
   127   if( phase->type(in(Condition)) == TypeInt::ZERO )
   127   if( phase->type(in(Condition)) == TypeInt::ZERO )
   128   return in(IfFalse);         // Always pick left(false) input
   128   return in(IfFalse);         // Always pick left(false) input
   129   if( phase->type(in(Condition)) == TypeInt::ONE )
   129   if( phase->type(in(Condition)) == TypeInt::ONE )
   147   return this;
   147   return this;
   148 }
   148 }
   149 
   149 
   150 //------------------------------Value------------------------------------------
   150 //------------------------------Value------------------------------------------
   151 // Result is the meet of inputs
   151 // Result is the meet of inputs
   152 const Type *CMoveNode::Value( PhaseTransform *phase ) const {
   152 const Type* CMoveNode::Value(PhaseGVN* phase) const {
   153   if( phase->type(in(Condition)) == Type::TOP )
   153   if( phase->type(in(Condition)) == Type::TOP )
   154   return Type::TOP;
   154   return Type::TOP;
   155   return phase->type(in(IfFalse))->meet_speculative(phase->type(in(IfTrue)));
   155   return phase->type(in(IfFalse))->meet_speculative(phase->type(in(IfTrue)));
   156 }
   156 }
   157 
   157 
   349 
   349 
   350   return abs;
   350   return abs;
   351 }
   351 }
   352 
   352 
   353 //------------------------------Value------------------------------------------
   353 //------------------------------Value------------------------------------------
   354 const Type *MoveL2DNode::Value( PhaseTransform *phase ) const {
   354 const Type* MoveL2DNode::Value(PhaseGVN* phase) const {
   355   const Type *t = phase->type( in(1) );
   355   const Type *t = phase->type( in(1) );
   356   if( t == Type::TOP ) return Type::TOP;
   356   if( t == Type::TOP ) return Type::TOP;
   357   const TypeLong *tl = t->is_long();
   357   const TypeLong *tl = t->is_long();
   358   if( !tl->is_con() ) return bottom_type();
   358   if( !tl->is_con() ) return bottom_type();
   359   JavaValue v;
   359   JavaValue v;
   360   v.set_jlong(tl->get_con());
   360   v.set_jlong(tl->get_con());
   361   return TypeD::make( v.get_jdouble() );
   361   return TypeD::make( v.get_jdouble() );
   362 }
   362 }
   363 
   363 
   364 //------------------------------Value------------------------------------------
   364 //------------------------------Value------------------------------------------
   365 const Type *MoveI2FNode::Value( PhaseTransform *phase ) const {
   365 const Type* MoveI2FNode::Value(PhaseGVN* phase) const {
   366   const Type *t = phase->type( in(1) );
   366   const Type *t = phase->type( in(1) );
   367   if( t == Type::TOP ) return Type::TOP;
   367   if( t == Type::TOP ) return Type::TOP;
   368   const TypeInt *ti = t->is_int();
   368   const TypeInt *ti = t->is_int();
   369   if( !ti->is_con() )   return bottom_type();
   369   if( !ti->is_con() )   return bottom_type();
   370   JavaValue v;
   370   JavaValue v;
   371   v.set_jint(ti->get_con());
   371   v.set_jint(ti->get_con());
   372   return TypeF::make( v.get_jfloat() );
   372   return TypeF::make( v.get_jfloat() );
   373 }
   373 }
   374 
   374 
   375 //------------------------------Value------------------------------------------
   375 //------------------------------Value------------------------------------------
   376 const Type *MoveF2INode::Value( PhaseTransform *phase ) const {
   376 const Type* MoveF2INode::Value(PhaseGVN* phase) const {
   377   const Type *t = phase->type( in(1) );
   377   const Type *t = phase->type( in(1) );
   378   if( t == Type::TOP )       return Type::TOP;
   378   if( t == Type::TOP )       return Type::TOP;
   379   if( t == Type::FLOAT ) return TypeInt::INT;
   379   if( t == Type::FLOAT ) return TypeInt::INT;
   380   const TypeF *tf = t->is_float_constant();
   380   const TypeF *tf = t->is_float_constant();
   381   JavaValue v;
   381   JavaValue v;
   382   v.set_jfloat(tf->getf());
   382   v.set_jfloat(tf->getf());
   383   return TypeInt::make( v.get_jint() );
   383   return TypeInt::make( v.get_jint() );
   384 }
   384 }
   385 
   385 
   386 //------------------------------Value------------------------------------------
   386 //------------------------------Value------------------------------------------
   387 const Type *MoveD2LNode::Value( PhaseTransform *phase ) const {
   387 const Type* MoveD2LNode::Value(PhaseGVN* phase) const {
   388   const Type *t = phase->type( in(1) );
   388   const Type *t = phase->type( in(1) );
   389   if( t == Type::TOP ) return Type::TOP;
   389   if( t == Type::TOP ) return Type::TOP;
   390   if( t == Type::DOUBLE ) return TypeLong::LONG;
   390   if( t == Type::DOUBLE ) return TypeLong::LONG;
   391   const TypeD *td = t->is_double_constant();
   391   const TypeD *td = t->is_double_constant();
   392   JavaValue v;
   392   JavaValue v;