comparison src/share/vm/opto/type.cpp @ 221:1e026f8da827

6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode Summary: Remove DecodeNNode::decode() and EncodePNode::encode() methods. Reviewed-by: rasbold, never
author kvn
date Tue, 24 Jun 2008 10:43:29 -0700
parents d4dbd9f91680
children 1dd146f17531
comparison
equal deleted inserted replaced
220:30369db7f5d2 221:1e026f8da827
166 // Create a simple Type, with default empty symbol sets. Then hashcons it 166 // Create a simple Type, with default empty symbol sets. Then hashcons it
167 // and look for an existing copy in the type dictionary. 167 // and look for an existing copy in the type dictionary.
168 const Type *Type::make( enum TYPES t ) { 168 const Type *Type::make( enum TYPES t ) {
169 return (new Type(t))->hashcons(); 169 return (new Type(t))->hashcons();
170 } 170 }
171 171 /*
172 //------------------------------make_ptr---------------------------------------
173 // Returns this ptr type or the equivalent ptr type for this compressed pointer.
174 const TypePtr* Type::make_ptr() const {
175 return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() : is_ptr();
176 }
177
178 //------------------------------make_narrowoop---------------------------------
179 // Returns this compressed pointer or the equivalent compressed version
180 // of this pointer type.
181 const TypeNarrowOop* Type::make_narrowoop() const {
182 return (_base == NarrowOop) ? is_narrowoop() : TypeNarrowOop::make(is_ptr());
183 }
184 */
172 //------------------------------cmp-------------------------------------------- 185 //------------------------------cmp--------------------------------------------
173 int Type::cmp( const Type *const t1, const Type *const t2 ) { 186 int Type::cmp( const Type *const t1, const Type *const t2 ) {
174 if( t1->_base != t2->_base ) 187 if( t1->_base != t2->_base )
175 return 1; // Missed badly 188 return 1; // Missed badly
176 assert(t1 != t2 || t1->eq(t2), "eq must be reflexive"); 189 assert(t1 != t2 || t1->eq(t2), "eq must be reflexive");
489 //------------------------------meet------------------------------------------- 502 //------------------------------meet-------------------------------------------
490 // Compute the MEET of two types. NOT virtual. It enforces that meet is 503 // Compute the MEET of two types. NOT virtual. It enforces that meet is
491 // commutative and the lattice is symmetric. 504 // commutative and the lattice is symmetric.
492 const Type *Type::meet( const Type *t ) const { 505 const Type *Type::meet( const Type *t ) const {
493 if (isa_narrowoop() && t->isa_narrowoop()) { 506 if (isa_narrowoop() && t->isa_narrowoop()) {
494 const Type* result = is_narrowoop()->make_oopptr()->meet(t->is_narrowoop()->make_oopptr()); 507 const Type* result = make_ptr()->meet(t->make_ptr());
495 if (result->isa_oopptr()) { 508 return result->make_narrowoop();
496 return result->isa_oopptr()->make_narrowoop();
497 } else if (result == TypePtr::NULL_PTR) {
498 return TypeNarrowOop::NULL_PTR;
499 } else {
500 return result;
501 }
502 } 509 }
503 510
504 const Type *mt = xmeet(t); 511 const Type *mt = xmeet(t);
505 if (isa_narrowoop() || t->isa_narrowoop()) return mt; 512 if (isa_narrowoop() || t->isa_narrowoop()) return mt;
506 #ifdef ASSERT 513 #ifdef ASSERT
1762 } 1769 }
1763 1770
1764 //------------------------------make------------------------------------------- 1771 //------------------------------make-------------------------------------------
1765 const TypeAry *TypeAry::make( const Type *elem, const TypeInt *size) { 1772 const TypeAry *TypeAry::make( const Type *elem, const TypeInt *size) {
1766 if (UseCompressedOops && elem->isa_oopptr()) { 1773 if (UseCompressedOops && elem->isa_oopptr()) {
1767 elem = elem->is_oopptr()->make_narrowoop(); 1774 elem = elem->make_narrowoop();
1768 } 1775 }
1769 size = normalize_array_size(size); 1776 size = normalize_array_size(size);
1770 return (TypeAry*)(new TypeAry(elem,size))->hashcons(); 1777 return (TypeAry*)(new TypeAry(elem,size))->hashcons();
1771 } 1778 }
1772 1779
1847 // if the element type is either a primitive or a final instance class. 1854 // if the element type is either a primitive or a final instance class.
1848 // In such cases, an array built on this ary must have no subclasses. 1855 // In such cases, an array built on this ary must have no subclasses.
1849 if (_elem == BOTTOM) return false; // general array not exact 1856 if (_elem == BOTTOM) return false; // general array not exact
1850 if (_elem == TOP ) return false; // inverted general array not exact 1857 if (_elem == TOP ) return false; // inverted general array not exact
1851 const TypeOopPtr* toop = NULL; 1858 const TypeOopPtr* toop = NULL;
1852 if (UseCompressedOops) { 1859 if (UseCompressedOops && _elem->isa_narrowoop()) {
1853 const TypeNarrowOop* noop = _elem->isa_narrowoop(); 1860 toop = _elem->make_ptr()->isa_oopptr();
1854 if (noop) toop = noop->make_oopptr()->isa_oopptr();
1855 } else { 1861 } else {
1856 toop = _elem->isa_oopptr(); 1862 toop = _elem->isa_oopptr();
1857 } 1863 }
1858 if (!toop) return true; // a primitive type, like int 1864 if (!toop) return true; // a primitive type, like int
1859 ciKlass* tklass = toop->klass(); 1865 ciKlass* tklass = toop->klass();
1860 if (tklass == NULL) return false; // unloaded class 1866 if (tklass == NULL) return false; // unloaded class
1861 if (!tklass->is_loaded()) return false; // unloaded class 1867 if (!tklass->is_loaded()) return false; // unloaded class
1862 const TypeInstPtr* tinst; 1868 const TypeInstPtr* tinst;
1863 if (_elem->isa_narrowoop()) 1869 if (_elem->isa_narrowoop())
1864 tinst = _elem->is_narrowoop()->make_oopptr()->isa_instptr(); 1870 tinst = _elem->make_ptr()->isa_instptr();
1865 else 1871 else
1866 tinst = _elem->isa_instptr(); 1872 tinst = _elem->isa_instptr();
1867 if (tinst) return tklass->as_instance_klass()->is_final(); 1873 if (tinst)
1874 return tklass->as_instance_klass()->is_final();
1868 const TypeAryPtr* tap; 1875 const TypeAryPtr* tap;
1869 if (_elem->isa_narrowoop()) 1876 if (_elem->isa_narrowoop())
1870 tap = _elem->is_narrowoop()->make_oopptr()->isa_aryptr(); 1877 tap = _elem->make_ptr()->isa_aryptr();
1871 else 1878 else
1872 tap = _elem->isa_aryptr(); 1879 tap = _elem->isa_aryptr();
1873 if (tap) return tap->ary()->ary_must_be_exact(); 1880 if (tap)
1881 return tap->ary()->ary_must_be_exact();
1874 return false; 1882 return false;
1875 } 1883 }
1876 1884
1877 //============================================================================= 1885 //=============================================================================
1878 // Convenience common pre-built types. 1886 // Convenience common pre-built types.
2577 //------------------------------add_offset------------------------------------- 2585 //------------------------------add_offset-------------------------------------
2578 const TypePtr *TypeOopPtr::add_offset( int offset ) const { 2586 const TypePtr *TypeOopPtr::add_offset( int offset ) const {
2579 return make( _ptr, xadd_offset(offset) ); 2587 return make( _ptr, xadd_offset(offset) );
2580 } 2588 }
2581 2589
2582 const TypeNarrowOop* TypeOopPtr::make_narrowoop() const {
2583 return TypeNarrowOop::make(this);
2584 }
2585
2586 int TypeOopPtr::meet_instance(int iid) const { 2590 int TypeOopPtr::meet_instance(int iid) const {
2587 if (iid == 0) { 2591 if (iid == 0) {
2588 return (_instance_id < 0) ? _instance_id : UNKNOWN_INSTANCE; 2592 return (_instance_id < 0) ? _instance_id : UNKNOWN_INSTANCE;
2589 } else if (_instance_id == UNKNOWN_INSTANCE) { 2593 } else if (_instance_id == UNKNOWN_INSTANCE) {
2590 return (iid < 0) ? iid : UNKNOWN_INSTANCE; 2594 return (iid < 0) ? iid : UNKNOWN_INSTANCE;
3492 return Type::BOTTOM; 3496 return Type::BOTTOM;
3493 case Top: 3497 case Top:
3494 return this; 3498 return this;
3495 3499
3496 case NarrowOop: { 3500 case NarrowOop: {
3497 const Type* result = _ooptype->xmeet(t->is_narrowoop()->make_oopptr()); 3501 const Type* result = _ooptype->xmeet(t->make_ptr());
3498 if (result->isa_ptr()) { 3502 if (result->isa_ptr()) {
3499 return TypeNarrowOop::make(result->is_ptr()); 3503 return TypeNarrowOop::make(result->is_ptr());
3500 } 3504 }
3501 return result; 3505 return result;
3502 } 3506 }
3602 ciKlass* k_ary = NULL; 3606 ciKlass* k_ary = NULL;
3603 const TypeInstPtr *tinst; 3607 const TypeInstPtr *tinst;
3604 const TypeAryPtr *tary; 3608 const TypeAryPtr *tary;
3605 const Type* el = elem(); 3609 const Type* el = elem();
3606 if (el->isa_narrowoop()) { 3610 if (el->isa_narrowoop()) {
3607 el = el->is_narrowoop()->make_oopptr(); 3611 el = el->make_ptr();
3608 } 3612 }
3609 3613
3610 // Get element klass 3614 // Get element klass
3611 if ((tinst = el->isa_instptr()) != NULL) { 3615 if ((tinst = el->isa_instptr()) != NULL) {
3612 // Compute array klass from element klass 3616 // Compute array klass from element klass