On Thu, 5 May 2022 03:17:35 GMT, Xiaohong Gong <xg...@openjdk.org> wrote:

>> src/hotspot/share/opto/vectorIntrinsics.cpp line 1363:
>> 
>>> 1361:       // Use the vector blend to implement the masked store. The 
>>> biased elements are the original
>>> 1362:       // values in the memory.
>>> 1363:       Node* mem_val = gvn().transform(LoadVectorNode::make(0, 
>>> control(), memory(addr), addr, addr_type, mem_num_elem, mem_elem_bt));
>> 
>> I'm sorry to say it, but I am pretty sure this is an invalid optimization.
>> See top-level comment for more details.
>
> Thanks for your comments! Yeah, this actually influences something due to the 
> Java Memory Model rules which I missed to consider more. I will try the 
> scatter ways instead. Thanks so much!

Yes, phantom store can write back stale unintended value and may create problem 
in multithreded applications since blending is done with an older loaded value.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8544

Reply via email to