631 #endif |
638 #endif |
632 |
639 |
633 //------------------------------meet------------------------------------------- |
640 //------------------------------meet------------------------------------------- |
634 // Compute the MEET of two types. NOT virtual. It enforces that meet is |
641 // Compute the MEET of two types. NOT virtual. It enforces that meet is |
635 // commutative and the lattice is symmetric. |
642 // commutative and the lattice is symmetric. |
636 const Type *Type::meet( const Type *t ) const { |
643 const Type *Type::meet_helper(const Type *t, bool include_speculative) const { |
637 if (isa_narrowoop() && t->isa_narrowoop()) { |
644 if (isa_narrowoop() && t->isa_narrowoop()) { |
638 const Type* result = make_ptr()->meet(t->make_ptr()); |
645 const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative); |
639 return result->make_narrowoop(); |
646 return result->make_narrowoop(); |
640 } |
647 } |
641 if (isa_narrowklass() && t->isa_narrowklass()) { |
648 if (isa_narrowklass() && t->isa_narrowklass()) { |
642 const Type* result = make_ptr()->meet(t->make_ptr()); |
649 const Type* result = make_ptr()->meet_helper(t->make_ptr(), include_speculative); |
643 return result->make_narrowklass(); |
650 return result->make_narrowklass(); |
644 } |
651 } |
645 |
652 |
646 const Type *mt = xmeet(t); |
653 const Type *this_t = maybe_remove_speculative(include_speculative); |
|
654 t = t->maybe_remove_speculative(include_speculative); |
|
655 |
|
656 const Type *mt = this_t->xmeet(t); |
647 if (isa_narrowoop() || t->isa_narrowoop()) return mt; |
657 if (isa_narrowoop() || t->isa_narrowoop()) return mt; |
648 if (isa_narrowklass() || t->isa_narrowklass()) return mt; |
658 if (isa_narrowklass() || t->isa_narrowklass()) return mt; |
649 #ifdef ASSERT |
659 #ifdef ASSERT |
650 assert( mt == t->xmeet(this), "meet not commutative" ); |
660 assert(mt == t->xmeet(this_t), "meet not commutative"); |
651 const Type* dual_join = mt->_dual; |
661 const Type* dual_join = mt->_dual; |
652 const Type *t2t = dual_join->xmeet(t->_dual); |
662 const Type *t2t = dual_join->xmeet(t->_dual); |
653 const Type *t2this = dual_join->xmeet( _dual); |
663 const Type *t2this = dual_join->xmeet(this_t->_dual); |
654 |
664 |
655 // Interface meet Oop is Not Symmetric: |
665 // Interface meet Oop is Not Symmetric: |
656 // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull |
666 // Interface:AnyNull meet Oop:AnyNull == Interface:AnyNull |
657 // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull |
667 // Interface:NotNull meet Oop:NotNull == java/lang/Object:NotNull |
658 |
668 |
659 if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != _dual) ) { |
669 if( !interface_vs_oop(t) && (t2t != t->_dual || t2this != this_t->_dual) ) { |
660 tty->print_cr("=== Meet Not Symmetric ==="); |
670 tty->print_cr("=== Meet Not Symmetric ==="); |
661 tty->print("t = "); t->dump(); tty->cr(); |
671 tty->print("t = "); t->dump(); tty->cr(); |
662 tty->print("this= "); dump(); tty->cr(); |
672 tty->print("this= "); this_t->dump(); tty->cr(); |
663 tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); |
673 tty->print("mt=(t meet this)= "); mt->dump(); tty->cr(); |
664 |
674 |
665 tty->print("t_dual= "); t->_dual->dump(); tty->cr(); |
675 tty->print("t_dual= "); t->_dual->dump(); tty->cr(); |
666 tty->print("this_dual= "); _dual->dump(); tty->cr(); |
676 tty->print("this_dual= "); this_t->_dual->dump(); tty->cr(); |
667 tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); |
677 tty->print("mt_dual= "); mt->_dual->dump(); tty->cr(); |
668 |
678 |
669 tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); |
679 tty->print("mt_dual meet t_dual= "); t2t ->dump(); tty->cr(); |
670 tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); |
680 tty->print("mt_dual meet this_dual= "); t2this ->dump(); tty->cr(); |
671 |
681 |
672 fatal("meet not symmetric" ); |
682 fatal("meet not symmetric" ); |
673 } |
683 } |
674 #endif |
684 #endif |
675 return mt; |
685 return mt; |
1312 |
1322 |
1313 return this; |
1323 return this; |
1314 } |
1324 } |
1315 |
1325 |
1316 //-----------------------------filter------------------------------------------ |
1326 //-----------------------------filter------------------------------------------ |
1317 const Type *TypeInt::filter( const Type *kills ) const { |
1327 const Type *TypeInt::filter_helper(const Type *kills, bool include_speculative) const { |
1318 const TypeInt* ft = join(kills)->isa_int(); |
1328 const TypeInt* ft = join_helper(kills, include_speculative)->isa_int(); |
1319 if (ft == NULL || ft->empty()) |
1329 if (ft == NULL || ft->empty()) |
1320 return Type::TOP; // Canonical empty value |
1330 return Type::TOP; // Canonical empty value |
1321 if (ft->_widen < this->_widen) { |
1331 if (ft->_widen < this->_widen) { |
1322 // Do not allow the value of kill->_widen to affect the outcome. |
1332 // Do not allow the value of kill->_widen to affect the outcome. |
1323 // The widen bits must be allowed to run freely through the graph. |
1333 // The widen bits must be allowed to run freely through the graph. |
1573 |
1583 |
1574 return this; |
1584 return this; |
1575 } |
1585 } |
1576 |
1586 |
1577 //-----------------------------filter------------------------------------------ |
1587 //-----------------------------filter------------------------------------------ |
1578 const Type *TypeLong::filter( const Type *kills ) const { |
1588 const Type *TypeLong::filter_helper(const Type *kills, bool include_speculative) const { |
1579 const TypeLong* ft = join(kills)->isa_long(); |
1589 const TypeLong* ft = join_helper(kills, include_speculative)->isa_long(); |
1580 if (ft == NULL || ft->empty()) |
1590 if (ft == NULL || ft->empty()) |
1581 return Type::TOP; // Canonical empty value |
1591 return Type::TOP; // Canonical empty value |
1582 if (ft->_widen < this->_widen) { |
1592 if (ft->_widen < this->_widen) { |
1583 // Do not allow the value of kill->_widen to affect the outcome. |
1593 // Do not allow the value of kill->_widen to affect the outcome. |
1584 // The widen bits must be allowed to run freely through the graph. |
1594 // The widen bits must be allowed to run freely through the graph. |
1950 |
1960 |
1951 //------------------------------hash------------------------------------------- |
1961 //------------------------------hash------------------------------------------- |
1952 // Type-specific hashing function. |
1962 // Type-specific hashing function. |
1953 int TypeAry::hash(void) const { |
1963 int TypeAry::hash(void) const { |
1954 return (intptr_t)_elem + (intptr_t)_size + (_stable ? 43 : 0); |
1964 return (intptr_t)_elem + (intptr_t)_size + (_stable ? 43 : 0); |
|
1965 } |
|
1966 |
|
1967 /** |
|
1968 * Return same type without a speculative part in the element |
|
1969 */ |
|
1970 const Type* TypeAry::remove_speculative() const { |
|
1971 return make(_elem->remove_speculative(), _size, _stable); |
1955 } |
1972 } |
1956 |
1973 |
1957 //----------------------interface_vs_oop--------------------------------------- |
1974 //----------------------interface_vs_oop--------------------------------------- |
1958 #ifdef ASSERT |
1975 #ifdef ASSERT |
1959 bool TypeAry::interface_vs_oop(const Type *t) const { |
1976 bool TypeAry::interface_vs_oop(const Type *t) const { |
2564 const Type* res = xmeet_helper(t); |
2581 const Type* res = xmeet_helper(t); |
2565 if (res->isa_oopptr() == NULL) { |
2582 if (res->isa_oopptr() == NULL) { |
2566 return res; |
2583 return res; |
2567 } |
2584 } |
2568 |
2585 |
2569 if (res->isa_oopptr() != NULL) { |
2586 const TypeOopPtr* res_oopptr = res->is_oopptr(); |
|
2587 if (res_oopptr->speculative() != NULL) { |
2570 // type->speculative() == NULL means that speculation is no better |
2588 // type->speculative() == NULL means that speculation is no better |
2571 // than type, i.e. type->speculative() == type. So there are 2 |
2589 // than type, i.e. type->speculative() == type. So there are 2 |
2572 // ways to represent the fact that we have no useful speculative |
2590 // ways to represent the fact that we have no useful speculative |
2573 // data and we should use a single one to be able to test for |
2591 // data and we should use a single one to be able to test for |
2574 // equality between types. Check whether type->speculative() == |
2592 // equality between types. Check whether type->speculative() == |
2575 // type and set speculative to NULL if it is the case. |
2593 // type and set speculative to NULL if it is the case. |
2576 const TypeOopPtr* res_oopptr = res->is_oopptr(); |
|
2577 if (res_oopptr->remove_speculative() == res_oopptr->speculative()) { |
2594 if (res_oopptr->remove_speculative() == res_oopptr->speculative()) { |
2578 return res_oopptr->remove_speculative(); |
2595 return res_oopptr->remove_speculative(); |
2579 } |
2596 } |
2580 } |
2597 } |
2581 |
2598 |
2637 } |
2654 } |
2638 |
2655 |
2639 case OopPtr: { // Meeting to other OopPtrs |
2656 case OopPtr: { // Meeting to other OopPtrs |
2640 const TypeOopPtr *tp = t->is_oopptr(); |
2657 const TypeOopPtr *tp = t->is_oopptr(); |
2641 int instance_id = meet_instance_id(tp->instance_id()); |
2658 int instance_id = meet_instance_id(tp->instance_id()); |
2642 const TypeOopPtr* speculative = meet_speculative(tp); |
2659 const TypeOopPtr* speculative = xmeet_speculative(tp); |
2643 return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative); |
2660 return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative); |
2644 } |
2661 } |
2645 |
2662 |
2646 case InstPtr: // For these, flip the call around to cut down |
2663 case InstPtr: // For these, flip the call around to cut down |
2647 case AryPtr: |
2664 case AryPtr: |
2791 } |
2808 } |
2792 |
2809 |
2793 |
2810 |
2794 //-----------------------------filter------------------------------------------ |
2811 //-----------------------------filter------------------------------------------ |
2795 // Do not allow interface-vs.-noninterface joins to collapse to top. |
2812 // Do not allow interface-vs.-noninterface joins to collapse to top. |
2796 const Type *TypeOopPtr::filter(const Type *kills) const { |
2813 const Type *TypeOopPtr::filter_helper(const Type *kills, bool include_speculative) const { |
2797 |
2814 |
2798 const Type* ft = join(kills); |
2815 const Type* ft = join_helper(kills, include_speculative); |
2799 const TypeInstPtr* ftip = ft->isa_instptr(); |
2816 const TypeInstPtr* ftip = ft->isa_instptr(); |
2800 const TypeInstPtr* ktip = kills->isa_instptr(); |
2817 const TypeInstPtr* ktip = kills->isa_instptr(); |
2801 |
2818 |
2802 if (ft->empty()) { |
2819 if (ft->empty()) { |
2803 // Check for evil case of 'this' being a class and 'kills' expecting an |
2820 // Check for evil case of 'this' being a class and 'kills' expecting an |
3115 // Assume classes are different since called after check for same name/class-loader |
3135 // Assume classes are different since called after check for same name/class-loader |
3116 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const { |
3136 const TypeInstPtr *TypeInstPtr::xmeet_unloaded(const TypeInstPtr *tinst) const { |
3117 int off = meet_offset(tinst->offset()); |
3137 int off = meet_offset(tinst->offset()); |
3118 PTR ptr = meet_ptr(tinst->ptr()); |
3138 PTR ptr = meet_ptr(tinst->ptr()); |
3119 int instance_id = meet_instance_id(tinst->instance_id()); |
3139 int instance_id = meet_instance_id(tinst->instance_id()); |
3120 const TypeOopPtr* speculative = meet_speculative(tinst); |
3140 const TypeOopPtr* speculative = xmeet_speculative(tinst); |
3121 |
3141 |
3122 const TypeInstPtr *loaded = is_loaded() ? this : tinst; |
3142 const TypeInstPtr *loaded = is_loaded() ? this : tinst; |
3123 const TypeInstPtr *unloaded = is_loaded() ? tinst : this; |
3143 const TypeInstPtr *unloaded = is_loaded() ? tinst : this; |
3124 if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) { |
3144 if( loaded->klass()->equals(ciEnv::current()->Object_klass()) ) { |
3125 // |
3145 // |
3192 case AryPtr: { // All arrays inherit from Object class |
3212 case AryPtr: { // All arrays inherit from Object class |
3193 const TypeAryPtr *tp = t->is_aryptr(); |
3213 const TypeAryPtr *tp = t->is_aryptr(); |
3194 int offset = meet_offset(tp->offset()); |
3214 int offset = meet_offset(tp->offset()); |
3195 PTR ptr = meet_ptr(tp->ptr()); |
3215 PTR ptr = meet_ptr(tp->ptr()); |
3196 int instance_id = meet_instance_id(tp->instance_id()); |
3216 int instance_id = meet_instance_id(tp->instance_id()); |
3197 const TypeOopPtr* speculative = meet_speculative(tp); |
3217 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3198 switch (ptr) { |
3218 switch (ptr) { |
3199 case TopPTR: |
3219 case TopPTR: |
3200 case AnyNull: // Fall 'down' to dual of object klass |
3220 case AnyNull: // Fall 'down' to dual of object klass |
3201 // For instances when a subclass meets a superclass we fall |
3221 // For instances when a subclass meets a superclass we fall |
3202 // below the centerline when the superclass is exact. We need to |
3222 // below the centerline when the superclass is exact. We need to |
3242 PTR ptr = meet_ptr(tp->ptr()); |
3262 PTR ptr = meet_ptr(tp->ptr()); |
3243 switch (tp->ptr()) { |
3263 switch (tp->ptr()) { |
3244 case TopPTR: |
3264 case TopPTR: |
3245 case AnyNull: { |
3265 case AnyNull: { |
3246 int instance_id = meet_instance_id(InstanceTop); |
3266 int instance_id = meet_instance_id(InstanceTop); |
3247 const TypeOopPtr* speculative = meet_speculative(tp); |
3267 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3248 return make(ptr, klass(), klass_is_exact(), |
3268 return make(ptr, klass(), klass_is_exact(), |
3249 (ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative); |
3269 (ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative); |
3250 } |
3270 } |
3251 case NotNull: |
3271 case NotNull: |
3252 case BotPTR: { |
3272 case BotPTR: { |
3253 int instance_id = meet_instance_id(tp->instance_id()); |
3273 int instance_id = meet_instance_id(tp->instance_id()); |
3254 const TypeOopPtr* speculative = meet_speculative(tp); |
3274 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3255 return TypeOopPtr::make(ptr, offset, instance_id, speculative); |
3275 return TypeOopPtr::make(ptr, offset, instance_id, speculative); |
3256 } |
3276 } |
3257 default: typerr(t); |
3277 default: typerr(t); |
3258 } |
3278 } |
3259 } |
3279 } |
3301 // Found an InstPtr sub-type vs self-InstPtr type |
3321 // Found an InstPtr sub-type vs self-InstPtr type |
3302 const TypeInstPtr *tinst = t->is_instptr(); |
3322 const TypeInstPtr *tinst = t->is_instptr(); |
3303 int off = meet_offset( tinst->offset() ); |
3323 int off = meet_offset( tinst->offset() ); |
3304 PTR ptr = meet_ptr( tinst->ptr() ); |
3324 PTR ptr = meet_ptr( tinst->ptr() ); |
3305 int instance_id = meet_instance_id(tinst->instance_id()); |
3325 int instance_id = meet_instance_id(tinst->instance_id()); |
3306 const TypeOopPtr* speculative = meet_speculative(tinst); |
3326 const TypeOopPtr* speculative = xmeet_speculative(tinst); |
3307 |
3327 |
3308 // Check for easy case; klasses are equal (and perhaps not loaded!) |
3328 // Check for easy case; klasses are equal (and perhaps not loaded!) |
3309 // If we have constants, then we created oops so classes are loaded |
3329 // If we have constants, then we created oops so classes are loaded |
3310 // and we can handle the constants further down. This case handles |
3330 // and we can handle the constants further down. This case handles |
3311 // both-not-loaded or both-loaded classes |
3331 // both-not-loaded or both-loaded classes |
3550 //------------------------------add_offset------------------------------------- |
3570 //------------------------------add_offset------------------------------------- |
3551 const TypePtr *TypeInstPtr::add_offset(intptr_t offset) const { |
3571 const TypePtr *TypeInstPtr::add_offset(intptr_t offset) const { |
3552 return make(_ptr, klass(), klass_is_exact(), const_oop(), xadd_offset(offset), _instance_id, add_offset_speculative(offset)); |
3572 return make(_ptr, klass(), klass_is_exact(), const_oop(), xadd_offset(offset), _instance_id, add_offset_speculative(offset)); |
3553 } |
3573 } |
3554 |
3574 |
3555 const TypeOopPtr *TypeInstPtr::remove_speculative() const { |
3575 const Type *TypeInstPtr::remove_speculative() const { |
|
3576 if (_speculative == NULL) { |
|
3577 return this; |
|
3578 } |
3556 return make(_ptr, klass(), klass_is_exact(), const_oop(), _offset, _instance_id, NULL); |
3579 return make(_ptr, klass(), klass_is_exact(), const_oop(), _offset, _instance_id, NULL); |
3557 } |
3580 } |
3558 |
3581 |
3559 //============================================================================= |
3582 //============================================================================= |
3560 // Convenience common pre-built types. |
3583 // Convenience common pre-built types. |
3752 PTR ptr = meet_ptr(tp->ptr()); |
3775 PTR ptr = meet_ptr(tp->ptr()); |
3753 switch (tp->ptr()) { |
3776 switch (tp->ptr()) { |
3754 case TopPTR: |
3777 case TopPTR: |
3755 case AnyNull: { |
3778 case AnyNull: { |
3756 int instance_id = meet_instance_id(InstanceTop); |
3779 int instance_id = meet_instance_id(InstanceTop); |
3757 const TypeOopPtr* speculative = meet_speculative(tp); |
3780 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3758 return make(ptr, (ptr == Constant ? const_oop() : NULL), |
3781 return make(ptr, (ptr == Constant ? const_oop() : NULL), |
3759 _ary, _klass, _klass_is_exact, offset, instance_id, speculative); |
3782 _ary, _klass, _klass_is_exact, offset, instance_id, speculative); |
3760 } |
3783 } |
3761 case BotPTR: |
3784 case BotPTR: |
3762 case NotNull: { |
3785 case NotNull: { |
3763 int instance_id = meet_instance_id(tp->instance_id()); |
3786 int instance_id = meet_instance_id(tp->instance_id()); |
3764 const TypeOopPtr* speculative = meet_speculative(tp); |
3787 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3765 return TypeOopPtr::make(ptr, offset, instance_id, speculative); |
3788 return TypeOopPtr::make(ptr, offset, instance_id, speculative); |
3766 } |
3789 } |
3767 default: ShouldNotReachHere(); |
3790 default: ShouldNotReachHere(); |
3768 } |
3791 } |
3769 } |
3792 } |
3797 case RawPtr: return TypePtr::BOTTOM; |
3820 case RawPtr: return TypePtr::BOTTOM; |
3798 |
3821 |
3799 case AryPtr: { // Meeting 2 references? |
3822 case AryPtr: { // Meeting 2 references? |
3800 const TypeAryPtr *tap = t->is_aryptr(); |
3823 const TypeAryPtr *tap = t->is_aryptr(); |
3801 int off = meet_offset(tap->offset()); |
3824 int off = meet_offset(tap->offset()); |
3802 const TypeAry *tary = _ary->meet(tap->_ary)->is_ary(); |
3825 const TypeAry *tary = _ary->meet_speculative(tap->_ary)->is_ary(); |
3803 PTR ptr = meet_ptr(tap->ptr()); |
3826 PTR ptr = meet_ptr(tap->ptr()); |
3804 int instance_id = meet_instance_id(tap->instance_id()); |
3827 int instance_id = meet_instance_id(tap->instance_id()); |
3805 const TypeOopPtr* speculative = meet_speculative(tap); |
3828 const TypeOopPtr* speculative = xmeet_speculative(tap); |
3806 ciKlass* lazy_klass = NULL; |
3829 ciKlass* lazy_klass = NULL; |
3807 if (tary->_elem->isa_int()) { |
3830 if (tary->_elem->isa_int()) { |
3808 // Integral array element types have irrelevant lattice relations. |
3831 // Integral array element types have irrelevant lattice relations. |
3809 // It is the klass that determines array layout, not the element type. |
3832 // It is the klass that determines array layout, not the element type. |
3810 if (_klass == NULL) |
3833 if (_klass == NULL) |
3880 case InstPtr: { |
3903 case InstPtr: { |
3881 const TypeInstPtr *tp = t->is_instptr(); |
3904 const TypeInstPtr *tp = t->is_instptr(); |
3882 int offset = meet_offset(tp->offset()); |
3905 int offset = meet_offset(tp->offset()); |
3883 PTR ptr = meet_ptr(tp->ptr()); |
3906 PTR ptr = meet_ptr(tp->ptr()); |
3884 int instance_id = meet_instance_id(tp->instance_id()); |
3907 int instance_id = meet_instance_id(tp->instance_id()); |
3885 const TypeOopPtr* speculative = meet_speculative(tp); |
3908 const TypeOopPtr* speculative = xmeet_speculative(tp); |
3886 switch (ptr) { |
3909 switch (ptr) { |
3887 case TopPTR: |
3910 case TopPTR: |
3888 case AnyNull: // Fall 'down' to dual of object klass |
3911 case AnyNull: // Fall 'down' to dual of object klass |
3889 // For instances when a subclass meets a superclass we fall |
3912 // For instances when a subclass meets a superclass we fall |
3890 // below the centerline when the superclass is exact. We need to |
3913 // below the centerline when the superclass is exact. We need to |
3994 //------------------------------add_offset------------------------------------- |
4017 //------------------------------add_offset------------------------------------- |
3995 const TypePtr *TypeAryPtr::add_offset(intptr_t offset) const { |
4018 const TypePtr *TypeAryPtr::add_offset(intptr_t offset) const { |
3996 return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id, add_offset_speculative(offset)); |
4019 return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, xadd_offset(offset), _instance_id, add_offset_speculative(offset)); |
3997 } |
4020 } |
3998 |
4021 |
3999 const TypeOopPtr *TypeAryPtr::remove_speculative() const { |
4022 const Type *TypeAryPtr::remove_speculative() const { |
4000 return make(_ptr, _const_oop, _ary, _klass, _klass_is_exact, _offset, _instance_id, NULL); |
4023 return make(_ptr, _const_oop, _ary->remove_speculative()->is_ary(), _klass, _klass_is_exact, _offset, _instance_id, NULL); |
4001 } |
4024 } |
4002 |
4025 |
4003 //============================================================================= |
4026 //============================================================================= |
4004 |
4027 |
4005 //------------------------------hash------------------------------------------- |
4028 //------------------------------hash------------------------------------------- |
4035 const TypePtr* odual = _ptrtype->dual()->is_ptr(); |
4058 const TypePtr* odual = _ptrtype->dual()->is_ptr(); |
4036 return make_same_narrowptr(odual); |
4059 return make_same_narrowptr(odual); |
4037 } |
4060 } |
4038 |
4061 |
4039 |
4062 |
4040 const Type *TypeNarrowPtr::filter( const Type *kills ) const { |
4063 const Type *TypeNarrowPtr::filter_helper(const Type *kills, bool include_speculative) const { |
4041 if (isa_same_narrowptr(kills)) { |
4064 if (isa_same_narrowptr(kills)) { |
4042 const Type* ft =_ptrtype->filter(is_same_narrowptr(kills)->_ptrtype); |
4065 const Type* ft =_ptrtype->filter_helper(is_same_narrowptr(kills)->_ptrtype, include_speculative); |
4043 if (ft->empty()) |
4066 if (ft->empty()) |
4044 return Type::TOP; // Canonical empty value |
4067 return Type::TOP; // Canonical empty value |
4045 if (ft->isa_ptr()) { |
4068 if (ft->isa_ptr()) { |
4046 return make_hash_same_narrowptr(ft->isa_ptr()); |
4069 return make_hash_same_narrowptr(ft->isa_ptr()); |
4047 } |
4070 } |
4048 return ft; |
4071 return ft; |
4049 } else if (kills->isa_ptr()) { |
4072 } else if (kills->isa_ptr()) { |
4050 const Type* ft = _ptrtype->join(kills); |
4073 const Type* ft = _ptrtype->join_helper(kills, include_speculative); |
4051 if (ft->empty()) |
4074 if (ft->empty()) |
4052 return Type::TOP; // Canonical empty value |
4075 return Type::TOP; // Canonical empty value |
4053 return ft; |
4076 return ft; |
4054 } else { |
4077 } else { |
4055 return Type::TOP; |
4078 return Type::TOP; |
4175 return make( _ptr, _metadata, xadd_offset(offset)); |
4198 return make( _ptr, _metadata, xadd_offset(offset)); |
4176 } |
4199 } |
4177 |
4200 |
4178 //-----------------------------filter------------------------------------------ |
4201 //-----------------------------filter------------------------------------------ |
4179 // Do not allow interface-vs.-noninterface joins to collapse to top. |
4202 // Do not allow interface-vs.-noninterface joins to collapse to top. |
4180 const Type *TypeMetadataPtr::filter( const Type *kills ) const { |
4203 const Type *TypeMetadataPtr::filter_helper(const Type *kills, bool include_speculative) const { |
4181 const TypeMetadataPtr* ft = join(kills)->isa_metadataptr(); |
4204 const TypeMetadataPtr* ft = join_helper(kills, include_speculative)->isa_metadataptr(); |
4182 if (ft == NULL || ft->empty()) |
4205 if (ft == NULL || ft->empty()) |
4183 return Type::TOP; // Canonical empty value |
4206 return Type::TOP; // Canonical empty value |
4184 return ft; |
4207 return ft; |
4185 } |
4208 } |
4186 |
4209 |
4378 // TopPTR, Null, AnyNull, Constant are all singletons |
4401 // TopPTR, Null, AnyNull, Constant are all singletons |
4379 return (_offset == 0) && !below_centerline(_ptr); |
4402 return (_offset == 0) && !below_centerline(_ptr); |
4380 } |
4403 } |
4381 |
4404 |
4382 // Do not allow interface-vs.-noninterface joins to collapse to top. |
4405 // Do not allow interface-vs.-noninterface joins to collapse to top. |
4383 const Type *TypeKlassPtr::filter(const Type *kills) const { |
4406 const Type *TypeKlassPtr::filter_helper(const Type *kills, bool include_speculative) const { |
4384 // logic here mirrors the one from TypeOopPtr::filter. See comments |
4407 // logic here mirrors the one from TypeOopPtr::filter. See comments |
4385 // there. |
4408 // there. |
4386 const Type* ft = join(kills); |
4409 const Type* ft = join_helper(kills, include_speculative); |
4387 const TypeKlassPtr* ftkp = ft->isa_klassptr(); |
4410 const TypeKlassPtr* ftkp = ft->isa_klassptr(); |
4388 const TypeKlassPtr* ktkp = kills->isa_klassptr(); |
4411 const TypeKlassPtr* ktkp = kills->isa_klassptr(); |
4389 |
4412 |
4390 if (ft->empty()) { |
4413 if (ft->empty()) { |
4391 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) |
4414 if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface()) |