2403 // by oopDesc::field_base. 2404 assert(Unsafe_field_offset_to_byte_offset(11) == 11, 2405 "fieldOffset must be byte-scaled"); 2406 // 32-bit machines ignore the high half! 2407 offset = ConvL2X(offset); 2408 adr = make_unsafe_address(base, offset); 2409 heap_base_oop = base; 2410 val = is_store ? argument(4) : NULL; 2411 } else { 2412 Node* ptr = argument(1); // type: long 2413 ptr = ConvL2X(ptr); // adjust Java long to machine word 2414 adr = make_unsafe_address(NULL, ptr); 2415 val = is_store ? argument(3) : NULL; 2416 } 2417 2418 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); 2419 2420 // Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM, 2421 // there was not enough information to nail it down. 2422 Compile::AliasType* alias_type = C->alias_type(adr_type); 2423 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); 2424 2425 assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || 2426 alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); 2427 bool mismatched = false; 2428 BasicType bt = alias_type->basic_type(); 2429 if (bt != T_ILLEGAL) { 2430 if (bt == T_BYTE && adr_type->isa_aryptr()) { 2431 // Alias type doesn't differentiate between byte[] and boolean[]). 2432 // Use address type to get the element type. 2433 bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); 2434 } 2435 if (bt == T_ARRAY || bt == T_NARROWOOP) { 2436 // accessing an array field with getObject is not a mismatch 2437 bt = T_OBJECT; 2438 } 2439 if ((bt == T_OBJECT) != (type == T_OBJECT)) { 2440 // Don't intrinsify mismatched object accesses 2441 return false; 2442 } 2443 mismatched = (bt != type); 2444 } 2445 2446 // First guess at the value type. 2447 const Type *value_type = Type::get_const_basic_type(type); 2448 2797 ShouldNotReachHere(); 2798 } 2799 2800 // Null check receiver. 2801 receiver = null_check(receiver); 2802 if (stopped()) { 2803 return true; 2804 } 2805 2806 // Build field offset expression. 2807 // We currently rely on the cookies produced by Unsafe.xxxFieldOffset 2808 // to be plain byte offsets, which are also the same as those accepted 2809 // by oopDesc::field_base. 2810 assert(Unsafe_field_offset_to_byte_offset(11) == 11, "fieldOffset must be byte-scaled"); 2811 // 32-bit machines ignore the high half of long offsets 2812 offset = ConvL2X(offset); 2813 Node* adr = make_unsafe_address(base, offset); 2814 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); 2815 2816 Compile::AliasType* alias_type = C->alias_type(adr_type); 2817 assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || 2818 alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); 2819 BasicType bt = alias_type->basic_type(); 2820 if (bt != T_ILLEGAL && 2821 ((bt == T_OBJECT || bt == T_ARRAY) != (type == T_OBJECT))) { 2822 // Don't intrinsify mismatched object accesses. 2823 return false; 2824 } 2825 2826 // For CAS, unlike inline_unsafe_access, there seems no point in 2827 // trying to refine types. Just use the coarse types here. 2828 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); 2829 const Type *value_type = Type::get_const_basic_type(type); 2830 2831 switch (kind) { 2832 case LS_get_set: 2833 case LS_cmp_exchange: { 2834 if (type == T_OBJECT) { 2835 const TypeOopPtr* tjp = sharpen_unsafe_type(alias_type, adr_type); 2836 if (tjp != NULL) { 2837 value_type = tjp; 2838 } 2839 } | 2403 // by oopDesc::field_base. 2404 assert(Unsafe_field_offset_to_byte_offset(11) == 11, 2405 "fieldOffset must be byte-scaled"); 2406 // 32-bit machines ignore the high half! 2407 offset = ConvL2X(offset); 2408 adr = make_unsafe_address(base, offset); 2409 heap_base_oop = base; 2410 val = is_store ? argument(4) : NULL; 2411 } else { 2412 Node* ptr = argument(1); // type: long 2413 ptr = ConvL2X(ptr); // adjust Java long to machine word 2414 adr = make_unsafe_address(NULL, ptr); 2415 val = is_store ? argument(3) : NULL; 2416 } 2417 2418 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); 2419 2420 // Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM, 2421 // there was not enough information to nail it down. 2422 Compile::AliasType* alias_type = C->alias_type(adr_type); 2423 BasicType bt = alias_type->basic_type(); 2424 2425 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); 2426 2427 // Only field, array element or unknown locations are supported. 2428 if (alias_type->adr_type() != TypeRawPtr::BOTTOM && 2429 alias_type->adr_type() != TypeOopPtr::BOTTOM && 2430 bt == T_ILLEGAL) { 2431 return false; 2432 } 2433 2434 bool mismatched = false; 2435 if (bt != T_ILLEGAL) { 2436 if (bt == T_BYTE && adr_type->isa_aryptr()) { 2437 // Alias type doesn't differentiate between byte[] and boolean[]). 2438 // Use address type to get the element type. 2439 bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); 2440 } 2441 if (bt == T_ARRAY || bt == T_NARROWOOP) { 2442 // accessing an array field with getObject is not a mismatch 2443 bt = T_OBJECT; 2444 } 2445 if ((bt == T_OBJECT) != (type == T_OBJECT)) { 2446 // Don't intrinsify mismatched object accesses 2447 return false; 2448 } 2449 mismatched = (bt != type); 2450 } 2451 2452 // First guess at the value type. 2453 const Type *value_type = Type::get_const_basic_type(type); 2454 2803 ShouldNotReachHere(); 2804 } 2805 2806 // Null check receiver. 2807 receiver = null_check(receiver); 2808 if (stopped()) { 2809 return true; 2810 } 2811 2812 // Build field offset expression. 2813 // We currently rely on the cookies produced by Unsafe.xxxFieldOffset 2814 // to be plain byte offsets, which are also the same as those accepted 2815 // by oopDesc::field_base. 2816 assert(Unsafe_field_offset_to_byte_offset(11) == 11, "fieldOffset must be byte-scaled"); 2817 // 32-bit machines ignore the high half of long offsets 2818 offset = ConvL2X(offset); 2819 Node* adr = make_unsafe_address(base, offset); 2820 const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); 2821 2822 Compile::AliasType* alias_type = C->alias_type(adr_type); 2823 BasicType bt = alias_type->basic_type(); 2824 2825 // Only field, array element or unknown locations are supported. 2826 if (alias_type->adr_type() != TypeRawPtr::BOTTOM && 2827 alias_type->adr_type() != TypeOopPtr::BOTTOM && 2828 bt == T_ILLEGAL) { 2829 return false; 2830 } 2831 if (bt != T_ILLEGAL && 2832 ((bt == T_OBJECT || bt == T_ARRAY) != (type == T_OBJECT))) { 2833 // Don't intrinsify mismatched object accesses. 2834 return false; 2835 } 2836 2837 // For CAS, unlike inline_unsafe_access, there seems no point in 2838 // trying to refine types. Just use the coarse types here. 2839 assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); 2840 const Type *value_type = Type::get_const_basic_type(type); 2841 2842 switch (kind) { 2843 case LS_get_set: 2844 case LS_cmp_exchange: { 2845 if (type == T_OBJECT) { 2846 const TypeOopPtr* tjp = sharpen_unsafe_type(alias_type, adr_type); 2847 if (tjp != NULL) { 2848 value_type = tjp; 2849 } 2850 } |