472
473 virtual const Type *xmeet( const Type *t ) const;
474 virtual const Type *xdual() const; // Compute dual right now.
475 // Convenience common pre-built types.
476 static const TypeD *ZERO; // positive zero only
477 static const TypeD *ONE;
478 #ifndef PRODUCT
479 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
480 #endif
481 };
482
483 //------------------------------TypeInt----------------------------------------
484 // Class of integer ranges, the set of integers between a lower bound and an
485 // upper bound, inclusive.
486 class TypeInt : public Type {
487 TypeInt( jint lo, jint hi, int w );
488 protected:
489 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
490
491 public:
492 virtual bool eq( const Type *t ) const;
493 virtual int hash() const; // Type specific hashing
494 virtual bool singleton(void) const; // TRUE if type is a singleton
495 virtual bool empty(void) const; // TRUE if type is vacuous
496 const jint _lo, _hi; // Lower bound, upper bound
497 const short _widen; // Limit on times we widen this sucker
498
499 static const TypeInt *make(jint lo);
500 // must always specify w
501 static const TypeInt *make(jint lo, jint hi, int w);
502
503 // Check for single integer
504 int is_con() const { return _lo==_hi; }
505 bool is_con(int i) const { return is_con() && _lo == i; }
506 jint get_con() const { assert( is_con(), "" ); return _lo; }
507
508 virtual bool is_finite() const; // Has a finite value
509
510 virtual const Type *xmeet( const Type *t ) const;
511 virtual const Type *xdual() const; // Compute dual right now.
514 // Do not kill _widen bits.
515 // Convenience common pre-built types.
516 static const TypeInt *MINUS_1;
517 static const TypeInt *ZERO;
518 static const TypeInt *ONE;
519 static const TypeInt *BOOL;
520 static const TypeInt *CC;
521 static const TypeInt *CC_LT; // [-1] == MINUS_1
522 static const TypeInt *CC_GT; // [1] == ONE
523 static const TypeInt *CC_EQ; // [0] == ZERO
524 static const TypeInt *CC_LE; // [-1,0]
525 static const TypeInt *CC_GE; // [0,1] == BOOL (!)
526 static const TypeInt *BYTE;
527 static const TypeInt *UBYTE;
528 static const TypeInt *CHAR;
529 static const TypeInt *SHORT;
530 static const TypeInt *POS;
531 static const TypeInt *POS1;
532 static const TypeInt *INT;
533 static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint]
534 #ifndef PRODUCT
535 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
536 #endif
537 };
538
539
540 //------------------------------TypeLong---------------------------------------
541 // Class of long integer ranges, the set of integers between a lower bound and
542 // an upper bound, inclusive.
543 class TypeLong : public Type {
544 TypeLong( jlong lo, jlong hi, int w );
545 protected:
546 // Do not kill _widen bits.
547 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
548 public:
549 virtual bool eq( const Type *t ) const;
550 virtual int hash() const; // Type specific hashing
551 virtual bool singleton(void) const; // TRUE if type is a singleton
552 virtual bool empty(void) const; // TRUE if type is vacuous
553 public:
554 const jlong _lo, _hi; // Lower bound, upper bound
555 const short _widen; // Limit on times we widen this sucker
556
557 static const TypeLong *make(jlong lo);
558 // must always specify w
559 static const TypeLong *make(jlong lo, jlong hi, int w);
560
561 // Check for single integer
562 int is_con() const { return _lo==_hi; }
563 bool is_con(int i) const { return is_con() && _lo == i; }
564 jlong get_con() const { assert( is_con(), "" ); return _lo; }
565
566 // Check for positive 32-bit value.
567 int is_positive_int() const { return _lo >= 0 && _hi <= (jlong)max_jint; }
568
569 virtual bool is_finite() const; // Has a finite value
570
571 virtual const Type *xmeet( const Type *t ) const;
572 virtual const Type *xdual() const; // Compute dual right now.
573 virtual const Type *widen( const Type *t, const Type* limit_type ) const;
574 virtual const Type *narrow( const Type *t ) const;
575 // Convenience common pre-built types.
576 static const TypeLong *MINUS_1;
577 static const TypeLong *ZERO;
578 static const TypeLong *ONE;
579 static const TypeLong *POS;
580 static const TypeLong *LONG;
581 static const TypeLong *INT; // 32-bit subrange [min_jint..max_jint]
582 static const TypeLong *UINT; // 32-bit unsigned [0..max_juint]
583 #ifndef PRODUCT
584 virtual void dump2( Dict &d, uint, outputStream *st ) const;// Specialized per-Type dumping
585 #endif
586 };
587
588 //------------------------------TypeTuple--------------------------------------
589 // Class of Tuple Types, essentially type collections for function signatures
590 // and class layouts. It happens to also be a fast cache for the HotSpot
591 // signature types.
592 class TypeTuple : public Type {
593 TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { }
594 public:
595 virtual bool eq( const Type *t ) const;
596 virtual int hash() const; // Type specific hashing
597 virtual bool singleton(void) const; // TRUE if type is a singleton
598 virtual bool empty(void) const; // TRUE if type is vacuous
599
600 public:
601 const uint _cnt; // Count of fields
602 const Type ** const _fields; // Array of field types
|
472
473 virtual const Type *xmeet( const Type *t ) const;
474 virtual const Type *xdual() const; // Compute dual right now.
475 // Convenience common pre-built types.
476 static const TypeD *ZERO; // positive zero only
477 static const TypeD *ONE;
478 #ifndef PRODUCT
479 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
480 #endif
481 };
482
483 //------------------------------TypeInt----------------------------------------
484 // Class of integer ranges, the set of integers between a lower bound and an
485 // upper bound, inclusive.
486 class TypeInt : public Type {
487 TypeInt( jint lo, jint hi, int w );
488 protected:
489 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
490
491 public:
492 typedef jint NativeType;
493 virtual bool eq( const Type *t ) const;
494 virtual int hash() const; // Type specific hashing
495 virtual bool singleton(void) const; // TRUE if type is a singleton
496 virtual bool empty(void) const; // TRUE if type is vacuous
497 const jint _lo, _hi; // Lower bound, upper bound
498 const short _widen; // Limit on times we widen this sucker
499
500 static const TypeInt *make(jint lo);
501 // must always specify w
502 static const TypeInt *make(jint lo, jint hi, int w);
503
504 // Check for single integer
505 int is_con() const { return _lo==_hi; }
506 bool is_con(int i) const { return is_con() && _lo == i; }
507 jint get_con() const { assert( is_con(), "" ); return _lo; }
508
509 virtual bool is_finite() const; // Has a finite value
510
511 virtual const Type *xmeet( const Type *t ) const;
512 virtual const Type *xdual() const; // Compute dual right now.
515 // Do not kill _widen bits.
516 // Convenience common pre-built types.
517 static const TypeInt *MINUS_1;
518 static const TypeInt *ZERO;
519 static const TypeInt *ONE;
520 static const TypeInt *BOOL;
521 static const TypeInt *CC;
522 static const TypeInt *CC_LT; // [-1] == MINUS_1
523 static const TypeInt *CC_GT; // [1] == ONE
524 static const TypeInt *CC_EQ; // [0] == ZERO
525 static const TypeInt *CC_LE; // [-1,0]
526 static const TypeInt *CC_GE; // [0,1] == BOOL (!)
527 static const TypeInt *BYTE;
528 static const TypeInt *UBYTE;
529 static const TypeInt *CHAR;
530 static const TypeInt *SHORT;
531 static const TypeInt *POS;
532 static const TypeInt *POS1;
533 static const TypeInt *INT;
534 static const TypeInt *SYMINT; // symmetric range [-max_jint..max_jint]
535
536 static const Type *bottom() { return TypeInt::INT; }
537 static const TypeInt *as_self(const Type *t) { return t->is_int(); }
538 #ifndef PRODUCT
539 virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
540 #endif
541 };
542
543
544 //------------------------------TypeLong---------------------------------------
545 // Class of long integer ranges, the set of integers between a lower bound and
546 // an upper bound, inclusive.
547 class TypeLong : public Type {
548 TypeLong( jlong lo, jlong hi, int w );
549 protected:
550 // Do not kill _widen bits.
551 virtual const Type *filter_helper(const Type *kills, bool include_speculative) const;
552 public:
553 typedef jlong NativeType;
554 virtual bool eq( const Type *t ) const;
555 virtual int hash() const; // Type specific hashing
556 virtual bool singleton(void) const; // TRUE if type is a singleton
557 virtual bool empty(void) const; // TRUE if type is vacuous
558 public:
559 const jlong _lo, _hi; // Lower bound, upper bound
560 const short _widen; // Limit on times we widen this sucker
561
562 static const TypeLong *make(jlong lo);
563 // must always specify w
564 static const TypeLong *make(jlong lo, jlong hi, int w);
565
566 // Check for single integer
567 int is_con() const { return _lo==_hi; }
568 bool is_con(int i) const { return is_con() && _lo == i; }
569 jlong get_con() const { assert( is_con(), "" ); return _lo; }
570
571 // Check for positive 32-bit value.
572 int is_positive_int() const { return _lo >= 0 && _hi <= (jlong)max_jint; }
573
574 virtual bool is_finite() const; // Has a finite value
575
576
577 virtual const Type *xmeet( const Type *t ) const;
578 virtual const Type *xdual() const; // Compute dual right now.
579 virtual const Type *widen( const Type *t, const Type* limit_type ) const;
580 virtual const Type *narrow( const Type *t ) const;
581 // Convenience common pre-built types.
582 static const TypeLong *MINUS_1;
583 static const TypeLong *ZERO;
584 static const TypeLong *ONE;
585 static const TypeLong *POS;
586 static const TypeLong *LONG;
587 static const TypeLong *INT; // 32-bit subrange [min_jint..max_jint]
588 static const TypeLong *UINT; // 32-bit unsigned [0..max_juint]
589
590 // static convenience methods.
591 static const Type *bottom() { return TypeLong::LONG; }
592 static const TypeLong *as_self(const Type *t) { return t->is_long(); }
593
594 #ifndef PRODUCT
595 virtual void dump2( Dict &d, uint, outputStream *st ) const;// Specialized per-Type dumping
596 #endif
597 };
598
599 //------------------------------TypeTuple--------------------------------------
600 // Class of Tuple Types, essentially type collections for function signatures
601 // and class layouts. It happens to also be a fast cache for the HotSpot
602 // signature types.
603 class TypeTuple : public Type {
604 TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { }
605 public:
606 virtual bool eq( const Type *t ) const;
607 virtual int hash() const; // Type specific hashing
608 virtual bool singleton(void) const; // TRUE if type is a singleton
609 virtual bool empty(void) const; // TRUE if type is vacuous
610
611 public:
612 const uint _cnt; // Count of fields
613 const Type ** const _fields; // Array of field types
|