RFR(XS) 8178047: Aliasing problem with raw memory accesses
Vladimir Kozlov
vladimir.kozlov at oracle.com
Fri Apr 14 18:21:42 UTC 2017
On 4/14/17 10:31 AM, Igor Veresov wrote:
>
>> On Apr 14, 2017, at 9:53 AM, Vladimir Kozlov <vladimir.kozlov at oracle.com> wrote:
>>
>> Klass pointers should be also fine I think.
>> The problem is only Raw pointers which could point to the same memory but different offset.
>> May be use
>>
>> bool is_raw = adr->bottom_type()->isa_rawptr() != NULL;
>> ...
>> if (is_raw && st_base != base) {
>
> I guess in that case AnyPtr should be be also checked for, because it includes RawPtr, right?
Yes.
>
>>
>> Also what if pointer type is mixed: original is oop and mem node is raw?
>> May we should check that if when one of them is raw we should compare bases.
>
> Is it possible for that to happen?
May be not. Usually we will have membars around unsafe memory access. But if we have AnyPtr, as you said, it could be
mixed I think. I think it is better to check for such case even if it may not happen.
Vladimir
>
> igor
>
>>
>> Thanks,
>> Vladimir
>>
>> On 4/13/17 8:30 PM, Igor Veresov wrote:
>>> This seems like a long-standing bug. Analysis in MemNode::find_previous_store() tries to relax memory dependencies by proving that memory accesses don’t alias. The code is fine for oops: if [offset, offset+length) intervals don’t overlap it proves the accesses don’t alias because bases always point to the start of an object. For raw accesses that’s not true. Offset analysis doesn’t mean much without proving that bases are not the same.
>>>
>>> Webrev: http://cr.openjdk.java.net/~iveresov/8178047/webrev.00
>>>
>>> Thanks,
>>> igor
>>>
>
More information about the hotspot-compiler-dev
mailing list