464 //------------------------------TypeF------------------------------------------ 465 // Class of Float-Constant Types. 466 class TypeF : public Type { 467 TypeF( float f ) : Type(FloatCon), _f(f) {}; 468 public: 469 virtual bool eq( const Type *t ) const; 470 virtual int hash() const; // Type specific hashing 471 virtual bool singleton(void) const; // TRUE if type is a singleton 472 virtual bool empty(void) const; // TRUE if type is vacuous 473 public: 474 const float _f; // Float constant 475 476 static const TypeF *make(float f); 477 478 virtual bool is_finite() const; // Has a finite value 479 virtual bool is_nan() const; // Is not a number (NaN) 480 481 virtual const Type *xmeet( const Type *t ) const; 482 virtual const Type *xdual() const; // Compute dual right now. 483 // Convenience common pre-built types. 484 static const TypeF *ZERO; // positive zero only 485 static const TypeF *ONE; 486 static const TypeF *POS_INF; 487 static const TypeF *NEG_INF; 488 #ifndef PRODUCT 489 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 490 #endif 491 }; 492 493 //------------------------------TypeD------------------------------------------ 494 // Class of Double-Constant Types. 495 class TypeD : public Type { 496 TypeD( double d ) : Type(DoubleCon), _d(d) {}; 497 public: 498 virtual bool eq( const Type *t ) const; 499 virtual int hash() const; // Type specific hashing 500 virtual bool singleton(void) const; // TRUE if type is a singleton 501 virtual bool empty(void) const; // TRUE if type is vacuous 502 public: 503 const double _d; // Double constant 504 505 static const TypeD *make(double d); 506 507 virtual bool is_finite() const; // Has a finite value 508 virtual bool is_nan() const; // Is not a number (NaN) 509 510 virtual const Type *xmeet( const Type *t ) const; 511 virtual const Type *xdual() const; // Compute dual right now. 512 // Convenience common pre-built types. 513 static const TypeD *ZERO; // positive zero only 514 static const TypeD *ONE; 515 static const TypeD *POS_INF; 516 static const TypeD *NEG_INF; 517 #ifndef PRODUCT 518 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 519 #endif 520 }; 521 522 //------------------------------TypeInt---------------------------------------- 523 // Class of integer ranges, the set of integers between a lower bound and an 524 // upper bound, inclusive. 525 class TypeInt : public Type { 526 TypeInt( jint lo, jint hi, int w ); 527 protected: 528 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; 529 530 public: 531 typedef jint NativeType; 532 virtual bool eq( const Type *t ) const; 536 const jint _lo, _hi; // Lower bound, upper bound 537 const short _widen; // Limit on times we widen this sucker 538 539 static const TypeInt *make(jint lo); 540 // must always specify w 541 static const TypeInt *make(jint lo, jint hi, int w); 542 543 // Check for single integer 544 int is_con() const { return _lo==_hi; } 545 bool is_con(int i) const { return is_con() && _lo == i; } 546 jint get_con() const { assert( is_con(), "" ); return _lo; } 547 548 virtual bool is_finite() const; // Has a finite value 549 550 virtual const Type *xmeet( const Type *t ) const; 551 virtual const Type *xdual() const; // Compute dual right now. 552 virtual const Type *widen( const Type *t, const Type* limit_type ) const; 553 virtual const Type *narrow( const Type *t ) const; 554 // Do not kill _widen bits. 555 // Convenience common pre-built types. 556 static const TypeInt *MINUS_1; 557 static const TypeInt *ZERO; 558 static const TypeInt *ONE; 559 static const TypeInt *BOOL; 560 static const TypeInt *CC; 561 static const TypeInt *CC_LT; // [-1] == MINUS_1 562 static const TypeInt *CC_GT; // [1] == ONE 563 static const TypeInt *CC_EQ; // [0] == ZERO 564 static const TypeInt *CC_LE; // [-1,0] 565 static const TypeInt *CC_GE; // [0,1] == BOOL (!) 566 static const TypeInt *BYTE; 567 static const TypeInt *UBYTE; 568 static const TypeInt *CHAR; 569 static const TypeInt *SHORT; 570 static const TypeInt *POS; 571 static const TypeInt *POS1; 572 static const TypeInt *INT; 573 static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint] 574 static const TypeInt *TYPE_DOMAIN; // alias for TypeInt::INT 575 601 static const TypeLong *make(jlong lo); 602 // must always specify w 603 static const TypeLong *make(jlong lo, jlong hi, int w); 604 605 // Check for single integer 606 int is_con() const { return _lo==_hi; } 607 bool is_con(int i) const { return is_con() && _lo == i; } 608 jlong get_con() const { assert( is_con(), "" ); return _lo; } 609 610 // Check for positive 32-bit value. 611 int is_positive_int() const { return _lo >= 0 && _hi <= (jlong)max_jint; } 612 613 virtual bool is_finite() const; // Has a finite value 614 615 616 virtual const Type *xmeet( const Type *t ) const; 617 virtual const Type *xdual() const; // Compute dual right now. 618 virtual const Type *widen( const Type *t, const Type* limit_type ) const; 619 virtual const Type *narrow( const Type *t ) const; 620 // Convenience common pre-built types. 621 static const TypeLong *MINUS_1; 622 static const TypeLong *ZERO; 623 static const TypeLong *ONE; 624 static const TypeLong *POS; 625 static const TypeLong *LONG; 626 static const TypeLong *INT; // 32-bit subrange [min_jint..max_jint] 627 static const TypeLong *UINT; // 32-bit unsigned [0..max_juint] 628 static const TypeLong *TYPE_DOMAIN; // alias for TypeLong::LONG 629 630 // static convenience methods. 631 static const TypeLong *as_self(const Type *t) { return t->is_long(); } 632 633 #ifndef PRODUCT 634 virtual void dump2( Dict &d, uint, outputStream *st ) const;// Specialized per-Type dumping 635 #endif 636 }; 637 638 //------------------------------TypeTuple-------------------------------------- 639 // Class of Tuple Types, essentially type collections for function signatures 640 // and class layouts. It happens to also be a fast cache for the HotSpot | 464 //------------------------------TypeF------------------------------------------ 465 // Class of Float-Constant Types. 466 class TypeF : public Type { 467 TypeF( float f ) : Type(FloatCon), _f(f) {}; 468 public: 469 virtual bool eq( const Type *t ) const; 470 virtual int hash() const; // Type specific hashing 471 virtual bool singleton(void) const; // TRUE if type is a singleton 472 virtual bool empty(void) const; // TRUE if type is vacuous 473 public: 474 const float _f; // Float constant 475 476 static const TypeF *make(float f); 477 478 virtual bool is_finite() const; // Has a finite value 479 virtual bool is_nan() const; // Is not a number (NaN) 480 481 virtual const Type *xmeet( const Type *t ) const; 482 virtual const Type *xdual() const; // Compute dual right now. 483 // Convenience common pre-built types. 484 static const TypeF *MAX; 485 static const TypeF *MIN; 486 static const TypeF *ZERO; // positive zero only 487 static const TypeF *ONE; 488 static const TypeF *POS_INF; 489 static const TypeF *NEG_INF; 490 #ifndef PRODUCT 491 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 492 #endif 493 }; 494 495 //------------------------------TypeD------------------------------------------ 496 // Class of Double-Constant Types. 497 class TypeD : public Type { 498 TypeD( double d ) : Type(DoubleCon), _d(d) {}; 499 public: 500 virtual bool eq( const Type *t ) const; 501 virtual int hash() const; // Type specific hashing 502 virtual bool singleton(void) const; // TRUE if type is a singleton 503 virtual bool empty(void) const; // TRUE if type is vacuous 504 public: 505 const double _d; // Double constant 506 507 static const TypeD *make(double d); 508 509 virtual bool is_finite() const; // Has a finite value 510 virtual bool is_nan() const; // Is not a number (NaN) 511 512 virtual const Type *xmeet( const Type *t ) const; 513 virtual const Type *xdual() const; // Compute dual right now. 514 // Convenience common pre-built types. 515 static const TypeD *MAX; 516 static const TypeD *MIN; 517 static const TypeD *ZERO; // positive zero only 518 static const TypeD *ONE; 519 static const TypeD *POS_INF; 520 static const TypeD *NEG_INF; 521 #ifndef PRODUCT 522 virtual void dump2( Dict &d, uint depth, outputStream *st ) const; 523 #endif 524 }; 525 526 //------------------------------TypeInt---------------------------------------- 527 // Class of integer ranges, the set of integers between a lower bound and an 528 // upper bound, inclusive. 529 class TypeInt : public Type { 530 TypeInt( jint lo, jint hi, int w ); 531 protected: 532 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const; 533 534 public: 535 typedef jint NativeType; 536 virtual bool eq( const Type *t ) const; 540 const jint _lo, _hi; // Lower bound, upper bound 541 const short _widen; // Limit on times we widen this sucker 542 543 static const TypeInt *make(jint lo); 544 // must always specify w 545 static const TypeInt *make(jint lo, jint hi, int w); 546 547 // Check for single integer 548 int is_con() const { return _lo==_hi; } 549 bool is_con(int i) const { return is_con() && _lo == i; } 550 jint get_con() const { assert( is_con(), "" ); return _lo; } 551 552 virtual bool is_finite() const; // Has a finite value 553 554 virtual const Type *xmeet( const Type *t ) const; 555 virtual const Type *xdual() const; // Compute dual right now. 556 virtual const Type *widen( const Type *t, const Type* limit_type ) const; 557 virtual const Type *narrow( const Type *t ) const; 558 // Do not kill _widen bits. 559 // Convenience common pre-built types. 560 static const TypeInt *MAX; 561 static const TypeInt *MIN; 562 static const TypeInt *MINUS_1; 563 static const TypeInt *ZERO; 564 static const TypeInt *ONE; 565 static const TypeInt *BOOL; 566 static const TypeInt *CC; 567 static const TypeInt *CC_LT; // [-1] == MINUS_1 568 static const TypeInt *CC_GT; // [1] == ONE 569 static const TypeInt *CC_EQ; // [0] == ZERO 570 static const TypeInt *CC_LE; // [-1,0] 571 static const TypeInt *CC_GE; // [0,1] == BOOL (!) 572 static const TypeInt *BYTE; 573 static const TypeInt *UBYTE; 574 static const TypeInt *CHAR; 575 static const TypeInt *SHORT; 576 static const TypeInt *POS; 577 static const TypeInt *POS1; 578 static const TypeInt *INT; 579 static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint] 580 static const TypeInt *TYPE_DOMAIN; // alias for TypeInt::INT 581 607 static const TypeLong *make(jlong lo); 608 // must always specify w 609 static const TypeLong *make(jlong lo, jlong hi, int w); 610 611 // Check for single integer 612 int is_con() const { return _lo==_hi; } 613 bool is_con(int i) const { return is_con() && _lo == i; } 614 jlong get_con() const { assert( is_con(), "" ); return _lo; } 615 616 // Check for positive 32-bit value. 617 int is_positive_int() const { return _lo >= 0 && _hi <= (jlong)max_jint; } 618 619 virtual bool is_finite() const; // Has a finite value 620 621 622 virtual const Type *xmeet( const Type *t ) const; 623 virtual const Type *xdual() const; // Compute dual right now. 624 virtual const Type *widen( const Type *t, const Type* limit_type ) const; 625 virtual const Type *narrow( const Type *t ) const; 626 // Convenience common pre-built types. 627 static const TypeLong *MAX; 628 static const TypeLong *MIN; 629 static const TypeLong *MINUS_1; 630 static const TypeLong *ZERO; 631 static const TypeLong *ONE; 632 static const TypeLong *POS; 633 static const TypeLong *LONG; 634 static const TypeLong *INT; // 32-bit subrange [min_jint..max_jint] 635 static const TypeLong *UINT; // 32-bit unsigned [0..max_juint] 636 static const TypeLong *TYPE_DOMAIN; // alias for TypeLong::LONG 637 638 // static convenience methods. 639 static const TypeLong *as_self(const Type *t) { return t->is_long(); } 640 641 #ifndef PRODUCT 642 virtual void dump2( Dict &d, uint, outputStream *st ) const;// Specialized per-Type dumping 643 #endif 644 }; 645 646 //------------------------------TypeTuple-------------------------------------- 647 // Class of Tuple Types, essentially type collections for function signatures 648 // and class layouts. It happens to also be a fast cache for the HotSpot |