419 Arena* save = current->type_arena(); 420 Arena* shared_type_arena = new (mtCompiler)Arena(mtCompiler); 421 422 current->set_type_arena(shared_type_arena); 423 _shared_type_dict = 424 new (shared_type_arena) Dict( (CmpKey)Type::cmp, (Hash)Type::uhash, 425 shared_type_arena, 128 ); 426 current->set_type_dict(_shared_type_dict); 427 428 // Make shared pre-built types. 429 CONTROL = make(Control); // Control only 430 TOP = make(Top); // No values in set 431 MEMORY = make(Memory); // Abstract store only 432 ABIO = make(Abio); // State-of-machine only 433 RETURN_ADDRESS=make(Return_Address); 434 FLOAT = make(FloatBot); // All floats 435 DOUBLE = make(DoubleBot); // All doubles 436 BOTTOM = make(Bottom); // Everything 437 HALF = make(Half); // Placeholder half of doublewide type 438 439 TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero) 440 TypeF::ONE = TypeF::make(1.0); // Float 1 441 TypeF::POS_INF = TypeF::make(jfloat_cast(POSITIVE_INFINITE_F)); 442 TypeF::NEG_INF = TypeF::make(-jfloat_cast(POSITIVE_INFINITE_F)); 443 444 TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero) 445 TypeD::ONE = TypeD::make(1.0); // Double 1 446 TypeD::POS_INF = TypeD::make(jdouble_cast(POSITIVE_INFINITE_D)); 447 TypeD::NEG_INF = TypeD::make(-jdouble_cast(POSITIVE_INFINITE_D)); 448 449 TypeInt::MINUS_1 = TypeInt::make(-1); // -1 450 TypeInt::ZERO = TypeInt::make( 0); // 0 451 TypeInt::ONE = TypeInt::make( 1); // 1 452 TypeInt::BOOL = TypeInt::make(0,1, WidenMin); // 0 or 1, FALSE or TRUE. 453 TypeInt::CC = TypeInt::make(-1, 1, WidenMin); // -1, 0 or 1, condition codes 454 TypeInt::CC_LT = TypeInt::make(-1,-1, WidenMin); // == TypeInt::MINUS_1 455 TypeInt::CC_GT = TypeInt::make( 1, 1, WidenMin); // == TypeInt::ONE 456 TypeInt::CC_EQ = TypeInt::make( 0, 0, WidenMin); // == TypeInt::ZERO 457 TypeInt::CC_LE = TypeInt::make(-1, 0, WidenMin); 458 TypeInt::CC_GE = TypeInt::make( 0, 1, WidenMin); // == TypeInt::BOOL 459 TypeInt::BYTE = TypeInt::make(-128,127, WidenMin); // Bytes 460 TypeInt::UBYTE = TypeInt::make(0, 255, WidenMin); // Unsigned Bytes 461 TypeInt::CHAR = TypeInt::make(0,65535, WidenMin); // Java chars 462 TypeInt::SHORT = TypeInt::make(-32768,32767, WidenMin); // Java shorts 463 TypeInt::POS = TypeInt::make(0,max_jint, WidenMin); // Non-neg values 464 TypeInt::POS1 = TypeInt::make(1,max_jint, WidenMin); // Positive values 465 TypeInt::INT = TypeInt::make(min_jint,max_jint, WidenMax); // 32-bit integers 466 TypeInt::SYMINT = TypeInt::make(-max_jint,max_jint,WidenMin); // symmetric range 467 TypeInt::TYPE_DOMAIN = TypeInt::INT; 468 // CmpL is overloaded both as the bytecode computation returning 469 // a trinary (-1,0,+1) integer result AND as an efficient long 470 // compare returning optimizer ideal-type flags. 471 assert( TypeInt::CC_LT == TypeInt::MINUS_1, "types must match for CmpL to work" ); 472 assert( TypeInt::CC_GT == TypeInt::ONE, "types must match for CmpL to work" ); 473 assert( TypeInt::CC_EQ == TypeInt::ZERO, "types must match for CmpL to work" ); 474 assert( TypeInt::CC_GE == TypeInt::BOOL, "types must match for CmpL to work" ); 475 assert( (juint)(TypeInt::CC->_hi - TypeInt::CC->_lo) <= SMALLINT, "CC is truly small"); 476 477 TypeLong::MINUS_1 = TypeLong::make(-1); // -1 478 TypeLong::ZERO = TypeLong::make( 0); // 0 479 TypeLong::ONE = TypeLong::make( 1); // 1 480 TypeLong::POS = TypeLong::make(0,max_jlong, WidenMin); // Non-neg values 481 TypeLong::LONG = TypeLong::make(min_jlong,max_jlong,WidenMax); // 64-bit integers 482 TypeLong::INT = TypeLong::make((jlong)min_jint,(jlong)max_jint,WidenMin); 483 TypeLong::UINT = TypeLong::make(0,(jlong)max_juint,WidenMin); 484 TypeLong::TYPE_DOMAIN = TypeLong::LONG; 485 486 const Type **fboth =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*)); 487 fboth[0] = Type::CONTROL; 488 fboth[1] = Type::CONTROL; 489 TypeTuple::IFBOTH = TypeTuple::make( 2, fboth ); 490 491 const Type **ffalse =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*)); 492 ffalse[0] = Type::CONTROL; 493 ffalse[1] = Type::TOP; 494 TypeTuple::IFFALSE = TypeTuple::make( 2, ffalse ); 495 496 const Type **fneither =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*)); 1092 void Type::dump_stats() { 1093 tty->print("Types made: %d\n", type_dict()->Size()); 1094 } 1095 #endif 1096 1097 //------------------------------typerr----------------------------------------- 1098 void Type::typerr( const Type *t ) const { 1099 #ifndef PRODUCT 1100 tty->print("\nError mixing types: "); 1101 dump(); 1102 tty->print(" and "); 1103 t->dump(); 1104 tty->print("\n"); 1105 #endif 1106 ShouldNotReachHere(); 1107 } 1108 1109 1110 //============================================================================= 1111 // Convenience common pre-built types. 1112 const TypeF *TypeF::ZERO; // Floating point zero 1113 const TypeF *TypeF::ONE; // Floating point one 1114 const TypeF *TypeF::POS_INF; // Floating point positive infinity 1115 const TypeF *TypeF::NEG_INF; // Floating point negative infinity 1116 1117 //------------------------------make------------------------------------------- 1118 // Create a float constant 1119 const TypeF *TypeF::make(float f) { 1120 return (TypeF*)(new TypeF(f))->hashcons(); 1121 } 1122 1123 //------------------------------meet------------------------------------------- 1124 // Compute the MEET of two types. It returns a new Type object. 1125 const Type *TypeF::xmeet( const Type *t ) const { 1126 // Perform a fast test for common case; meeting the same types together. 1127 if( this == t ) return this; // Meeting same type-rep? 1128 1129 // Current "this->_base" is FloatCon 1130 switch (t->base()) { // Switch on original type 1131 case AnyPtr: // Mixing with oops happens when javac 1202 void TypeF::dump2( Dict &d, uint depth, outputStream *st ) const { 1203 Type::dump2(d,depth, st); 1204 st->print("%f", _f); 1205 } 1206 #endif 1207 1208 //------------------------------singleton-------------------------------------- 1209 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 1210 // constants (Ldi nodes). Singletons are integer, float or double constants 1211 // or a single symbol. 1212 bool TypeF::singleton(void) const { 1213 return true; // Always a singleton 1214 } 1215 1216 bool TypeF::empty(void) const { 1217 return false; // always exactly a singleton 1218 } 1219 1220 //============================================================================= 1221 // Convenience common pre-built types. 1222 const TypeD *TypeD::ZERO; // Floating point zero 1223 const TypeD *TypeD::ONE; // Floating point one 1224 const TypeD *TypeD::POS_INF; // Floating point positive infinity 1225 const TypeD *TypeD::NEG_INF; // Floating point negative infinity 1226 1227 //------------------------------make------------------------------------------- 1228 const TypeD *TypeD::make(double d) { 1229 return (TypeD*)(new TypeD(d))->hashcons(); 1230 } 1231 1232 //------------------------------meet------------------------------------------- 1233 // Compute the MEET of two types. It returns a new Type object. 1234 const Type *TypeD::xmeet( const Type *t ) const { 1235 // Perform a fast test for common case; meeting the same types together. 1236 if( this == t ) return this; // Meeting same type-rep? 1237 1238 // Current "this->_base" is DoubleCon 1239 switch (t->base()) { // Switch on original type 1240 case AnyPtr: // Mixing with oops happens when javac 1241 case RawPtr: // reuses local variables 1308 void TypeD::dump2( Dict &d, uint depth, outputStream *st ) const { 1309 Type::dump2(d,depth,st); 1310 st->print("%f", _d); 1311 } 1312 #endif 1313 1314 //------------------------------singleton-------------------------------------- 1315 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 1316 // constants (Ldi nodes). Singletons are integer, float or double constants 1317 // or a single symbol. 1318 bool TypeD::singleton(void) const { 1319 return true; // Always a singleton 1320 } 1321 1322 bool TypeD::empty(void) const { 1323 return false; // always exactly a singleton 1324 } 1325 1326 //============================================================================= 1327 // Convience common pre-built types. 1328 const TypeInt *TypeInt::MINUS_1;// -1 1329 const TypeInt *TypeInt::ZERO; // 0 1330 const TypeInt *TypeInt::ONE; // 1 1331 const TypeInt *TypeInt::BOOL; // 0 or 1, FALSE or TRUE. 1332 const TypeInt *TypeInt::CC; // -1,0 or 1, condition codes 1333 const TypeInt *TypeInt::CC_LT; // [-1] == MINUS_1 1334 const TypeInt *TypeInt::CC_GT; // [1] == ONE 1335 const TypeInt *TypeInt::CC_EQ; // [0] == ZERO 1336 const TypeInt *TypeInt::CC_LE; // [-1,0] 1337 const TypeInt *TypeInt::CC_GE; // [0,1] == BOOL (!) 1338 const TypeInt *TypeInt::BYTE; // Bytes, -128 to 127 1339 const TypeInt *TypeInt::UBYTE; // Unsigned Bytes, 0 to 255 1340 const TypeInt *TypeInt::CHAR; // Java chars, 0-65535 1341 const TypeInt *TypeInt::SHORT; // Java shorts, -32768-32767 1342 const TypeInt *TypeInt::POS; // Positive 32-bit integers or zero 1343 const TypeInt *TypeInt::POS1; // Positive 32-bit integers 1344 const TypeInt *TypeInt::INT; // 32-bit integers 1345 const TypeInt *TypeInt::SYMINT; // symmetric range [-max_jint..max_jint] 1346 const TypeInt *TypeInt::TYPE_DOMAIN; // alias for TypeInt::INT 1347 1577 st->print("int:%s..%s", intname(buf, _lo), intname(buf2, _hi)); 1578 1579 if (_widen != 0 && this != TypeInt::INT) 1580 st->print(":%.*s", _widen, "wwww"); 1581 } 1582 #endif 1583 1584 //------------------------------singleton-------------------------------------- 1585 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 1586 // constants. 1587 bool TypeInt::singleton(void) const { 1588 return _lo >= _hi; 1589 } 1590 1591 bool TypeInt::empty(void) const { 1592 return _lo > _hi; 1593 } 1594 1595 //============================================================================= 1596 // Convenience common pre-built types. 1597 const TypeLong *TypeLong::MINUS_1;// -1 1598 const TypeLong *TypeLong::ZERO; // 0 1599 const TypeLong *TypeLong::ONE; // 1 1600 const TypeLong *TypeLong::POS; // >=0 1601 const TypeLong *TypeLong::LONG; // 64-bit integers 1602 const TypeLong *TypeLong::INT; // 32-bit subrange 1603 const TypeLong *TypeLong::UINT; // 32-bit unsigned subrange 1604 const TypeLong *TypeLong::TYPE_DOMAIN; // alias for TypeLong::LONG 1605 1606 //------------------------------TypeLong--------------------------------------- 1607 TypeLong::TypeLong( jlong lo, jlong hi, int w ) : Type(Long), _lo(lo), _hi(hi), _widen(w) { 1608 } 1609 1610 //------------------------------make------------------------------------------- 1611 const TypeLong *TypeLong::make( jlong lo ) { 1612 return (TypeLong*)(new TypeLong(lo,lo,WidenMin))->hashcons(); 1613 } 1614 1615 static int normalize_long_widen( jlong lo, jlong hi, int w ) { 1616 // Certain normalizations keep us sane when comparing types. | 419 Arena* save = current->type_arena(); 420 Arena* shared_type_arena = new (mtCompiler)Arena(mtCompiler); 421 422 current->set_type_arena(shared_type_arena); 423 _shared_type_dict = 424 new (shared_type_arena) Dict( (CmpKey)Type::cmp, (Hash)Type::uhash, 425 shared_type_arena, 128 ); 426 current->set_type_dict(_shared_type_dict); 427 428 // Make shared pre-built types. 429 CONTROL = make(Control); // Control only 430 TOP = make(Top); // No values in set 431 MEMORY = make(Memory); // Abstract store only 432 ABIO = make(Abio); // State-of-machine only 433 RETURN_ADDRESS=make(Return_Address); 434 FLOAT = make(FloatBot); // All floats 435 DOUBLE = make(DoubleBot); // All doubles 436 BOTTOM = make(Bottom); // Everything 437 HALF = make(Half); // Placeholder half of doublewide type 438 439 TypeF::MAX = TypeF::make(max_jfloat); // Float MAX 440 TypeF::MIN = TypeF::make(min_jfloat); // Float MIN 441 TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero) 442 TypeF::ONE = TypeF::make(1.0); // Float 1 443 TypeF::POS_INF = TypeF::make(jfloat_cast(POSITIVE_INFINITE_F)); 444 TypeF::NEG_INF = TypeF::make(-jfloat_cast(POSITIVE_INFINITE_F)); 445 446 TypeD::MAX = TypeD::make(max_jdouble); // Double MAX 447 TypeD::MIN = TypeD::make(min_jdouble); // Double MIN 448 TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero) 449 TypeD::ONE = TypeD::make(1.0); // Double 1 450 TypeD::POS_INF = TypeD::make(jdouble_cast(POSITIVE_INFINITE_D)); 451 TypeD::NEG_INF = TypeD::make(-jdouble_cast(POSITIVE_INFINITE_D)); 452 453 TypeInt::MAX = TypeInt::make(max_jint); // Int MAX 454 TypeInt::MIN = TypeInt::make(min_jint); // Int MIN 455 TypeInt::MINUS_1 = TypeInt::make(-1); // -1 456 TypeInt::ZERO = TypeInt::make( 0); // 0 457 TypeInt::ONE = TypeInt::make( 1); // 1 458 TypeInt::BOOL = TypeInt::make(0,1, WidenMin); // 0 or 1, FALSE or TRUE. 459 TypeInt::CC = TypeInt::make(-1, 1, WidenMin); // -1, 0 or 1, condition codes 460 TypeInt::CC_LT = TypeInt::make(-1,-1, WidenMin); // == TypeInt::MINUS_1 461 TypeInt::CC_GT = TypeInt::make( 1, 1, WidenMin); // == TypeInt::ONE 462 TypeInt::CC_EQ = TypeInt::make( 0, 0, WidenMin); // == TypeInt::ZERO 463 TypeInt::CC_LE = TypeInt::make(-1, 0, WidenMin); 464 TypeInt::CC_GE = TypeInt::make( 0, 1, WidenMin); // == TypeInt::BOOL 465 TypeInt::BYTE = TypeInt::make(-128,127, WidenMin); // Bytes 466 TypeInt::UBYTE = TypeInt::make(0, 255, WidenMin); // Unsigned Bytes 467 TypeInt::CHAR = TypeInt::make(0,65535, WidenMin); // Java chars 468 TypeInt::SHORT = TypeInt::make(-32768,32767, WidenMin); // Java shorts 469 TypeInt::POS = TypeInt::make(0,max_jint, WidenMin); // Non-neg values 470 TypeInt::POS1 = TypeInt::make(1,max_jint, WidenMin); // Positive values 471 TypeInt::INT = TypeInt::make(min_jint,max_jint, WidenMax); // 32-bit integers 472 TypeInt::SYMINT = TypeInt::make(-max_jint,max_jint,WidenMin); // symmetric range 473 TypeInt::TYPE_DOMAIN = TypeInt::INT; 474 // CmpL is overloaded both as the bytecode computation returning 475 // a trinary (-1,0,+1) integer result AND as an efficient long 476 // compare returning optimizer ideal-type flags. 477 assert( TypeInt::CC_LT == TypeInt::MINUS_1, "types must match for CmpL to work" ); 478 assert( TypeInt::CC_GT == TypeInt::ONE, "types must match for CmpL to work" ); 479 assert( TypeInt::CC_EQ == TypeInt::ZERO, "types must match for CmpL to work" ); 480 assert( TypeInt::CC_GE == TypeInt::BOOL, "types must match for CmpL to work" ); 481 assert( (juint)(TypeInt::CC->_hi - TypeInt::CC->_lo) <= SMALLINT, "CC is truly small"); 482 483 TypeLong::MAX = TypeLong::make(max_jlong); // Long MAX 484 TypeLong::MIN = TypeLong::make(min_jlong); // Long MIN 485 TypeLong::MINUS_1 = TypeLong::make(-1); // -1 486 TypeLong::ZERO = TypeLong::make( 0); // 0 487 TypeLong::ONE = TypeLong::make( 1); // 1 488 TypeLong::POS = TypeLong::make(0,max_jlong, WidenMin); // Non-neg values 489 TypeLong::LONG = TypeLong::make(min_jlong,max_jlong,WidenMax); // 64-bit integers 490 TypeLong::INT = TypeLong::make((jlong)min_jint,(jlong)max_jint,WidenMin); 491 TypeLong::UINT = TypeLong::make(0,(jlong)max_juint,WidenMin); 492 TypeLong::TYPE_DOMAIN = TypeLong::LONG; 493 494 const Type **fboth =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*)); 495 fboth[0] = Type::CONTROL; 496 fboth[1] = Type::CONTROL; 497 TypeTuple::IFBOTH = TypeTuple::make( 2, fboth ); 498 499 const Type **ffalse =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*)); 500 ffalse[0] = Type::CONTROL; 501 ffalse[1] = Type::TOP; 502 TypeTuple::IFFALSE = TypeTuple::make( 2, ffalse ); 503 504 const Type **fneither =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*)); 1100 void Type::dump_stats() { 1101 tty->print("Types made: %d\n", type_dict()->Size()); 1102 } 1103 #endif 1104 1105 //------------------------------typerr----------------------------------------- 1106 void Type::typerr( const Type *t ) const { 1107 #ifndef PRODUCT 1108 tty->print("\nError mixing types: "); 1109 dump(); 1110 tty->print(" and "); 1111 t->dump(); 1112 tty->print("\n"); 1113 #endif 1114 ShouldNotReachHere(); 1115 } 1116 1117 1118 //============================================================================= 1119 // Convenience common pre-built types. 1120 const TypeF *TypeF::MAX; // Floating point max 1121 const TypeF *TypeF::MIN; // Floating point min 1122 const TypeF *TypeF::ZERO; // Floating point zero 1123 const TypeF *TypeF::ONE; // Floating point one 1124 const TypeF *TypeF::POS_INF; // Floating point positive infinity 1125 const TypeF *TypeF::NEG_INF; // Floating point negative infinity 1126 1127 //------------------------------make------------------------------------------- 1128 // Create a float constant 1129 const TypeF *TypeF::make(float f) { 1130 return (TypeF*)(new TypeF(f))->hashcons(); 1131 } 1132 1133 //------------------------------meet------------------------------------------- 1134 // Compute the MEET of two types. It returns a new Type object. 1135 const Type *TypeF::xmeet( const Type *t ) const { 1136 // Perform a fast test for common case; meeting the same types together. 1137 if( this == t ) return this; // Meeting same type-rep? 1138 1139 // Current "this->_base" is FloatCon 1140 switch (t->base()) { // Switch on original type 1141 case AnyPtr: // Mixing with oops happens when javac 1212 void TypeF::dump2( Dict &d, uint depth, outputStream *st ) const { 1213 Type::dump2(d,depth, st); 1214 st->print("%f", _f); 1215 } 1216 #endif 1217 1218 //------------------------------singleton-------------------------------------- 1219 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 1220 // constants (Ldi nodes). Singletons are integer, float or double constants 1221 // or a single symbol. 1222 bool TypeF::singleton(void) const { 1223 return true; // Always a singleton 1224 } 1225 1226 bool TypeF::empty(void) const { 1227 return false; // always exactly a singleton 1228 } 1229 1230 //============================================================================= 1231 // Convenience common pre-built types. 1232 const TypeD *TypeD::MAX; // Floating point max 1233 const TypeD *TypeD::MIN; // Floating point min 1234 const TypeD *TypeD::ZERO; // Floating point zero 1235 const TypeD *TypeD::ONE; // Floating point one 1236 const TypeD *TypeD::POS_INF; // Floating point positive infinity 1237 const TypeD *TypeD::NEG_INF; // Floating point negative infinity 1238 1239 //------------------------------make------------------------------------------- 1240 const TypeD *TypeD::make(double d) { 1241 return (TypeD*)(new TypeD(d))->hashcons(); 1242 } 1243 1244 //------------------------------meet------------------------------------------- 1245 // Compute the MEET of two types. It returns a new Type object. 1246 const Type *TypeD::xmeet( const Type *t ) const { 1247 // Perform a fast test for common case; meeting the same types together. 1248 if( this == t ) return this; // Meeting same type-rep? 1249 1250 // Current "this->_base" is DoubleCon 1251 switch (t->base()) { // Switch on original type 1252 case AnyPtr: // Mixing with oops happens when javac 1253 case RawPtr: // reuses local variables 1320 void TypeD::dump2( Dict &d, uint depth, outputStream *st ) const { 1321 Type::dump2(d,depth,st); 1322 st->print("%f", _d); 1323 } 1324 #endif 1325 1326 //------------------------------singleton-------------------------------------- 1327 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 1328 // constants (Ldi nodes). Singletons are integer, float or double constants 1329 // or a single symbol. 1330 bool TypeD::singleton(void) const { 1331 return true; // Always a singleton 1332 } 1333 1334 bool TypeD::empty(void) const { 1335 return false; // always exactly a singleton 1336 } 1337 1338 //============================================================================= 1339 // Convience common pre-built types. 1340 const TypeInt *TypeInt::MAX; // INT_MAX 1341 const TypeInt *TypeInt::MIN; // INT_MIN 1342 const TypeInt *TypeInt::MINUS_1;// -1 1343 const TypeInt *TypeInt::ZERO; // 0 1344 const TypeInt *TypeInt::ONE; // 1 1345 const TypeInt *TypeInt::BOOL; // 0 or 1, FALSE or TRUE. 1346 const TypeInt *TypeInt::CC; // -1,0 or 1, condition codes 1347 const TypeInt *TypeInt::CC_LT; // [-1] == MINUS_1 1348 const TypeInt *TypeInt::CC_GT; // [1] == ONE 1349 const TypeInt *TypeInt::CC_EQ; // [0] == ZERO 1350 const TypeInt *TypeInt::CC_LE; // [-1,0] 1351 const TypeInt *TypeInt::CC_GE; // [0,1] == BOOL (!) 1352 const TypeInt *TypeInt::BYTE; // Bytes, -128 to 127 1353 const TypeInt *TypeInt::UBYTE; // Unsigned Bytes, 0 to 255 1354 const TypeInt *TypeInt::CHAR; // Java chars, 0-65535 1355 const TypeInt *TypeInt::SHORT; // Java shorts, -32768-32767 1356 const TypeInt *TypeInt::POS; // Positive 32-bit integers or zero 1357 const TypeInt *TypeInt::POS1; // Positive 32-bit integers 1358 const TypeInt *TypeInt::INT; // 32-bit integers 1359 const TypeInt *TypeInt::SYMINT; // symmetric range [-max_jint..max_jint] 1360 const TypeInt *TypeInt::TYPE_DOMAIN; // alias for TypeInt::INT 1361 1591 st->print("int:%s..%s", intname(buf, _lo), intname(buf2, _hi)); 1592 1593 if (_widen != 0 && this != TypeInt::INT) 1594 st->print(":%.*s", _widen, "wwww"); 1595 } 1596 #endif 1597 1598 //------------------------------singleton-------------------------------------- 1599 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple 1600 // constants. 1601 bool TypeInt::singleton(void) const { 1602 return _lo >= _hi; 1603 } 1604 1605 bool TypeInt::empty(void) const { 1606 return _lo > _hi; 1607 } 1608 1609 //============================================================================= 1610 // Convenience common pre-built types. 1611 const TypeLong *TypeLong::MAX; 1612 const TypeLong *TypeLong::MIN; 1613 const TypeLong *TypeLong::MINUS_1;// -1 1614 const TypeLong *TypeLong::ZERO; // 0 1615 const TypeLong *TypeLong::ONE; // 1 1616 const TypeLong *TypeLong::POS; // >=0 1617 const TypeLong *TypeLong::LONG; // 64-bit integers 1618 const TypeLong *TypeLong::INT; // 32-bit subrange 1619 const TypeLong *TypeLong::UINT; // 32-bit unsigned subrange 1620 const TypeLong *TypeLong::TYPE_DOMAIN; // alias for TypeLong::LONG 1621 1622 //------------------------------TypeLong--------------------------------------- 1623 TypeLong::TypeLong( jlong lo, jlong hi, int w ) : Type(Long), _lo(lo), _hi(hi), _widen(w) { 1624 } 1625 1626 //------------------------------make------------------------------------------- 1627 const TypeLong *TypeLong::make( jlong lo ) { 1628 return (TypeLong*)(new TypeLong(lo,lo,WidenMin))->hashcons(); 1629 } 1630 1631 static int normalize_long_widen( jlong lo, jlong hi, int w ) { 1632 // Certain normalizations keep us sane when comparing types. |