src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/type.cpp

Print this page
rev 5902 : 8027754: Enable loop optimizations for loops with MathExact inside


 289   TypeD::ONE  = TypeD::make(1.0); // Double 1
 290 
 291   TypeInt::MINUS_1 = TypeInt::make(-1);  // -1
 292   TypeInt::ZERO    = TypeInt::make( 0);  //  0
 293   TypeInt::ONE     = TypeInt::make( 1);  //  1
 294   TypeInt::BOOL    = TypeInt::make(0,1,   WidenMin);  // 0 or 1, FALSE or TRUE.
 295   TypeInt::CC      = TypeInt::make(-1, 1, WidenMin);  // -1, 0 or 1, condition codes
 296   TypeInt::CC_LT   = TypeInt::make(-1,-1, WidenMin);  // == TypeInt::MINUS_1
 297   TypeInt::CC_GT   = TypeInt::make( 1, 1, WidenMin);  // == TypeInt::ONE
 298   TypeInt::CC_EQ   = TypeInt::make( 0, 0, WidenMin);  // == TypeInt::ZERO
 299   TypeInt::CC_LE   = TypeInt::make(-1, 0, WidenMin);
 300   TypeInt::CC_GE   = TypeInt::make( 0, 1, WidenMin);  // == TypeInt::BOOL
 301   TypeInt::BYTE    = TypeInt::make(-128,127,     WidenMin); // Bytes
 302   TypeInt::UBYTE   = TypeInt::make(0, 255,       WidenMin); // Unsigned Bytes
 303   TypeInt::CHAR    = TypeInt::make(0,65535,      WidenMin); // Java chars
 304   TypeInt::SHORT   = TypeInt::make(-32768,32767, WidenMin); // Java shorts
 305   TypeInt::POS     = TypeInt::make(0,max_jint,   WidenMin); // Non-neg values
 306   TypeInt::POS1    = TypeInt::make(1,max_jint,   WidenMin); // Positive values
 307   TypeInt::INT     = TypeInt::make(min_jint,max_jint, WidenMax); // 32-bit integers
 308   TypeInt::SYMINT  = TypeInt::make(-max_jint,max_jint,WidenMin); // symmetric range

 309   // CmpL is overloaded both as the bytecode computation returning
 310   // a trinary (-1,0,+1) integer result AND as an efficient long
 311   // compare returning optimizer ideal-type flags.
 312   assert( TypeInt::CC_LT == TypeInt::MINUS_1, "types must match for CmpL to work" );
 313   assert( TypeInt::CC_GT == TypeInt::ONE,     "types must match for CmpL to work" );
 314   assert( TypeInt::CC_EQ == TypeInt::ZERO,    "types must match for CmpL to work" );
 315   assert( TypeInt::CC_GE == TypeInt::BOOL,    "types must match for CmpL to work" );
 316   assert( (juint)(TypeInt::CC->_hi - TypeInt::CC->_lo) <= SMALLINT, "CC is truly small");
 317 
 318   TypeLong::MINUS_1 = TypeLong::make(-1);        // -1
 319   TypeLong::ZERO    = TypeLong::make( 0);        //  0
 320   TypeLong::ONE     = TypeLong::make( 1);        //  1
 321   TypeLong::POS     = TypeLong::make(0,max_jlong, WidenMin); // Non-neg values
 322   TypeLong::LONG    = TypeLong::make(min_jlong,max_jlong,WidenMax); // 64-bit integers
 323   TypeLong::INT     = TypeLong::make((jlong)min_jint,(jlong)max_jint,WidenMin);
 324   TypeLong::UINT    = TypeLong::make(0,(jlong)max_juint,WidenMin);

 325 
 326   const Type **fboth =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 327   fboth[0] = Type::CONTROL;
 328   fboth[1] = Type::CONTROL;
 329   TypeTuple::IFBOTH = TypeTuple::make( 2, fboth );
 330 
 331   const Type **ffalse =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 332   ffalse[0] = Type::CONTROL;
 333   ffalse[1] = Type::TOP;
 334   TypeTuple::IFFALSE = TypeTuple::make( 2, ffalse );
 335 
 336   const Type **fneither =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 337   fneither[0] = Type::TOP;
 338   fneither[1] = Type::TOP;
 339   TypeTuple::IFNEITHER = TypeTuple::make( 2, fneither );
 340 
 341   const Type **ftrue =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 342   ftrue[0] = Type::TOP;
 343   ftrue[1] = Type::CONTROL;
 344   TypeTuple::IFTRUE = TypeTuple::make( 2, ftrue );


1144 //=============================================================================
1145 // Convience common pre-built types.
1146 const TypeInt *TypeInt::MINUS_1;// -1
1147 const TypeInt *TypeInt::ZERO;   // 0
1148 const TypeInt *TypeInt::ONE;    // 1
1149 const TypeInt *TypeInt::BOOL;   // 0 or 1, FALSE or TRUE.
1150 const TypeInt *TypeInt::CC;     // -1,0 or 1, condition codes
1151 const TypeInt *TypeInt::CC_LT;  // [-1]  == MINUS_1
1152 const TypeInt *TypeInt::CC_GT;  // [1]   == ONE
1153 const TypeInt *TypeInt::CC_EQ;  // [0]   == ZERO
1154 const TypeInt *TypeInt::CC_LE;  // [-1,0]
1155 const TypeInt *TypeInt::CC_GE;  // [0,1] == BOOL (!)
1156 const TypeInt *TypeInt::BYTE;   // Bytes, -128 to 127
1157 const TypeInt *TypeInt::UBYTE;  // Unsigned Bytes, 0 to 255
1158 const TypeInt *TypeInt::CHAR;   // Java chars, 0-65535
1159 const TypeInt *TypeInt::SHORT;  // Java shorts, -32768-32767
1160 const TypeInt *TypeInt::POS;    // Positive 32-bit integers or zero
1161 const TypeInt *TypeInt::POS1;   // Positive 32-bit integers
1162 const TypeInt *TypeInt::INT;    // 32-bit integers
1163 const TypeInt *TypeInt::SYMINT; // symmetric range [-max_jint..max_jint]

1164 
1165 //------------------------------TypeInt----------------------------------------
1166 TypeInt::TypeInt( jint lo, jint hi, int w ) : Type(Int), _lo(lo), _hi(hi), _widen(w) {
1167 }
1168 
1169 //------------------------------make-------------------------------------------
1170 const TypeInt *TypeInt::make( jint lo ) {
1171   return (TypeInt*)(new TypeInt(lo,lo,WidenMin))->hashcons();
1172 }
1173 
1174 static int normalize_int_widen( jint lo, jint hi, int w ) {
1175   // Certain normalizations keep us sane when comparing types.
1176   // The 'SMALLINT' covers constants and also CC and its relatives.
1177   if (lo <= hi) {
1178     if ((juint)(hi - lo) <= SMALLINT)  w = Type::WidenMin;
1179     if ((juint)(hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
1180   } else {
1181     if ((juint)(lo - hi) <= SMALLINT)  w = Type::WidenMin;
1182     if ((juint)(lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
1183   }


1401 //------------------------------singleton--------------------------------------
1402 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1403 // constants.
1404 bool TypeInt::singleton(void) const {
1405   return _lo >= _hi;
1406 }
1407 
1408 bool TypeInt::empty(void) const {
1409   return _lo > _hi;
1410 }
1411 
1412 //=============================================================================
1413 // Convenience common pre-built types.
1414 const TypeLong *TypeLong::MINUS_1;// -1
1415 const TypeLong *TypeLong::ZERO; // 0
1416 const TypeLong *TypeLong::ONE;  // 1
1417 const TypeLong *TypeLong::POS;  // >=0
1418 const TypeLong *TypeLong::LONG; // 64-bit integers
1419 const TypeLong *TypeLong::INT;  // 32-bit subrange
1420 const TypeLong *TypeLong::UINT; // 32-bit unsigned subrange

1421 
1422 //------------------------------TypeLong---------------------------------------
1423 TypeLong::TypeLong( jlong lo, jlong hi, int w ) : Type(Long), _lo(lo), _hi(hi), _widen(w) {
1424 }
1425 
1426 //------------------------------make-------------------------------------------
1427 const TypeLong *TypeLong::make( jlong lo ) {
1428   return (TypeLong*)(new TypeLong(lo,lo,WidenMin))->hashcons();
1429 }
1430 
1431 static int normalize_long_widen( jlong lo, jlong hi, int w ) {
1432   // Certain normalizations keep us sane when comparing types.
1433   // The 'SMALLINT' covers constants.
1434   if (lo <= hi) {
1435     if ((julong)(hi - lo) <= SMALLINT)   w = Type::WidenMin;
1436     if ((julong)(hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG
1437   } else {
1438     if ((julong)(lo - hi) <= SMALLINT)   w = Type::WidenMin;
1439     if ((julong)(lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
1440   }




 289   TypeD::ONE  = TypeD::make(1.0); // Double 1
 290 
 291   TypeInt::MINUS_1 = TypeInt::make(-1);  // -1
 292   TypeInt::ZERO    = TypeInt::make( 0);  //  0
 293   TypeInt::ONE     = TypeInt::make( 1);  //  1
 294   TypeInt::BOOL    = TypeInt::make(0,1,   WidenMin);  // 0 or 1, FALSE or TRUE.
 295   TypeInt::CC      = TypeInt::make(-1, 1, WidenMin);  // -1, 0 or 1, condition codes
 296   TypeInt::CC_LT   = TypeInt::make(-1,-1, WidenMin);  // == TypeInt::MINUS_1
 297   TypeInt::CC_GT   = TypeInt::make( 1, 1, WidenMin);  // == TypeInt::ONE
 298   TypeInt::CC_EQ   = TypeInt::make( 0, 0, WidenMin);  // == TypeInt::ZERO
 299   TypeInt::CC_LE   = TypeInt::make(-1, 0, WidenMin);
 300   TypeInt::CC_GE   = TypeInt::make( 0, 1, WidenMin);  // == TypeInt::BOOL
 301   TypeInt::BYTE    = TypeInt::make(-128,127,     WidenMin); // Bytes
 302   TypeInt::UBYTE   = TypeInt::make(0, 255,       WidenMin); // Unsigned Bytes
 303   TypeInt::CHAR    = TypeInt::make(0,65535,      WidenMin); // Java chars
 304   TypeInt::SHORT   = TypeInt::make(-32768,32767, WidenMin); // Java shorts
 305   TypeInt::POS     = TypeInt::make(0,max_jint,   WidenMin); // Non-neg values
 306   TypeInt::POS1    = TypeInt::make(1,max_jint,   WidenMin); // Positive values
 307   TypeInt::INT     = TypeInt::make(min_jint,max_jint, WidenMax); // 32-bit integers
 308   TypeInt::SYMINT  = TypeInt::make(-max_jint,max_jint,WidenMin); // symmetric range
 309   TypeInt::TYPE_DOMAIN  = TypeInt::INT;
 310   // CmpL is overloaded both as the bytecode computation returning
 311   // a trinary (-1,0,+1) integer result AND as an efficient long
 312   // compare returning optimizer ideal-type flags.
 313   assert( TypeInt::CC_LT == TypeInt::MINUS_1, "types must match for CmpL to work" );
 314   assert( TypeInt::CC_GT == TypeInt::ONE,     "types must match for CmpL to work" );
 315   assert( TypeInt::CC_EQ == TypeInt::ZERO,    "types must match for CmpL to work" );
 316   assert( TypeInt::CC_GE == TypeInt::BOOL,    "types must match for CmpL to work" );
 317   assert( (juint)(TypeInt::CC->_hi - TypeInt::CC->_lo) <= SMALLINT, "CC is truly small");
 318 
 319   TypeLong::MINUS_1 = TypeLong::make(-1);        // -1
 320   TypeLong::ZERO    = TypeLong::make( 0);        //  0
 321   TypeLong::ONE     = TypeLong::make( 1);        //  1
 322   TypeLong::POS     = TypeLong::make(0,max_jlong, WidenMin); // Non-neg values
 323   TypeLong::LONG    = TypeLong::make(min_jlong,max_jlong,WidenMax); // 64-bit integers
 324   TypeLong::INT     = TypeLong::make((jlong)min_jint,(jlong)max_jint,WidenMin);
 325   TypeLong::UINT    = TypeLong::make(0,(jlong)max_juint,WidenMin);
 326   TypeLong::TYPE_DOMAIN  = TypeLong::LONG;
 327 
 328   const Type **fboth =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 329   fboth[0] = Type::CONTROL;
 330   fboth[1] = Type::CONTROL;
 331   TypeTuple::IFBOTH = TypeTuple::make( 2, fboth );
 332 
 333   const Type **ffalse =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 334   ffalse[0] = Type::CONTROL;
 335   ffalse[1] = Type::TOP;
 336   TypeTuple::IFFALSE = TypeTuple::make( 2, ffalse );
 337 
 338   const Type **fneither =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 339   fneither[0] = Type::TOP;
 340   fneither[1] = Type::TOP;
 341   TypeTuple::IFNEITHER = TypeTuple::make( 2, fneither );
 342 
 343   const Type **ftrue =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 344   ftrue[0] = Type::TOP;
 345   ftrue[1] = Type::CONTROL;
 346   TypeTuple::IFTRUE = TypeTuple::make( 2, ftrue );


1146 //=============================================================================
1147 // Convience common pre-built types.
1148 const TypeInt *TypeInt::MINUS_1;// -1
1149 const TypeInt *TypeInt::ZERO;   // 0
1150 const TypeInt *TypeInt::ONE;    // 1
1151 const TypeInt *TypeInt::BOOL;   // 0 or 1, FALSE or TRUE.
1152 const TypeInt *TypeInt::CC;     // -1,0 or 1, condition codes
1153 const TypeInt *TypeInt::CC_LT;  // [-1]  == MINUS_1
1154 const TypeInt *TypeInt::CC_GT;  // [1]   == ONE
1155 const TypeInt *TypeInt::CC_EQ;  // [0]   == ZERO
1156 const TypeInt *TypeInt::CC_LE;  // [-1,0]
1157 const TypeInt *TypeInt::CC_GE;  // [0,1] == BOOL (!)
1158 const TypeInt *TypeInt::BYTE;   // Bytes, -128 to 127
1159 const TypeInt *TypeInt::UBYTE;  // Unsigned Bytes, 0 to 255
1160 const TypeInt *TypeInt::CHAR;   // Java chars, 0-65535
1161 const TypeInt *TypeInt::SHORT;  // Java shorts, -32768-32767
1162 const TypeInt *TypeInt::POS;    // Positive 32-bit integers or zero
1163 const TypeInt *TypeInt::POS1;   // Positive 32-bit integers
1164 const TypeInt *TypeInt::INT;    // 32-bit integers
1165 const TypeInt *TypeInt::SYMINT; // symmetric range [-max_jint..max_jint]
1166 const TypeInt *TypeInt::TYPE_DOMAIN; // alias for TypeInt::INT
1167 
1168 //------------------------------TypeInt----------------------------------------
1169 TypeInt::TypeInt( jint lo, jint hi, int w ) : Type(Int), _lo(lo), _hi(hi), _widen(w) {
1170 }
1171 
1172 //------------------------------make-------------------------------------------
1173 const TypeInt *TypeInt::make( jint lo ) {
1174   return (TypeInt*)(new TypeInt(lo,lo,WidenMin))->hashcons();
1175 }
1176 
1177 static int normalize_int_widen( jint lo, jint hi, int w ) {
1178   // Certain normalizations keep us sane when comparing types.
1179   // The 'SMALLINT' covers constants and also CC and its relatives.
1180   if (lo <= hi) {
1181     if ((juint)(hi - lo) <= SMALLINT)  w = Type::WidenMin;
1182     if ((juint)(hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
1183   } else {
1184     if ((juint)(lo - hi) <= SMALLINT)  w = Type::WidenMin;
1185     if ((juint)(lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
1186   }


1404 //------------------------------singleton--------------------------------------
1405 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1406 // constants.
1407 bool TypeInt::singleton(void) const {
1408   return _lo >= _hi;
1409 }
1410 
1411 bool TypeInt::empty(void) const {
1412   return _lo > _hi;
1413 }
1414 
1415 //=============================================================================
1416 // Convenience common pre-built types.
1417 const TypeLong *TypeLong::MINUS_1;// -1
1418 const TypeLong *TypeLong::ZERO; // 0
1419 const TypeLong *TypeLong::ONE;  // 1
1420 const TypeLong *TypeLong::POS;  // >=0
1421 const TypeLong *TypeLong::LONG; // 64-bit integers
1422 const TypeLong *TypeLong::INT;  // 32-bit subrange
1423 const TypeLong *TypeLong::UINT; // 32-bit unsigned subrange
1424 const TypeLong *TypeLong::TYPE_DOMAIN; // alias for TypeLong::LONG
1425 
1426 //------------------------------TypeLong---------------------------------------
1427 TypeLong::TypeLong( jlong lo, jlong hi, int w ) : Type(Long), _lo(lo), _hi(hi), _widen(w) {
1428 }
1429 
1430 //------------------------------make-------------------------------------------
1431 const TypeLong *TypeLong::make( jlong lo ) {
1432   return (TypeLong*)(new TypeLong(lo,lo,WidenMin))->hashcons();
1433 }
1434 
1435 static int normalize_long_widen( jlong lo, jlong hi, int w ) {
1436   // Certain normalizations keep us sane when comparing types.
1437   // The 'SMALLINT' covers constants.
1438   if (lo <= hi) {
1439     if ((julong)(hi - lo) <= SMALLINT)   w = Type::WidenMin;
1440     if ((julong)(hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG
1441   } else {
1442     if ((julong)(lo - hi) <= SMALLINT)   w = Type::WidenMin;
1443     if ((julong)(lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
1444   }


src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File