923
924 //------------------------------make-------------------------------------------
925 const TypeD *TypeD::make(double d) {
926 return (TypeD*)(new TypeD(d))->hashcons();
927 }
928
929 //------------------------------meet-------------------------------------------
930 // Compute the MEET of two types. It returns a new Type object.
931 const Type *TypeD::xmeet( const Type *t ) const {
932 // Perform a fast test for common case; meeting the same types together.
933 if( this == t ) return this; // Meeting same type-rep?
934
935 // Current "this->_base" is DoubleCon
936 switch (t->base()) { // Switch on original type
937 case AnyPtr: // Mixing with oops happens when javac
938 case RawPtr: // reuses local variables
939 case OopPtr:
940 case InstPtr:
941 case KlassPtr:
942 case AryPtr:
943 case Int:
944 case Long:
945 case FloatTop:
946 case FloatCon:
947 case FloatBot:
948 case Bottom: // Ye Olde Default
949 return Type::BOTTOM;
950
951 case DoubleBot:
952 return t;
953
954 default: // All else is a mistake
955 typerr(t);
956
957 case DoubleCon: // Double-constant vs Double-constant?
958 if( jlong_cast(_d) != jlong_cast(t->getd()) ) // unequal constants? (see comment in TypeF::xmeet)
959 return DOUBLE; // Return generic double
960 case Top:
961 case DoubleTop:
962 break;
1069 }
1070 return (TypeInt*)(new TypeInt(lo,hi,w))->hashcons();
1071 }
1072
1073 //------------------------------meet-------------------------------------------
1074 // Compute the MEET of two types. It returns a new Type representation object
1075 // with reference count equal to the number of Types pointing at it.
1076 // Caller should wrap a Types around it.
1077 const Type *TypeInt::xmeet( const Type *t ) const {
1078 // Perform a fast test for common case; meeting the same types together.
1079 if( this == t ) return this; // Meeting same type?
1080
1081 // Currently "this->_base" is a TypeInt
1082 switch (t->base()) { // Switch on original type
1083 case AnyPtr: // Mixing with oops happens when javac
1084 case RawPtr: // reuses local variables
1085 case OopPtr:
1086 case InstPtr:
1087 case KlassPtr:
1088 case AryPtr:
1089 case Long:
1090 case FloatTop:
1091 case FloatCon:
1092 case FloatBot:
1093 case DoubleTop:
1094 case DoubleCon:
1095 case DoubleBot:
1096 case NarrowOop:
1097 case Bottom: // Ye Olde Default
1098 return Type::BOTTOM;
1099 default: // All else is a mistake
1100 typerr(t);
1101 case Top: // No change
1102 return this;
1103 case Int: // Int vs Int?
1104 break;
1105 }
1106
1107 // Expand covered set
1108 const TypeInt *r = t->is_int();
1109 // (Avoid TypeInt::make, to avoid the argument normalizations it enforces.)
1110 return (new TypeInt( MIN2(_lo,r->_lo), MAX2(_hi,r->_hi), MAX2(_widen,r->_widen) ))->hashcons();
1111 }
1112
1113 //------------------------------xdual------------------------------------------
1114 // Dual: reverse hi & lo; flip widen
1115 const Type *TypeInt::xdual() const {
1116 return new TypeInt(_hi,_lo,WidenMax-_widen);
1311 return (TypeLong*)(new TypeLong(lo,hi,w))->hashcons();
1312 }
1313
1314
1315 //------------------------------meet-------------------------------------------
1316 // Compute the MEET of two types. It returns a new Type representation object
1317 // with reference count equal to the number of Types pointing at it.
1318 // Caller should wrap a Types around it.
1319 const Type *TypeLong::xmeet( const Type *t ) const {
1320 // Perform a fast test for common case; meeting the same types together.
1321 if( this == t ) return this; // Meeting same type?
1322
1323 // Currently "this->_base" is a TypeLong
1324 switch (t->base()) { // Switch on original type
1325 case AnyPtr: // Mixing with oops happens when javac
1326 case RawPtr: // reuses local variables
1327 case OopPtr:
1328 case InstPtr:
1329 case KlassPtr:
1330 case AryPtr:
1331 case Int:
1332 case FloatTop:
1333 case FloatCon:
1334 case FloatBot:
1335 case DoubleTop:
1336 case DoubleCon:
1337 case DoubleBot:
1338 case Bottom: // Ye Olde Default
1339 return Type::BOTTOM;
1340 default: // All else is a mistake
1341 typerr(t);
1342 case Top: // No change
1343 return this;
1344 case Long: // Long vs Long?
1345 break;
1346 }
1347
1348 // Expand covered set
1349 const TypeLong *r = t->is_long(); // Turn into a TypeLong
1350 // (Avoid TypeLong::make, to avoid the argument normalizations it enforces.)
|
923
924 //------------------------------make-------------------------------------------
925 const TypeD *TypeD::make(double d) {
926 return (TypeD*)(new TypeD(d))->hashcons();
927 }
928
929 //------------------------------meet-------------------------------------------
930 // Compute the MEET of two types. It returns a new Type object.
931 const Type *TypeD::xmeet( const Type *t ) const {
932 // Perform a fast test for common case; meeting the same types together.
933 if( this == t ) return this; // Meeting same type-rep?
934
935 // Current "this->_base" is DoubleCon
936 switch (t->base()) { // Switch on original type
937 case AnyPtr: // Mixing with oops happens when javac
938 case RawPtr: // reuses local variables
939 case OopPtr:
940 case InstPtr:
941 case KlassPtr:
942 case AryPtr:
943 case NarrowOop:
944 case Int:
945 case Long:
946 case FloatTop:
947 case FloatCon:
948 case FloatBot:
949 case Bottom: // Ye Olde Default
950 return Type::BOTTOM;
951
952 case DoubleBot:
953 return t;
954
955 default: // All else is a mistake
956 typerr(t);
957
958 case DoubleCon: // Double-constant vs Double-constant?
959 if( jlong_cast(_d) != jlong_cast(t->getd()) ) // unequal constants? (see comment in TypeF::xmeet)
960 return DOUBLE; // Return generic double
961 case Top:
962 case DoubleTop:
963 break;
1070 }
1071 return (TypeInt*)(new TypeInt(lo,hi,w))->hashcons();
1072 }
1073
1074 //------------------------------meet-------------------------------------------
1075 // Compute the MEET of two types. It returns a new Type representation object
1076 // with reference count equal to the number of Types pointing at it.
1077 // Caller should wrap a Types around it.
1078 const Type *TypeInt::xmeet( const Type *t ) const {
1079 // Perform a fast test for common case; meeting the same types together.
1080 if( this == t ) return this; // Meeting same type?
1081
1082 // Currently "this->_base" is a TypeInt
1083 switch (t->base()) { // Switch on original type
1084 case AnyPtr: // Mixing with oops happens when javac
1085 case RawPtr: // reuses local variables
1086 case OopPtr:
1087 case InstPtr:
1088 case KlassPtr:
1089 case AryPtr:
1090 case NarrowOop:
1091 case Long:
1092 case FloatTop:
1093 case FloatCon:
1094 case FloatBot:
1095 case DoubleTop:
1096 case DoubleCon:
1097 case DoubleBot:
1098 case Bottom: // Ye Olde Default
1099 return Type::BOTTOM;
1100 default: // All else is a mistake
1101 typerr(t);
1102 case Top: // No change
1103 return this;
1104 case Int: // Int vs Int?
1105 break;
1106 }
1107
1108 // Expand covered set
1109 const TypeInt *r = t->is_int();
1110 // (Avoid TypeInt::make, to avoid the argument normalizations it enforces.)
1111 return (new TypeInt( MIN2(_lo,r->_lo), MAX2(_hi,r->_hi), MAX2(_widen,r->_widen) ))->hashcons();
1112 }
1113
1114 //------------------------------xdual------------------------------------------
1115 // Dual: reverse hi & lo; flip widen
1116 const Type *TypeInt::xdual() const {
1117 return new TypeInt(_hi,_lo,WidenMax-_widen);
1312 return (TypeLong*)(new TypeLong(lo,hi,w))->hashcons();
1313 }
1314
1315
1316 //------------------------------meet-------------------------------------------
1317 // Compute the MEET of two types. It returns a new Type representation object
1318 // with reference count equal to the number of Types pointing at it.
1319 // Caller should wrap a Types around it.
1320 const Type *TypeLong::xmeet( const Type *t ) const {
1321 // Perform a fast test for common case; meeting the same types together.
1322 if( this == t ) return this; // Meeting same type?
1323
1324 // Currently "this->_base" is a TypeLong
1325 switch (t->base()) { // Switch on original type
1326 case AnyPtr: // Mixing with oops happens when javac
1327 case RawPtr: // reuses local variables
1328 case OopPtr:
1329 case InstPtr:
1330 case KlassPtr:
1331 case AryPtr:
1332 case NarrowOop:
1333 case Int:
1334 case FloatTop:
1335 case FloatCon:
1336 case FloatBot:
1337 case DoubleTop:
1338 case DoubleCon:
1339 case DoubleBot:
1340 case Bottom: // Ye Olde Default
1341 return Type::BOTTOM;
1342 default: // All else is a mistake
1343 typerr(t);
1344 case Top: // No change
1345 return this;
1346 case Long: // Long vs Long?
1347 break;
1348 }
1349
1350 // Expand covered set
1351 const TypeLong *r = t->is_long(); // Turn into a TypeLong
1352 // (Avoid TypeLong::make, to avoid the argument normalizations it enforces.)
|