414 return t->hash(); |
414 return t->hash(); |
415 } |
415 } |
416 |
416 |
417 #define SMALLINT ((juint)3) // a value too insignificant to consider widening |
417 #define SMALLINT ((juint)3) // a value too insignificant to consider widening |
418 |
418 |
|
419 static double pos_dinf() { |
|
420 union { int64_t i; double d; } v; |
|
421 v.i = CONST64(0x7ff0000000000000); |
|
422 return v.d; |
|
423 } |
|
424 |
|
425 static float pos_finf() { |
|
426 union { int32_t i; float f; } v; |
|
427 v.i = 0x7f800000; |
|
428 return v.f; |
|
429 } |
|
430 |
419 //--------------------------Initialize_shared---------------------------------- |
431 //--------------------------Initialize_shared---------------------------------- |
420 void Type::Initialize_shared(Compile* current) { |
432 void Type::Initialize_shared(Compile* current) { |
421 // This method does not need to be locked because the first system |
433 // This method does not need to be locked because the first system |
422 // compilations (stub compilations) occur serially. If they are |
434 // compilations (stub compilations) occur serially. If they are |
423 // changed to proceed in parallel, then this section will need |
435 // changed to proceed in parallel, then this section will need |
443 BOTTOM = make(Bottom); // Everything |
455 BOTTOM = make(Bottom); // Everything |
444 HALF = make(Half); // Placeholder half of doublewide type |
456 HALF = make(Half); // Placeholder half of doublewide type |
445 |
457 |
446 TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero) |
458 TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero) |
447 TypeF::ONE = TypeF::make(1.0); // Float 1 |
459 TypeF::ONE = TypeF::make(1.0); // Float 1 |
|
460 TypeF::POS_INF = TypeF::make(pos_finf()); |
|
461 TypeF::NEG_INF = TypeF::make(-pos_finf()); |
448 |
462 |
449 TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero) |
463 TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero) |
450 TypeD::ONE = TypeD::make(1.0); // Double 1 |
464 TypeD::ONE = TypeD::make(1.0); // Double 1 |
|
465 TypeD::POS_INF = TypeD::make(pos_dinf()); |
|
466 TypeD::NEG_INF = TypeD::make(-pos_dinf()); |
451 |
467 |
452 TypeInt::MINUS_1 = TypeInt::make(-1); // -1 |
468 TypeInt::MINUS_1 = TypeInt::make(-1); // -1 |
453 TypeInt::ZERO = TypeInt::make( 0); // 0 |
469 TypeInt::ZERO = TypeInt::make( 0); // 0 |
454 TypeInt::ONE = TypeInt::make( 1); // 1 |
470 TypeInt::ONE = TypeInt::make( 1); // 1 |
455 TypeInt::BOOL = TypeInt::make(0,1, WidenMin); // 0 or 1, FALSE or TRUE. |
471 TypeInt::BOOL = TypeInt::make(0,1, WidenMin); // 0 or 1, FALSE or TRUE. |
1085 |
1101 |
1086 //============================================================================= |
1102 //============================================================================= |
1087 // Convenience common pre-built types. |
1103 // Convenience common pre-built types. |
1088 const TypeF *TypeF::ZERO; // Floating point zero |
1104 const TypeF *TypeF::ZERO; // Floating point zero |
1089 const TypeF *TypeF::ONE; // Floating point one |
1105 const TypeF *TypeF::ONE; // Floating point one |
|
1106 const TypeF *TypeF::POS_INF; // Floating point positive infinity |
|
1107 const TypeF *TypeF::NEG_INF; // Floating point negative infinity |
1090 |
1108 |
1091 //------------------------------make------------------------------------------- |
1109 //------------------------------make------------------------------------------- |
1092 // Create a float constant |
1110 // Create a float constant |
1093 const TypeF *TypeF::make(float f) { |
1111 const TypeF *TypeF::make(float f) { |
1094 return (TypeF*)(new TypeF(f))->hashcons(); |
1112 return (TypeF*)(new TypeF(f))->hashcons(); |
1193 |
1211 |
1194 //============================================================================= |
1212 //============================================================================= |
1195 // Convenience common pre-built types. |
1213 // Convenience common pre-built types. |
1196 const TypeD *TypeD::ZERO; // Floating point zero |
1214 const TypeD *TypeD::ZERO; // Floating point zero |
1197 const TypeD *TypeD::ONE; // Floating point one |
1215 const TypeD *TypeD::ONE; // Floating point one |
|
1216 const TypeD *TypeD::POS_INF; // Floating point positive infinity |
|
1217 const TypeD *TypeD::NEG_INF; // Floating point negative infinity |
1198 |
1218 |
1199 //------------------------------make------------------------------------------- |
1219 //------------------------------make------------------------------------------- |
1200 const TypeD *TypeD::make(double d) { |
1220 const TypeD *TypeD::make(double d) { |
1201 return (TypeD*)(new TypeD(d))->hashcons(); |
1221 return (TypeD*)(new TypeD(d))->hashcons(); |
1202 } |
1222 } |