< prev index next >

src/hotspot/share/opto/type.cpp

Print this page




 425   Arena* save = current->type_arena();
 426   Arena* shared_type_arena = new (mtCompiler)Arena(mtCompiler);
 427 
 428   current->set_type_arena(shared_type_arena);
 429   _shared_type_dict =
 430     new (shared_type_arena) Dict( (CmpKey)Type::cmp, (Hash)Type::uhash,
 431                                   shared_type_arena, 128 );
 432   current->set_type_dict(_shared_type_dict);
 433 
 434   // Make shared pre-built types.
 435   CONTROL = make(Control);      // Control only
 436   TOP     = make(Top);          // No values in set
 437   MEMORY  = make(Memory);       // Abstract store only
 438   ABIO    = make(Abio);         // State-of-machine only
 439   RETURN_ADDRESS=make(Return_Address);
 440   FLOAT   = make(FloatBot);     // All floats
 441   DOUBLE  = make(DoubleBot);    // All doubles
 442   BOTTOM  = make(Bottom);       // Everything
 443   HALF    = make(Half);         // Placeholder half of doublewide type
 444 


 445   TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero)
 446   TypeF::ONE  = TypeF::make(1.0); // Float 1
 447   TypeF::POS_INF = TypeF::make(jfloat_cast(POSITIVE_INFINITE_F));
 448   TypeF::NEG_INF = TypeF::make(-jfloat_cast(POSITIVE_INFINITE_F));
 449 


 450   TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero)
 451   TypeD::ONE  = TypeD::make(1.0); // Double 1
 452   TypeD::POS_INF = TypeD::make(jdouble_cast(POSITIVE_INFINITE_D));
 453   TypeD::NEG_INF = TypeD::make(-jdouble_cast(POSITIVE_INFINITE_D));
 454 


 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::MINUS_1 = TypeLong::make(-1);        // -1
 484   TypeLong::ZERO    = TypeLong::make( 0);        //  0
 485   TypeLong::ONE     = TypeLong::make( 1);        //  1
 486   TypeLong::POS     = TypeLong::make(0,max_jlong, WidenMin); // Non-neg values
 487   TypeLong::LONG    = TypeLong::make(min_jlong,max_jlong,WidenMax); // 64-bit integers
 488   TypeLong::INT     = TypeLong::make((jlong)min_jint,(jlong)max_jint,WidenMin);
 489   TypeLong::UINT    = TypeLong::make(0,(jlong)max_juint,WidenMin);
 490   TypeLong::TYPE_DOMAIN  = TypeLong::LONG;
 491 
 492   const Type **fboth =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 493   fboth[0] = Type::CONTROL;
 494   fboth[1] = Type::CONTROL;
 495   TypeTuple::IFBOTH = TypeTuple::make( 2, fboth );
 496 
 497   const Type **ffalse =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 498   ffalse[0] = Type::CONTROL;
 499   ffalse[1] = Type::TOP;
 500   TypeTuple::IFFALSE = TypeTuple::make( 2, ffalse );
 501 
 502   const Type **fneither =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));


 842 //------------------------------meet-------------------------------------------
 843 // Compute the MEET of two types.  NOT virtual.  It enforces that meet is
 844 // commutative and the lattice is symmetric.
 845 const Type *Type::meet_helper(const Type *t, bool include_speculative) const {
 846   if (isa_narrowoop() && t->isa_narrowoop()) {
 847     const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative);
 848     return result->make_narrowoop();
 849   }
 850   if (isa_narrowklass() && t->isa_narrowklass()) {
 851     const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative);
 852     return result->make_narrowklass();
 853   }
 854 
 855   const Type *this_t = maybe_remove_speculative(include_speculative);
 856   t = t->maybe_remove_speculative(include_speculative);
 857 
 858   const Type *mt = this_t->xmeet(t);
 859 #ifdef ASSERT
 860   if (isa_narrowoop() || t->isa_narrowoop()) return mt;
 861   if (isa_narrowklass() || t->isa_narrowklass()) return mt;

 862   Compile* C = Compile::current();
 863   if (!C->_type_verify_symmetry) {
 864     return mt;
 865   }
 866   this_t->check_symmetrical(t, mt);
 867   // In the case of an array, computing the meet above, caused the
 868   // computation of the meet of the elements which at verification
 869   // time caused the computation of the meet of the dual of the
 870   // elements. Computing the meet of the dual of the arrays here
 871   // causes the meet of the dual of the elements to be computed which
 872   // would cause the meet of the dual of the dual of the elements,
 873   // that is the meet of the elements already computed above to be
 874   // computed. Avoid redundant computations by requesting no
 875   // verification.
 876   C->_type_verify_symmetry = false;
 877   const Type *mt_dual = this_t->_dual->xmeet(t->_dual);
 878   this_t->_dual->check_symmetrical(t->_dual, mt_dual);
 879   assert(!C->_type_verify_symmetry, "shouldn't have changed");
 880   C->_type_verify_symmetry = true;
 881 #endif


1098 void Type::dump_stats() {
1099   tty->print("Types made: %d\n", type_dict()->Size());
1100 }
1101 #endif
1102 
1103 //------------------------------typerr-----------------------------------------
1104 void Type::typerr( const Type *t ) const {
1105 #ifndef PRODUCT
1106   tty->print("\nError mixing types: ");
1107   dump();
1108   tty->print(" and ");
1109   t->dump();
1110   tty->print("\n");
1111 #endif
1112   ShouldNotReachHere();
1113 }
1114 
1115 
1116 //=============================================================================
1117 // Convenience common pre-built types.


1118 const TypeF *TypeF::ZERO;       // Floating point zero
1119 const TypeF *TypeF::ONE;        // Floating point one
1120 const TypeF *TypeF::POS_INF;    // Floating point positive infinity
1121 const TypeF *TypeF::NEG_INF;    // Floating point negative infinity
1122 
1123 //------------------------------make-------------------------------------------
1124 // Create a float constant
1125 const TypeF *TypeF::make(float f) {
1126   return (TypeF*)(new TypeF(f))->hashcons();
1127 }
1128 
1129 //------------------------------meet-------------------------------------------
1130 // Compute the MEET of two types.  It returns a new Type object.
1131 const Type *TypeF::xmeet( const Type *t ) const {
1132   // Perform a fast test for common case; meeting the same types together.
1133   if( this == t ) return this;  // Meeting same type-rep?
1134 
1135   // Current "this->_base" is FloatCon
1136   switch (t->base()) {          // Switch on original type
1137   case AnyPtr:                  // Mixing with oops happens when javac


1208 void TypeF::dump2( Dict &d, uint depth, outputStream *st ) const {
1209   Type::dump2(d,depth, st);
1210   st->print("%f", _f);
1211 }
1212 #endif
1213 
1214 //------------------------------singleton--------------------------------------
1215 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1216 // constants (Ldi nodes).  Singletons are integer, float or double constants
1217 // or a single symbol.
1218 bool TypeF::singleton(void) const {
1219   return true;                  // Always a singleton
1220 }
1221 
1222 bool TypeF::empty(void) const {
1223   return false;                 // always exactly a singleton
1224 }
1225 
1226 //=============================================================================
1227 // Convenience common pre-built types.


1228 const TypeD *TypeD::ZERO;       // Floating point zero
1229 const TypeD *TypeD::ONE;        // Floating point one
1230 const TypeD *TypeD::POS_INF;    // Floating point positive infinity
1231 const TypeD *TypeD::NEG_INF;    // Floating point negative infinity
1232 
1233 //------------------------------make-------------------------------------------
1234 const TypeD *TypeD::make(double d) {
1235   return (TypeD*)(new TypeD(d))->hashcons();
1236 }
1237 
1238 //------------------------------meet-------------------------------------------
1239 // Compute the MEET of two types.  It returns a new Type object.
1240 const Type *TypeD::xmeet( const Type *t ) const {
1241   // Perform a fast test for common case; meeting the same types together.
1242   if( this == t ) return this;  // Meeting same type-rep?
1243 
1244   // Current "this->_base" is DoubleCon
1245   switch (t->base()) {          // Switch on original type
1246   case AnyPtr:                  // Mixing with oops happens when javac
1247   case RawPtr:                  // reuses local variables


1314 void TypeD::dump2( Dict &d, uint depth, outputStream *st ) const {
1315   Type::dump2(d,depth,st);
1316   st->print("%f", _d);
1317 }
1318 #endif
1319 
1320 //------------------------------singleton--------------------------------------
1321 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1322 // constants (Ldi nodes).  Singletons are integer, float or double constants
1323 // or a single symbol.
1324 bool TypeD::singleton(void) const {
1325   return true;                  // Always a singleton
1326 }
1327 
1328 bool TypeD::empty(void) const {
1329   return false;                 // always exactly a singleton
1330 }
1331 
1332 //=============================================================================
1333 // Convience common pre-built types.


1334 const TypeInt *TypeInt::MINUS_1;// -1
1335 const TypeInt *TypeInt::ZERO;   // 0
1336 const TypeInt *TypeInt::ONE;    // 1
1337 const TypeInt *TypeInt::BOOL;   // 0 or 1, FALSE or TRUE.
1338 const TypeInt *TypeInt::CC;     // -1,0 or 1, condition codes
1339 const TypeInt *TypeInt::CC_LT;  // [-1]  == MINUS_1
1340 const TypeInt *TypeInt::CC_GT;  // [1]   == ONE
1341 const TypeInt *TypeInt::CC_EQ;  // [0]   == ZERO
1342 const TypeInt *TypeInt::CC_LE;  // [-1,0]
1343 const TypeInt *TypeInt::CC_GE;  // [0,1] == BOOL (!)
1344 const TypeInt *TypeInt::BYTE;   // Bytes, -128 to 127
1345 const TypeInt *TypeInt::UBYTE;  // Unsigned Bytes, 0 to 255
1346 const TypeInt *TypeInt::CHAR;   // Java chars, 0-65535
1347 const TypeInt *TypeInt::SHORT;  // Java shorts, -32768-32767
1348 const TypeInt *TypeInt::POS;    // Positive 32-bit integers or zero
1349 const TypeInt *TypeInt::POS1;   // Positive 32-bit integers
1350 const TypeInt *TypeInt::INT;    // 32-bit integers
1351 const TypeInt *TypeInt::SYMINT; // symmetric range [-max_jint..max_jint]
1352 const TypeInt *TypeInt::TYPE_DOMAIN; // alias for TypeInt::INT
1353 


1583     st->print("int:%s..%s", intname(buf, _lo), intname(buf2, _hi));
1584 
1585   if (_widen != 0 && this != TypeInt::INT)
1586     st->print(":%.*s", _widen, "wwww");
1587 }
1588 #endif
1589 
1590 //------------------------------singleton--------------------------------------
1591 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1592 // constants.
1593 bool TypeInt::singleton(void) const {
1594   return _lo >= _hi;
1595 }
1596 
1597 bool TypeInt::empty(void) const {
1598   return _lo > _hi;
1599 }
1600 
1601 //=============================================================================
1602 // Convenience common pre-built types.


1603 const TypeLong *TypeLong::MINUS_1;// -1
1604 const TypeLong *TypeLong::ZERO; // 0
1605 const TypeLong *TypeLong::ONE;  // 1
1606 const TypeLong *TypeLong::POS;  // >=0
1607 const TypeLong *TypeLong::LONG; // 64-bit integers
1608 const TypeLong *TypeLong::INT;  // 32-bit subrange
1609 const TypeLong *TypeLong::UINT; // 32-bit unsigned subrange
1610 const TypeLong *TypeLong::TYPE_DOMAIN; // alias for TypeLong::LONG
1611 
1612 //------------------------------TypeLong---------------------------------------
1613 TypeLong::TypeLong( jlong lo, jlong hi, int w ) : Type(Long), _lo(lo), _hi(hi), _widen(w) {
1614 }
1615 
1616 //------------------------------make-------------------------------------------
1617 const TypeLong *TypeLong::make( jlong lo ) {
1618   return (TypeLong*)(new TypeLong(lo,lo,WidenMin))->hashcons();
1619 }
1620 
1621 static int normalize_long_widen( jlong lo, jlong hi, int w ) {
1622   // Certain normalizations keep us sane when comparing types.




 425   Arena* save = current->type_arena();
 426   Arena* shared_type_arena = new (mtCompiler)Arena(mtCompiler);
 427 
 428   current->set_type_arena(shared_type_arena);
 429   _shared_type_dict =
 430     new (shared_type_arena) Dict( (CmpKey)Type::cmp, (Hash)Type::uhash,
 431                                   shared_type_arena, 128 );
 432   current->set_type_dict(_shared_type_dict);
 433 
 434   // Make shared pre-built types.
 435   CONTROL = make(Control);      // Control only
 436   TOP     = make(Top);          // No values in set
 437   MEMORY  = make(Memory);       // Abstract store only
 438   ABIO    = make(Abio);         // State-of-machine only
 439   RETURN_ADDRESS=make(Return_Address);
 440   FLOAT   = make(FloatBot);     // All floats
 441   DOUBLE  = make(DoubleBot);    // All doubles
 442   BOTTOM  = make(Bottom);       // Everything
 443   HALF    = make(Half);         // Placeholder half of doublewide type
 444 
 445   TypeF::MAX = TypeF::make(max_jfloat);  // Float MAX
 446   TypeF::MIN = TypeF::make(min_jfloat);  // Float MIN
 447   TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero)
 448   TypeF::ONE  = TypeF::make(1.0); // Float 1
 449   TypeF::POS_INF = TypeF::make(jfloat_cast(POSITIVE_INFINITE_F));
 450   TypeF::NEG_INF = TypeF::make(-jfloat_cast(POSITIVE_INFINITE_F));
 451 
 452   TypeD::MAX = TypeD::make(max_jdouble);  // Double MAX
 453   TypeD::MIN = TypeD::make(min_jdouble);  // Double MIN
 454   TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero)
 455   TypeD::ONE  = TypeD::make(1.0); // Double 1
 456   TypeD::POS_INF = TypeD::make(jdouble_cast(POSITIVE_INFINITE_D));
 457   TypeD::NEG_INF = TypeD::make(-jdouble_cast(POSITIVE_INFINITE_D));
 458 
 459   TypeInt::MAX = TypeInt::make(max_jint);   // Int MAX
 460   TypeInt::MIN = TypeInt::make(min_jint);  // Int MIN
 461   TypeInt::MINUS_1 = TypeInt::make(-1);  // -1
 462   TypeInt::ZERO    = TypeInt::make( 0);  //  0
 463   TypeInt::ONE     = TypeInt::make( 1);  //  1
 464   TypeInt::BOOL    = TypeInt::make(0,1,   WidenMin);  // 0 or 1, FALSE or TRUE.
 465   TypeInt::CC      = TypeInt::make(-1, 1, WidenMin);  // -1, 0 or 1, condition codes
 466   TypeInt::CC_LT   = TypeInt::make(-1,-1, WidenMin);  // == TypeInt::MINUS_1
 467   TypeInt::CC_GT   = TypeInt::make( 1, 1, WidenMin);  // == TypeInt::ONE
 468   TypeInt::CC_EQ   = TypeInt::make( 0, 0, WidenMin);  // == TypeInt::ZERO
 469   TypeInt::CC_LE   = TypeInt::make(-1, 0, WidenMin);
 470   TypeInt::CC_GE   = TypeInt::make( 0, 1, WidenMin);  // == TypeInt::BOOL
 471   TypeInt::BYTE    = TypeInt::make(-128,127,     WidenMin); // Bytes
 472   TypeInt::UBYTE   = TypeInt::make(0, 255,       WidenMin); // Unsigned Bytes
 473   TypeInt::CHAR    = TypeInt::make(0,65535,      WidenMin); // Java chars
 474   TypeInt::SHORT   = TypeInt::make(-32768,32767, WidenMin); // Java shorts
 475   TypeInt::POS     = TypeInt::make(0,max_jint,   WidenMin); // Non-neg values
 476   TypeInt::POS1    = TypeInt::make(1,max_jint,   WidenMin); // Positive values
 477   TypeInt::INT     = TypeInt::make(min_jint,max_jint, WidenMax); // 32-bit integers
 478   TypeInt::SYMINT  = TypeInt::make(-max_jint,max_jint,WidenMin); // symmetric range
 479   TypeInt::TYPE_DOMAIN  = TypeInt::INT;
 480   // CmpL is overloaded both as the bytecode computation returning
 481   // a trinary (-1,0,+1) integer result AND as an efficient long
 482   // compare returning optimizer ideal-type flags.
 483   assert( TypeInt::CC_LT == TypeInt::MINUS_1, "types must match for CmpL to work" );
 484   assert( TypeInt::CC_GT == TypeInt::ONE,     "types must match for CmpL to work" );
 485   assert( TypeInt::CC_EQ == TypeInt::ZERO,    "types must match for CmpL to work" );
 486   assert( TypeInt::CC_GE == TypeInt::BOOL,    "types must match for CmpL to work" );
 487   assert( (juint)(TypeInt::CC->_hi - TypeInt::CC->_lo) <= SMALLINT, "CC is truly small");
 488 
 489   TypeLong::MAX = TypeLong::make(max_jlong);  // Long MAX
 490   TypeLong::MIN = TypeLong::make(min_jlong);  // Long MIN
 491   TypeLong::MINUS_1 = TypeLong::make(-1);        // -1
 492   TypeLong::ZERO    = TypeLong::make( 0);        //  0
 493   TypeLong::ONE     = TypeLong::make( 1);        //  1
 494   TypeLong::POS     = TypeLong::make(0,max_jlong, WidenMin); // Non-neg values
 495   TypeLong::LONG    = TypeLong::make(min_jlong,max_jlong,WidenMax); // 64-bit integers
 496   TypeLong::INT     = TypeLong::make((jlong)min_jint,(jlong)max_jint,WidenMin);
 497   TypeLong::UINT    = TypeLong::make(0,(jlong)max_juint,WidenMin);
 498   TypeLong::TYPE_DOMAIN  = TypeLong::LONG;
 499 
 500   const Type **fboth =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 501   fboth[0] = Type::CONTROL;
 502   fboth[1] = Type::CONTROL;
 503   TypeTuple::IFBOTH = TypeTuple::make( 2, fboth );
 504 
 505   const Type **ffalse =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));
 506   ffalse[0] = Type::CONTROL;
 507   ffalse[1] = Type::TOP;
 508   TypeTuple::IFFALSE = TypeTuple::make( 2, ffalse );
 509 
 510   const Type **fneither =(const Type**)shared_type_arena->Amalloc_4(2*sizeof(Type*));


 850 //------------------------------meet-------------------------------------------
 851 // Compute the MEET of two types.  NOT virtual.  It enforces that meet is
 852 // commutative and the lattice is symmetric.
 853 const Type *Type::meet_helper(const Type *t, bool include_speculative) const {
 854   if (isa_narrowoop() && t->isa_narrowoop()) {
 855     const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative);
 856     return result->make_narrowoop();
 857   }
 858   if (isa_narrowklass() && t->isa_narrowklass()) {
 859     const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative);
 860     return result->make_narrowklass();
 861   }
 862 
 863   const Type *this_t = maybe_remove_speculative(include_speculative);
 864   t = t->maybe_remove_speculative(include_speculative);
 865 
 866   const Type *mt = this_t->xmeet(t);
 867 #ifdef ASSERT
 868   if (isa_narrowoop() || t->isa_narrowoop()) return mt;
 869   if (isa_narrowklass() || t->isa_narrowklass()) return mt;
 870   if (isa_vect() || t->isa_vect()) return mt;
 871   Compile* C = Compile::current();
 872   if (!C->_type_verify_symmetry) {
 873     return mt;
 874   }
 875   this_t->check_symmetrical(t, mt);
 876   // In the case of an array, computing the meet above, caused the
 877   // computation of the meet of the elements which at verification
 878   // time caused the computation of the meet of the dual of the
 879   // elements. Computing the meet of the dual of the arrays here
 880   // causes the meet of the dual of the elements to be computed which
 881   // would cause the meet of the dual of the dual of the elements,
 882   // that is the meet of the elements already computed above to be
 883   // computed. Avoid redundant computations by requesting no
 884   // verification.
 885   C->_type_verify_symmetry = false;
 886   const Type *mt_dual = this_t->_dual->xmeet(t->_dual);
 887   this_t->_dual->check_symmetrical(t->_dual, mt_dual);
 888   assert(!C->_type_verify_symmetry, "shouldn't have changed");
 889   C->_type_verify_symmetry = true;
 890 #endif


1107 void Type::dump_stats() {
1108   tty->print("Types made: %d\n", type_dict()->Size());
1109 }
1110 #endif
1111 
1112 //------------------------------typerr-----------------------------------------
1113 void Type::typerr( const Type *t ) const {
1114 #ifndef PRODUCT
1115   tty->print("\nError mixing types: ");
1116   dump();
1117   tty->print(" and ");
1118   t->dump();
1119   tty->print("\n");
1120 #endif
1121   ShouldNotReachHere();
1122 }
1123 
1124 
1125 //=============================================================================
1126 // Convenience common pre-built types.
1127 const TypeF *TypeF::MAX;        // Floating point max
1128 const TypeF *TypeF::MIN;        // Floating point min
1129 const TypeF *TypeF::ZERO;       // Floating point zero
1130 const TypeF *TypeF::ONE;        // Floating point one
1131 const TypeF *TypeF::POS_INF;    // Floating point positive infinity
1132 const TypeF *TypeF::NEG_INF;    // Floating point negative infinity
1133 
1134 //------------------------------make-------------------------------------------
1135 // Create a float constant
1136 const TypeF *TypeF::make(float f) {
1137   return (TypeF*)(new TypeF(f))->hashcons();
1138 }
1139 
1140 //------------------------------meet-------------------------------------------
1141 // Compute the MEET of two types.  It returns a new Type object.
1142 const Type *TypeF::xmeet( const Type *t ) const {
1143   // Perform a fast test for common case; meeting the same types together.
1144   if( this == t ) return this;  // Meeting same type-rep?
1145 
1146   // Current "this->_base" is FloatCon
1147   switch (t->base()) {          // Switch on original type
1148   case AnyPtr:                  // Mixing with oops happens when javac


1219 void TypeF::dump2( Dict &d, uint depth, outputStream *st ) const {
1220   Type::dump2(d,depth, st);
1221   st->print("%f", _f);
1222 }
1223 #endif
1224 
1225 //------------------------------singleton--------------------------------------
1226 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1227 // constants (Ldi nodes).  Singletons are integer, float or double constants
1228 // or a single symbol.
1229 bool TypeF::singleton(void) const {
1230   return true;                  // Always a singleton
1231 }
1232 
1233 bool TypeF::empty(void) const {
1234   return false;                 // always exactly a singleton
1235 }
1236 
1237 //=============================================================================
1238 // Convenience common pre-built types.
1239 const TypeD *TypeD::MAX;        // Floating point max
1240 const TypeD *TypeD::MIN;        // Floating point min
1241 const TypeD *TypeD::ZERO;       // Floating point zero
1242 const TypeD *TypeD::ONE;        // Floating point one
1243 const TypeD *TypeD::POS_INF;    // Floating point positive infinity
1244 const TypeD *TypeD::NEG_INF;    // Floating point negative infinity
1245 
1246 //------------------------------make-------------------------------------------
1247 const TypeD *TypeD::make(double d) {
1248   return (TypeD*)(new TypeD(d))->hashcons();
1249 }
1250 
1251 //------------------------------meet-------------------------------------------
1252 // Compute the MEET of two types.  It returns a new Type object.
1253 const Type *TypeD::xmeet( const Type *t ) const {
1254   // Perform a fast test for common case; meeting the same types together.
1255   if( this == t ) return this;  // Meeting same type-rep?
1256 
1257   // Current "this->_base" is DoubleCon
1258   switch (t->base()) {          // Switch on original type
1259   case AnyPtr:                  // Mixing with oops happens when javac
1260   case RawPtr:                  // reuses local variables


1327 void TypeD::dump2( Dict &d, uint depth, outputStream *st ) const {
1328   Type::dump2(d,depth,st);
1329   st->print("%f", _d);
1330 }
1331 #endif
1332 
1333 //------------------------------singleton--------------------------------------
1334 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1335 // constants (Ldi nodes).  Singletons are integer, float or double constants
1336 // or a single symbol.
1337 bool TypeD::singleton(void) const {
1338   return true;                  // Always a singleton
1339 }
1340 
1341 bool TypeD::empty(void) const {
1342   return false;                 // always exactly a singleton
1343 }
1344 
1345 //=============================================================================
1346 // Convience common pre-built types.
1347 const TypeInt *TypeInt::MAX;    // INT_MAX
1348 const TypeInt *TypeInt::MIN;    // INT_MIN
1349 const TypeInt *TypeInt::MINUS_1;// -1
1350 const TypeInt *TypeInt::ZERO;   // 0
1351 const TypeInt *TypeInt::ONE;    // 1
1352 const TypeInt *TypeInt::BOOL;   // 0 or 1, FALSE or TRUE.
1353 const TypeInt *TypeInt::CC;     // -1,0 or 1, condition codes
1354 const TypeInt *TypeInt::CC_LT;  // [-1]  == MINUS_1
1355 const TypeInt *TypeInt::CC_GT;  // [1]   == ONE
1356 const TypeInt *TypeInt::CC_EQ;  // [0]   == ZERO
1357 const TypeInt *TypeInt::CC_LE;  // [-1,0]
1358 const TypeInt *TypeInt::CC_GE;  // [0,1] == BOOL (!)
1359 const TypeInt *TypeInt::BYTE;   // Bytes, -128 to 127
1360 const TypeInt *TypeInt::UBYTE;  // Unsigned Bytes, 0 to 255
1361 const TypeInt *TypeInt::CHAR;   // Java chars, 0-65535
1362 const TypeInt *TypeInt::SHORT;  // Java shorts, -32768-32767
1363 const TypeInt *TypeInt::POS;    // Positive 32-bit integers or zero
1364 const TypeInt *TypeInt::POS1;   // Positive 32-bit integers
1365 const TypeInt *TypeInt::INT;    // 32-bit integers
1366 const TypeInt *TypeInt::SYMINT; // symmetric range [-max_jint..max_jint]
1367 const TypeInt *TypeInt::TYPE_DOMAIN; // alias for TypeInt::INT
1368 


1598     st->print("int:%s..%s", intname(buf, _lo), intname(buf2, _hi));
1599 
1600   if (_widen != 0 && this != TypeInt::INT)
1601     st->print(":%.*s", _widen, "wwww");
1602 }
1603 #endif
1604 
1605 //------------------------------singleton--------------------------------------
1606 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1607 // constants.
1608 bool TypeInt::singleton(void) const {
1609   return _lo >= _hi;
1610 }
1611 
1612 bool TypeInt::empty(void) const {
1613   return _lo > _hi;
1614 }
1615 
1616 //=============================================================================
1617 // Convenience common pre-built types.
1618 const TypeLong *TypeLong::MAX;
1619 const TypeLong *TypeLong::MIN;
1620 const TypeLong *TypeLong::MINUS_1;// -1
1621 const TypeLong *TypeLong::ZERO; // 0
1622 const TypeLong *TypeLong::ONE;  // 1
1623 const TypeLong *TypeLong::POS;  // >=0
1624 const TypeLong *TypeLong::LONG; // 64-bit integers
1625 const TypeLong *TypeLong::INT;  // 32-bit subrange
1626 const TypeLong *TypeLong::UINT; // 32-bit unsigned subrange
1627 const TypeLong *TypeLong::TYPE_DOMAIN; // alias for TypeLong::LONG
1628 
1629 //------------------------------TypeLong---------------------------------------
1630 TypeLong::TypeLong( jlong lo, jlong hi, int w ) : Type(Long), _lo(lo), _hi(hi), _widen(w) {
1631 }
1632 
1633 //------------------------------make-------------------------------------------
1634 const TypeLong *TypeLong::make( jlong lo ) {
1635   return (TypeLong*)(new TypeLong(lo,lo,WidenMin))->hashcons();
1636 }
1637 
1638 static int normalize_long_widen( jlong lo, jlong hi, int w ) {
1639   // Certain normalizations keep us sane when comparing types.


< prev index next >