2403 // Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM, |
2403 // Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM, |
2404 // there was not enough information to nail it down. |
2404 // there was not enough information to nail it down. |
2405 Compile::AliasType* alias_type = C->alias_type(adr_type); |
2405 Compile::AliasType* alias_type = C->alias_type(adr_type); |
2406 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); |
2406 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); |
2407 |
2407 |
2408 assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || |
2408 // Only field, array element or unknown locations are supported. |
2409 alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); |
2409 if (alias_type->adr_type() != TypeRawPtr::BOTTOM && |
|
2410 alias_type->adr_type() != TypeOopPtr::BOTTOM && |
|
2411 alias_type->basic_type() == T_ILLEGAL) { |
|
2412 return false; |
|
2413 } |
|
2414 |
2410 bool mismatched = false; |
2415 bool mismatched = false; |
2411 BasicType bt = alias_type->basic_type(); |
2416 BasicType bt = alias_type->basic_type(); |
2412 if (bt != T_ILLEGAL) { |
2417 if (bt != T_ILLEGAL) { |
2413 if (bt == T_BYTE && adr_type->isa_aryptr()) { |
2418 if (bt == T_BYTE && adr_type->isa_aryptr()) { |
2414 // Alias type doesn't differentiate between byte[] and boolean[]). |
2419 // Alias type doesn't differentiate between byte[] and boolean[]). |
2780 } |
2785 } |
2781 default: |
2786 default: |
2782 ShouldNotReachHere(); |
2787 ShouldNotReachHere(); |
2783 } |
2788 } |
2784 |
2789 |
2785 // Null check receiver. |
|
2786 receiver = null_check(receiver); |
|
2787 if (stopped()) { |
|
2788 return true; |
|
2789 } |
|
2790 |
|
2791 // Build field offset expression. |
2790 // Build field offset expression. |
2792 // We currently rely on the cookies produced by Unsafe.xxxFieldOffset |
2791 // We currently rely on the cookies produced by Unsafe.xxxFieldOffset |
2793 // to be plain byte offsets, which are also the same as those accepted |
2792 // to be plain byte offsets, which are also the same as those accepted |
2794 // by oopDesc::field_base. |
2793 // by oopDesc::field_base. |
2795 assert(Unsafe_field_offset_to_byte_offset(11) == 11, "fieldOffset must be byte-scaled"); |
2794 assert(Unsafe_field_offset_to_byte_offset(11) == 11, "fieldOffset must be byte-scaled"); |
2797 offset = ConvL2X(offset); |
2796 offset = ConvL2X(offset); |
2798 Node* adr = make_unsafe_address(base, offset); |
2797 Node* adr = make_unsafe_address(base, offset); |
2799 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); |
2798 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); |
2800 |
2799 |
2801 Compile::AliasType* alias_type = C->alias_type(adr_type); |
2800 Compile::AliasType* alias_type = C->alias_type(adr_type); |
2802 assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || |
|
2803 alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); |
|
2804 BasicType bt = alias_type->basic_type(); |
2801 BasicType bt = alias_type->basic_type(); |
2805 if (bt != T_ILLEGAL && |
2802 if (bt != T_ILLEGAL && |
2806 ((bt == T_OBJECT || bt == T_ARRAY) != (type == T_OBJECT))) { |
2803 ((bt == T_OBJECT || bt == T_ARRAY) != (type == T_OBJECT))) { |
2807 // Don't intrinsify mismatched object accesses. |
2804 // Don't intrinsify mismatched object accesses. |
2808 return false; |
2805 return false; |
2828 case LS_cmp_swap_weak: |
2825 case LS_cmp_swap_weak: |
2829 case LS_get_add: |
2826 case LS_get_add: |
2830 break; |
2827 break; |
2831 default: |
2828 default: |
2832 ShouldNotReachHere(); |
2829 ShouldNotReachHere(); |
|
2830 } |
|
2831 |
|
2832 // Null check receiver. |
|
2833 receiver = null_check(receiver); |
|
2834 if (stopped()) { |
|
2835 return true; |
2833 } |
2836 } |
2834 |
2837 |
2835 int alias_idx = C->get_alias_index(adr_type); |
2838 int alias_idx = C->get_alias_index(adr_type); |
2836 |
2839 |
2837 // Memory-model-wise, a LoadStore acts like a little synchronized |
2840 // Memory-model-wise, a LoadStore acts like a little synchronized |