Mercurial > hg > graal-compiler
comparison src/share/vm/opto/type.cpp @ 14383:5ec7dace41a6
8027422: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
Summary: type methods shouldn't always operate on speculative part
Reviewed-by: kvn, twisti
author | roland |
---|---|
date | Fri, 24 Jan 2014 09:31:53 +0100 |
parents | e045e1876610 |
children | 45467c53f178 085b304a1cc5 |
comparison
equal
deleted
inserted
replaced
14272:757ec609d8d5 | 14383:5ec7dace41a6 |
---|---|
234 return 1; // Missed badly | 234 return 1; // Missed badly |
235 assert(t1 != t2 || t1->eq(t2), "eq must be reflexive"); | 235 assert(t1 != t2 || t1->eq(t2), "eq must be reflexive"); |
236 return !t1->eq(t2); // Return ZERO if equal | 236 return !t1->eq(t2); // Return ZERO if equal |
237 } | 237 } |
238 | 238 |
239 const Type* Type::maybe_remove_speculative(bool include_speculative) const { | |
240 if (!include_speculative) { | |
241 return remove_speculative(); | |
242 } | |
243 return this; | |
244 } | |
245 | |
239 //------------------------------hash------------------------------------------- | 246 //------------------------------hash------------------------------------------- |
240 int Type::uhash( const Type *const t ) { | 247 int Type::uhash( const Type *const t ) { |
241 return t->hash(); | 248 return t->hash(); |
242 } | 249 } |
243 | 250 |
626 #endif | 633 #endif |
627 | 634 |
628 //------------------------------meet------------------------------------------- | 635 //------------------------------meet------------------------------------------- |
629 // Compute the MEET of two types. NOT virtual. It enforces that meet is | 636 // Compute the MEET of two types. NOT virtual. It enforces that meet is |
630 // commutative and the lattice is symmetric. | 637 // commutative and the lattice is symmetric. |
631 const Type *Type::meet( const Type *t ) const { | 638 const Type *Type::meet_helper(const Type *t, bool include_speculative) const { |
632 if (isa_narrowoop() && t->isa_narrowoop()) { | 639 if (isa_narrowoop() && t->isa_narrowoop()) { |
633 const Type* result = make_ptr()->meet(t->make_ptr()); | 640 const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative); |
634 return result->make_narrowoop(); | 641 return result->make_narrowoop(); |
635 } | 642 } |
636 if (isa_narrowklass() && t->isa_narrowklass()) { | 643 if (isa_narrowklass() && t->isa_narrowklass()) { |
637 const Type* result = make_ptr()->meet(t->make_ptr()); | 644 const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative); |
638 return result->make_narrowklass(); | 645 return result->make_narrowklass(); |
639 } | 646 } |
640 | 647 |
641 const Type *mt = xmeet(t); | 648 const Type *this_t = maybe_remove_speculative(include_speculative); |
649 t = t->maybe_remove_speculative(include_speculative); | |
650 | |
651 const Type *mt = this_t->xmeet(t); | |
642 if (isa_narrowoop() || t->isa_narrowoop()) return mt; | 652 if (isa_narrowoop() || t->isa_narrowoop()) return mt; |
643 if (isa_narrowklass() || t->isa_narrowklass()) return mt; | 653 if (isa_narrowklass() || t->isa_narrowklass()) return mt; |
644 #ifdef ASSERT | 654 #ifdef ASSERT |
645 assert( mt == t->xmeet(this), "meet not commutative" ); | 655 assert(mt == t->xmeet(this_t), "meet not commutative"); |
646 const Type* dual_join = mt->_dual; | 656 const Type* dual_join = mt->_dual; |
647 const Type *t2t = dual_join->xmeet(t->_dual); | 657 const Type *t2t = dual_join->xmeet(t->_dual); |
648 const Type *t2this = dual_join->xmeet( _dual); | 658 const Type *t2this = dual_join->xmeet(this_t->_dual); |
649 | 659 |
650 // Interface meet Oop is Not Symmetric: | 660 // Interface meet Oop is Not Symmetric: |
651 // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull | 661 // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull |
652 // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull | 662 // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull |
653 | 663 |
654 if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != _dual) ) { | 664 if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != this_t->_dual) ) { |
655 tty->print_cr("=== Meet Not Symmetric ==="); | 665 tty->print_cr("=== Meet Not Symmetric ==="); |
656 tty->print("t = "); t->dump(); tty->cr(); | 666 tty->print("t = "); t->dump(); tty->cr(); |
657 tty->print("this= "); dump(); tty->cr(); | 667 tty->print("this= "); this_t->dump(); tty->cr(); |
658 tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); | 668 tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); |
659 | 669 |
660 tty->print("t_dual= "); t->_dual->dump(); tty->cr(); | 670 tty->print("t_dual= "); t->_dual->dump(); tty->cr(); |
661 tty->print("this_dual= "); _dual->dump(); tty->cr(); | 671 tty->print("this_dual= "); this_t->_dual->dump(); tty->cr(); |
662 tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); | 672 tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); |
663 | 673 |
664 tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); | 674 tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); |
665 tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); | 675 tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); |
666 | 676 |
667 fatal("meet not symmetric" ); | 677 fatal("meet not symmetric" ); |
668 } | 678 } |
669 #endif | 679 #endif |
670 return mt; | 680 return mt; |
752 // The type is unchanged | 762 // The type is unchanged |
753 return this; | 763 return this; |
754 } | 764 } |
755 | 765 |
756 //-----------------------------filter------------------------------------------ | 766 //-----------------------------filter------------------------------------------ |
757 const Type *Type::filter( const Type *kills ) const { | 767 const Type *Type::filter_helper(const Type *kills, bool include_speculative) const { |
758 const Type* ft = join(kills); | 768 const Type* ft = join_helper(kills, include_speculative); |
759 if (ft->empty()) | 769 if (ft->empty()) |
760 return Type::TOP; // Canonical empty value | 770 return Type::TOP; // Canonical empty value |
761 return ft; | 771 return ft; |
762 } | 772 } |
763 | 773 |
1307 | 1317 |
1308 return this; | 1318 return this; |
1309 } | 1319 } |
1310 | 1320 |
1311 //-----------------------------filter------------------------------------------ | 1321 //-----------------------------filter------------------------------------------ |
1312 const Type *TypeInt::filter( const Type *kills ) const { | 1322 const Type *TypeInt::filter_helper(const Type *kills, bool include_speculative) const { |
1313 const TypeInt* ft = join(kills)->isa_int(); | 1323 const TypeInt* ft = join_helper(kills, include_speculative)->isa_int(); |
1314 if (ft == NULL || ft->empty()) | 1324 if (ft == NULL || ft->empty()) |
1315 return Type::TOP; // Canonical empty value | 1325 return Type::TOP; // Canonical empty value |
1316 if (ft->_widen < this->_widen) { | 1326 if (ft->_widen < this->_widen) { |
1317 // Do not allow the value of kill->_widen to affect the outcome. | 1327 // Do not allow the value of kill->_widen to affect the outcome. |
1318 // The widen bits must be allowed to run freely through the graph. | 1328 // The widen bits must be allowed to run freely through the graph. |
1568 | 1578 |
1569 return this; | 1579 return this; |
1570 } | 1580 } |
1571 | 1581 |
1572 //-----------------------------filter------------------------------------------ | 1582 //-----------------------------filter------------------------------------------ |
1573 const Type *TypeLong::filter( const Type *kills ) const { | 1583 const Type *TypeLong::filter_helper(const Type *kills, bool include_speculative) const { |
1574 const TypeLong* ft = join(kills)->isa_long(); | 1584 const TypeLong* ft = join_helper(kills, include_speculative)->isa_long(); |
1575 if (ft == NULL || ft->empty()) | 1585 if (ft == NULL || ft->empty()) |
1576 return Type::TOP; // Canonical empty value | 1586 return Type::TOP; // Canonical empty value |
1577 if (ft->_widen < this->_widen) { | 1587 if (ft->_widen < this->_widen) { |
1578 // Do not allow the value of kill->_widen to affect the outcome. | 1588 // Do not allow the value of kill->_widen to affect the outcome. |
1579 // The widen bits must be allowed to run freely through the graph. | 1589 // The widen bits must be allowed to run freely through the graph. |
1724 const Type **field_array; | 1734 const Type **field_array; |
1725 if (recv != NULL) { | 1735 if (recv != NULL) { |
1726 total_fields++; | 1736 total_fields++; |
1727 field_array = fields(total_fields); | 1737 field_array = fields(total_fields); |
1728 // Use get_const_type here because it respects UseUniqueSubclasses: | 1738 // Use get_const_type here because it respects UseUniqueSubclasses: |
1729 field_array[pos++] = get_const_type(recv)->join(TypePtr::NOTNULL); | 1739 field_array[pos++] = get_const_type(recv)->join_speculative(TypePtr::NOTNULL); |
1730 } else { | 1740 } else { |
1731 field_array = fields(total_fields); | 1741 field_array = fields(total_fields); |
1732 } | 1742 } |
1733 | 1743 |
1734 int i = 0; | 1744 int i = 0; |
1914 default: // All else is a mistake | 1924 default: // All else is a mistake |
1915 typerr(t); | 1925 typerr(t); |
1916 | 1926 |
1917 case Array: { // Meeting 2 arrays? | 1927 case Array: { // Meeting 2 arrays? |
1918 const TypeAry *a = t->is_ary(); | 1928 const TypeAry *a = t->is_ary(); |
1919 return TypeAry::make(_elem->meet(a->_elem), | 1929 return TypeAry::make(_elem->meet_speculative(a->_elem), |
1920 _size->xmeet(a->_size)->is_int(), | 1930 _size->xmeet(a->_size)->is_int(), |
1921 _stable & a->_stable); | 1931 _stable & a->_stable); |
1922 } | 1932 } |
1923 case Top: | 1933 case Top: |
1924 break; | 1934 break; |
1945 | 1955 |
1946 //------------------------------hash------------------------------------------- | 1956 //------------------------------hash------------------------------------------- |
1947 // Type-specific hashing function. | 1957 // Type-specific hashing function. |
1948 int TypeAry::hash(void) const { | 1958 int TypeAry::hash(void) const { |
1949 return (intptr_t)_elem + (intptr_t)_size + (_stable ? 43 : 0); | 1959 return (intptr_t)_elem + (intptr_t)_size + (_stable ? 43 : 0); |
1960 } | |
1961 | |
1962 /** | |
1963 * Return same type without a speculative part in the element | |
1964 */ | |
1965 const Type* TypeAry::remove_speculative() const { | |
1966 return make(_elem->remove_speculative(), _size, _stable); | |
1950 } | 1967 } |
1951 | 1968 |
1952 //----------------------interface_vs_oop--------------------------------------- | 1969 //----------------------interface_vs_oop--------------------------------------- |
1953 #ifdef ASSERT | 1970 #ifdef ASSERT |
1954 bool TypeAry::interface_vs_oop(const Type *t) const { | 1971 bool TypeAry::interface_vs_oop(const Type *t) const { |
2558 const Type* res = xmeet_helper(t); | 2575 const Type* res = xmeet_helper(t); |
2559 if (res->isa_oopptr() == NULL) { | 2576 if (res->isa_oopptr() == NULL) { |
2560 return res; | 2577 return res; |
2561 } | 2578 } |
2562 | 2579 |
2563 if (res->isa_oopptr() != NULL) { | 2580 const TypeOopPtr* res_oopptr = res->is_oopptr(); |
2581 if (res_oopptr->speculative() != NULL) { | |
2564 // type->speculative() == NULL means that speculation is no better | 2582 // type->speculative() == NULL means that speculation is no better |
2565 // than type, i.e. type->speculative() == type. So there are 2 | 2583 // than type, i.e. type->speculative() == type. So there are 2 |
2566 // ways to represent the fact that we have no useful speculative | 2584 // ways to represent the fact that we have no useful speculative |
2567 // data and we should use a single one to be able to test for | 2585 // data and we should use a single one to be able to test for |
2568 // equality between types. Check whether type->speculative() == | 2586 // equality between types. Check whether type->speculative() == |
2569 // type and set speculative to NULL if it is the case. | 2587 // type and set speculative to NULL if it is the case. |
2570 const TypeOopPtr* res_oopptr = res->is_oopptr(); | |
2571 if (res_oopptr->remove_speculative() == res_oopptr->speculative()) { | 2588 if (res_oopptr->remove_speculative() == res_oopptr->speculative()) { |
2572 return res_oopptr->remove_speculative(); | 2589 return res_oopptr->remove_speculative(); |
2573 } | 2590 } |
2574 } | 2591 } |
2575 | 2592 |
2631 } | 2648 } |
2632 | 2649 |
2633 case OopPtr: { // Meeting to other OopPtrs | 2650 case OopPtr: { // Meeting to other OopPtrs |
2634 const TypeOopPtr *tp = t->is_oopptr(); | 2651 const TypeOopPtr *tp = t->is_oopptr(); |
2635 int instance_id = meet_instance_id(tp->instance_id()); | 2652 int instance_id = meet_instance_id(tp->instance_id()); |
2636 const TypeOopPtr* speculative = meet_speculative(tp); | 2653 const TypeOopPtr* speculative = xmeet_speculative(tp); |
2637 return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative); | 2654 return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative); |
2638 } | 2655 } |
2639 | 2656 |
2640 case InstPtr: // For these, flip the call around to cut down | 2657 case InstPtr: // For these, flip the call around to cut down |
2641 case AryPtr: | 2658 case AryPtr: |
2785 } | 2802 } |
2786 | 2803 |
2787 | 2804 |
2788 //-----------------------------filter------------------------------------------ | 2805 //-----------------------------filter------------------------------------------ |
2789 // Do not allow interface-vs.-noninterface joins to collapse to top. | 2806 // Do not allow interface-vs.-noninterface joins to collapse to top. |
2790 const Type *TypeOopPtr::filter(const Type *kills) const { | 2807 const Type *TypeOopPtr::filter_helper(const Type *kills, bool include_speculative) const { |
2791 | 2808 |
2792 const Type* ft = join(kills); | 2809 const Type* ft = join_helper(kills, include_speculative); |
2793 const TypeInstPtr* ftip = ft->isa_instptr(); | 2810 const TypeInstPtr* ftip = ft->isa_instptr(); |
2794 const TypeInstPtr* ktip = kills->isa_instptr(); | 2811 const TypeInstPtr* ktip = kills->isa_instptr(); |
2795 | 2812 |
2796 if (ft->empty()) { | 2813 if (ft->empty()) { |
2797 // Check for evil case of 'this' being a class and 'kills' expecting an | 2814 // Check for evil case of 'this' being a class and 'kills' expecting an |
2899 } | 2916 } |
2900 | 2917 |
2901 /** | 2918 /** |
2902 * Return same type without a speculative part | 2919 * Return same type without a speculative part |
2903 */ | 2920 */ |
2904 const TypeOopPtr* TypeOopPtr::remove_speculative() const { | 2921 const Type* TypeOopPtr::remove_speculative() const { |
2922 if (_speculative == NULL) { | |
2923 return this; | |
2924 } | |
2905 return make(_ptr, _offset, _instance_id, NULL); | 2925 return make(_ptr, _offset, _instance_id, NULL); |
2906 } | 2926 } |
2907 | 2927 |
2908 //------------------------------meet_instance_id-------------------------------- | 2928 //------------------------------meet_instance_id-------------------------------- |
2909 int TypeOopPtr::meet_instance_id( int instance_id ) const { | 2929 int TypeOopPtr::meet_instance_id( int instance_id ) const { |
2925 /** | 2945 /** |
2926 * meet of the speculative parts of 2 types | 2946 * meet of the speculative parts of 2 types |
2927 * | 2947 * |
2928 * @param other type to meet with | 2948 * @param other type to meet with |
2929 */ | 2949 */ |
2930 const TypeOopPtr* TypeOopPtr::meet_speculative(const TypeOopPtr* other) const { | 2950 const TypeOopPtr* TypeOopPtr::xmeet_speculative(const TypeOopPtr* other) const { |
2931 bool this_has_spec = (_speculative != NULL); | 2951 bool this_has_spec = (_speculative != NULL); |
2932 bool other_has_spec = (other->speculative() != NULL); | 2952 bool other_has_spec = (other->speculative() != NULL); |
2933 | 2953 |
2934 if (!this_has_spec && !other_has_spec) { | 2954 if (!this_has_spec && !other_has_spec) { |
2935 return NULL; | 2955 return NULL; |
2950 | 2970 |
2951 if (!other_has_spec) { | 2971 if (!other_has_spec) { |
2952 other_spec = other; | 2972 other_spec = other; |
2953 } | 2973 } |
2954 | 2974 |
2955 return this_spec->meet(other_spec)->is_oopptr(); | 2975 return this_spec->meet_speculative(other_spec)->is_oopptr(); |
2956 } | 2976 } |
2957 | 2977 |
2958 /** | 2978 /** |
2959 * dual of the speculative part of the type | 2979 * dual of the speculative part of the type |
2960 */ | 2980 */ |
3109 // Assume classes are different since called after check for same name/class-loader | 3129 // Assume classes are different since called after check for same name/class-loader |
3110 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const { | 3130 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const { |
3111 int off = meet_offset(tinst->offset()); | 3131 int off = meet_offset(tinst->offset()); |
3112 PTR ptr = meet_ptr(tinst->ptr()); | 3132 PTR ptr = meet_ptr(tinst->ptr()); |
3113 int instance_id = meet_instance_id(tinst->instance_id()); | 3133 int instance_id = meet_instance_id(tinst->instance_id()); |
3114 const TypeOopPtr* speculative = meet_speculative(tinst); | 3134 const TypeOopPtr* speculative = xmeet_speculative(tinst); |
3115 | 3135 |
3116 const TypeInstPtr *loaded = is_loaded() ? this : tinst; | 3136 const TypeInstPtr *loaded = is_loaded() ? this : tinst; |
3117 const TypeInstPtr *unloaded = is_loaded() ? tinst : this; | 3137 const TypeInstPtr *unloaded = is_loaded() ? tinst : this; |
3118 if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) { | 3138 if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) { |
3119 // | 3139 // |
3186 case AryPtr: { // All arrays inherit from Object class | 3206 case AryPtr: { // All arrays inherit from Object class |
3187 const TypeAryPtr *tp = t->is_aryptr(); | 3207 const TypeAryPtr *tp = t->is_aryptr(); |
3188 int offset = meet_offset(tp->offset()); | 3208 int offset = meet_offset(tp->offset()); |
3189 PTR ptr = meet_ptr(tp->ptr()); | 3209 PTR ptr = meet_ptr(tp->ptr()); |
3190 int instance_id = meet_instance_id(tp->instance_id()); | 3210 int instance_id = meet_instance_id(tp->instance_id()); |
3191 const TypeOopPtr* speculative = meet_speculative(tp); | 3211 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3192 switch (ptr) { | 3212 switch (ptr) { |
3193 case TopPTR: | 3213 case TopPTR: |
3194 case AnyNull: // Fall 'down' to dual of object klass | 3214 case AnyNull: // Fall 'down' to dual of object klass |
3195 // For instances when a subclass meets a superclass we fall | 3215 // For instances when a subclass meets a superclass we fall |
3196 // below the centerline when the superclass is exact. We need to | 3216 // below the centerline when the superclass is exact. We need to |
3236 PTR ptr = meet_ptr(tp->ptr()); | 3256 PTR ptr = meet_ptr(tp->ptr()); |
3237 switch (tp->ptr()) { | 3257 switch (tp->ptr()) { |
3238 case TopPTR: | 3258 case TopPTR: |
3239 case AnyNull: { | 3259 case AnyNull: { |
3240 int instance_id = meet_instance_id(InstanceTop); | 3260 int instance_id = meet_instance_id(InstanceTop); |
3241 const TypeOopPtr* speculative = meet_speculative(tp); | 3261 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3242 return make(ptr, klass(), klass_is_exact(), | 3262 return make(ptr, klass(), klass_is_exact(), |
3243 (ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative); | 3263 (ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative); |
3244 } | 3264 } |
3245 case NotNull: | 3265 case NotNull: |
3246 case BotPTR: { | 3266 case BotPTR: { |
3247 int instance_id = meet_instance_id(tp->instance_id()); | 3267 int instance_id = meet_instance_id(tp->instance_id()); |
3248 const TypeOopPtr* speculative = meet_speculative(tp); | 3268 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3249 return TypeOopPtr::make(ptr, offset, instance_id, speculative); | 3269 return TypeOopPtr::make(ptr, offset, instance_id, speculative); |
3250 } | 3270 } |
3251 default: typerr(t); | 3271 default: typerr(t); |
3252 } | 3272 } |
3253 } | 3273 } |
3295 // Found an InstPtr sub-type vs self-InstPtr type | 3315 // Found an InstPtr sub-type vs self-InstPtr type |
3296 const TypeInstPtr *tinst = t->is_instptr(); | 3316 const TypeInstPtr *tinst = t->is_instptr(); |
3297 int off = meet_offset( tinst->offset() ); | 3317 int off = meet_offset( tinst->offset() ); |
3298 PTR ptr = meet_ptr( tinst->ptr() ); | 3318 PTR ptr = meet_ptr( tinst->ptr() ); |
3299 int instance_id = meet_instance_id(tinst->instance_id()); | 3319 int instance_id = meet_instance_id(tinst->instance_id()); |
3300 const TypeOopPtr* speculative = meet_speculative(tinst); | 3320 const TypeOopPtr* speculative = xmeet_speculative(tinst); |
3301 | 3321 |
3302 // Check for easy case; klasses are equal (and perhaps not loaded!) | 3322 // Check for easy case; klasses are equal (and perhaps not loaded!) |
3303 // If we have constants, then we created oops so classes are loaded | 3323 // If we have constants, then we created oops so classes are loaded |
3304 // and we can handle the constants further down. This case handles | 3324 // and we can handle the constants further down. This case handles |
3305 // both-not-loaded or both-loaded classes | 3325 // both-not-loaded or both-loaded classes |
3544 //------------------------------add_offset------------------------------------- | 3564 //------------------------------add_offset------------------------------------- |
3545 const TypePtr *TypeInstPtr::add_offset(intptr_t offset) const { | 3565 const TypePtr *TypeInstPtr::add_offset(intptr_t offset) const { |
3546 return make(_ptr, klass(), klass_is_exact(), const_oop(), xadd_offset(offset), _instance_id, add_offset_speculative(offset)); | 3566 return make(_ptr, klass(), klass_is_exact(), const_oop(), xadd_offset(offset), _instance_id, add_offset_speculative(offset)); |
3547 } | 3567 } |
3548 | 3568 |
3549 const TypeOopPtr *TypeInstPtr::remove_speculative() const { | 3569 const Type *TypeInstPtr::remove_speculative() const { |
3570 if (_speculative == NULL) { | |
3571 return this; | |
3572 } | |
3550 return make(_ptr, klass(), klass_is_exact(), const_oop(), _offset, _instance_id, NULL); | 3573 return make(_ptr, klass(), klass_is_exact(), const_oop(), _offset, _instance_id, NULL); |
3551 } | 3574 } |
3552 | 3575 |
3553 //============================================================================= | 3576 //============================================================================= |
3554 // Convenience common pre-built types. | 3577 // Convenience common pre-built types. |
3746 PTR ptr = meet_ptr(tp->ptr()); | 3769 PTR ptr = meet_ptr(tp->ptr()); |
3747 switch (tp->ptr()) { | 3770 switch (tp->ptr()) { |
3748 case TopPTR: | 3771 case TopPTR: |
3749 case AnyNull: { | 3772 case AnyNull: { |
3750 int instance_id = meet_instance_id(InstanceTop); | 3773 int instance_id = meet_instance_id(InstanceTop); |
3751 const TypeOopPtr* speculative = meet_speculative(tp); | 3774 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3752 return make(ptr, (ptr == Constant ? const_oop() : NULL), | 3775 return make(ptr, (ptr == Constant ? const_oop() : NULL), |
3753 _ary, _klass, _klass_is_exact, offset, instance_id, speculative); | 3776 _ary, _klass, _klass_is_exact, offset, instance_id, speculative); |
3754 } | 3777 } |
3755 case BotPTR: | 3778 case BotPTR: |
3756 case NotNull: { | 3779 case NotNull: { |
3757 int instance_id = meet_instance_id(tp->instance_id()); | 3780 int instance_id = meet_instance_id(tp->instance_id()); |
3758 const TypeOopPtr* speculative = meet_speculative(tp); | 3781 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3759 return TypeOopPtr::make(ptr, offset, instance_id, speculative); | 3782 return TypeOopPtr::make(ptr, offset, instance_id, speculative); |
3760 } | 3783 } |
3761 default: ShouldNotReachHere(); | 3784 default: ShouldNotReachHere(); |
3762 } | 3785 } |
3763 } | 3786 } |
3791 case RawPtr: return TypePtr::BOTTOM; | 3814 case RawPtr: return TypePtr::BOTTOM; |
3792 | 3815 |
3793 case AryPtr: { // Meeting 2 references? | 3816 case AryPtr: { // Meeting 2 references? |
3794 const TypeAryPtr *tap = t->is_aryptr(); | 3817 const TypeAryPtr *tap = t->is_aryptr(); |
3795 int off = meet_offset(tap->offset()); | 3818 int off = meet_offset(tap->offset()); |
3796 const TypeAry *tary = _ary->meet(tap->_ary)->is_ary(); | 3819 const TypeAry *tary = _ary->meet_speculative(tap->_ary)->is_ary(); |
3797 PTR ptr = meet_ptr(tap->ptr()); | 3820 PTR ptr = meet_ptr(tap->ptr()); |
3798 int instance_id = meet_instance_id(tap->instance_id()); | 3821 int instance_id = meet_instance_id(tap->instance_id()); |
3799 const TypeOopPtr* speculative = meet_speculative(tap); | 3822 const TypeOopPtr* speculative = xmeet_speculative(tap); |
3800 ciKlass* lazy_klass = NULL; | 3823 ciKlass* lazy_klass = NULL; |
3801 if (tary->_elem->isa_int()) { | 3824 if (tary->_elem->isa_int()) { |
3802 // Integral array element types have irrelevant lattice relations. | 3825 // Integral array element types have irrelevant lattice relations. |
3803 // It is the klass that determines array layout, not the element type. | 3826 // It is the klass that determines array layout, not the element type. |
3804 if (_klass == NULL) | 3827 if (_klass == NULL) |
3874 case InstPtr: { | 3897 case InstPtr: { |
3875 const TypeInstPtr *tp = t->is_instptr(); | 3898 const TypeInstPtr *tp = t->is_instptr(); |
3876 int offset = meet_offset(tp->offset()); | 3899 int offset = meet_offset(tp->offset()); |
3877 PTR ptr = meet_ptr(tp->ptr()); | 3900 PTR ptr = meet_ptr(tp->ptr()); |
3878 int instance_id = meet_instance_id(tp->instance_id()); | 3901 int instance_id = meet_instance_id(tp->instance_id()); |
3879 const TypeOopPtr* speculative = meet_speculative(tp); | 3902 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3880 switch (ptr) { | 3903 switch (ptr) { |
3881 case TopPTR: | 3904 case TopPTR: |
3882 case AnyNull: // Fall 'down' to dual of object klass | 3905 case AnyNull: // Fall 'down' to dual of object klass |
3883 // For instances when a subclass meets a superclass we fall | 3906 // For instances when a subclass meets a superclass we fall |
3884 // below the centerline when the superclass is exact. We need to | 3907 // below the centerline when the superclass is exact. We need to |
3988 //------------------------------add_offset------------------------------------- | 4011 //------------------------------add_offset------------------------------------- |
3989 const TypePtr *TypeAryPtr::add_offset(intptr_t offset) const { | 4012 const TypePtr *TypeAryPtr::add_offset(intptr_t offset) const { |
3990 return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id, add_offset_speculative(offset)); | 4013 return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id, add_offset_speculative(offset)); |
3991 } | 4014 } |
3992 | 4015 |
3993 const TypeOopPtr *TypeAryPtr::remove_speculative() const { | 4016 const Type *TypeAryPtr::remove_speculative() const { |
3994 return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, _offset, _instance_id, NULL); | 4017 return make(_ptr, _const_oop, _ary->remove_speculative()->is_ary(), _klass, _klass_is_exact, _offset, _instance_id, NULL); |
3995 } | 4018 } |
3996 | 4019 |
3997 //============================================================================= | 4020 //============================================================================= |
3998 | 4021 |
3999 //------------------------------hash------------------------------------------- | 4022 //------------------------------hash------------------------------------------- |
4029 const TypePtr* odual = _ptrtype->dual()->is_ptr(); | 4052 const TypePtr* odual = _ptrtype->dual()->is_ptr(); |
4030 return make_same_narrowptr(odual); | 4053 return make_same_narrowptr(odual); |
4031 } | 4054 } |
4032 | 4055 |
4033 | 4056 |
4034 const Type *TypeNarrowPtr::filter( const Type *kills ) const { | 4057 const Type *TypeNarrowPtr::filter_helper(const Type *kills, bool include_speculative) const { |
4035 if (isa_same_narrowptr(kills)) { | 4058 if (isa_same_narrowptr(kills)) { |
4036 const Type* ft =_ptrtype->filter(is_same_narrowptr(kills)->_ptrtype); | 4059 const Type* ft =_ptrtype->filter_helper(is_same_narrowptr(kills)->_ptrtype, include_speculative); |
4037 if (ft->empty()) | 4060 if (ft->empty()) |
4038 return Type::TOP; // Canonical empty value | 4061 return Type::TOP; // Canonical empty value |
4039 if (ft->isa_ptr()) { | 4062 if (ft->isa_ptr()) { |
4040 return make_hash_same_narrowptr(ft->isa_ptr()); | 4063 return make_hash_same_narrowptr(ft->isa_ptr()); |
4041 } | 4064 } |
4042 return ft; | 4065 return ft; |
4043 } else if (kills->isa_ptr()) { | 4066 } else if (kills->isa_ptr()) { |
4044 const Type* ft = _ptrtype->join(kills); | 4067 const Type* ft = _ptrtype->join_helper(kills, include_speculative); |
4045 if (ft->empty()) | 4068 if (ft->empty()) |
4046 return Type::TOP; // Canonical empty value | 4069 return Type::TOP; // Canonical empty value |
4047 return ft; | 4070 return ft; |
4048 } else { | 4071 } else { |
4049 return Type::TOP; | 4072 return Type::TOP; |
4169 return make( _ptr, _metadata, xadd_offset(offset)); | 4192 return make( _ptr, _metadata, xadd_offset(offset)); |
4170 } | 4193 } |
4171 | 4194 |
4172 //-----------------------------filter------------------------------------------ | 4195 //-----------------------------filter------------------------------------------ |
4173 // Do not allow interface-vs.-noninterface joins to collapse to top. | 4196 // Do not allow interface-vs.-noninterface joins to collapse to top. |
4174 const Type *TypeMetadataPtr::filter( const Type *kills ) const { | 4197 const Type *TypeMetadataPtr::filter_helper(const Type *kills, bool include_speculative) const { |
4175 const TypeMetadataPtr* ft = join(kills)->isa_metadataptr(); | 4198 const TypeMetadataPtr* ft = join_helper(kills, include_speculative)->isa_metadataptr(); |
4176 if (ft == NULL || ft->empty()) | 4199 if (ft == NULL || ft->empty()) |
4177 return Type::TOP; // Canonical empty value | 4200 return Type::TOP; // Canonical empty value |
4178 return ft; | 4201 return ft; |
4179 } | 4202 } |
4180 | 4203 |
4372 // TopPTR, Null, AnyNull, Constant are all singletons | 4395 // TopPTR, Null, AnyNull, Constant are all singletons |
4373 return (_offset == 0) && !below_centerline(_ptr); | 4396 return (_offset == 0) && !below_centerline(_ptr); |
4374 } | 4397 } |
4375 | 4398 |
4376 // Do not allow interface-vs.-noninterface joins to collapse to top. | 4399 // Do not allow interface-vs.-noninterface joins to collapse to top. |
4377 const Type *TypeKlassPtr::filter(const Type *kills) const { | 4400 const Type *TypeKlassPtr::filter_helper(const Type *kills, bool include_speculative) const { |
4378 // logic here mirrors the one from TypeOopPtr::filter. See comments | 4401 // logic here mirrors the one from TypeOopPtr::filter. See comments |
4379 // there. | 4402 // there. |
4380 const Type* ft = join(kills); | 4403 const Type* ft = join_helper(kills, include_speculative); |
4381 const TypeKlassPtr* ftkp = ft->isa_klassptr(); | 4404 const TypeKlassPtr* ftkp = ft->isa_klassptr(); |
4382 const TypeKlassPtr* ktkp = kills->isa_klassptr(); | 4405 const TypeKlassPtr* ktkp = kills->isa_klassptr(); |
4383 | 4406 |
4384 if (ft->empty()) { | 4407 if (ft->empty()) { |
4385 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) | 4408 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) |