RFR(S): 8238723: yank_alloc_node must remove membar

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Feb 20 15:59:45 UTC 2020


> And to address your concern on AddPs - I still haven't seen an example 
> on when they occur. How would the graph look? What is using the addP? So 
> far I have been content with asserting on addPs, and still hasn't found 
> any occurrence in our testing. But I want to be safe so I will change to 
> skip the allocation removal if there is an addP (but keep asserting in 
> debug builds)

InitializeNode attemps to convert stores into freshly allocated object 
into "initializing stores" to avoid redundant zeroing of the contents 
(see InitializeNode::capture_store() [1]). The comment provides an 
example of IR shape:

//   alloc = (Allocate ...)
//   rawoop = alloc.RawAddress
//   rawstore1 = (StoreC alloc.Control alloc.Memory (+ rawoop 12) 1)
//   rawstore2 = (StoreC alloc.Control alloc.Memory (+ rawoop 14) 2)
//   init = (Initialize alloc.Control alloc.Memory rawoop
//                      rawstore1 rawstore2)

Those stores should go away along with InitializeNode, so it should be 
safe to unlink them right away. So, I don't see a compelling reason to 
skip allocation removal in such case.

Best regards,
Vladimir Ivanov

http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/opto/memnode.cpp#l3803

> 
> // Nils
> 
> 
> 
> [1] 
> http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/opto/parse1.cpp#l1010 
> 
> 
>>
>> Sometimes MemBarRelease is added [1] which can degenerate into 
>> MemBarCPUOrder [2].
>>
>> I'd prefer to see all the barriers which are linked to the allocation 
>> be removed.
>>
>> Best regards,
>> Vladimir Ivanov
>>
>> [1] 
>> http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/opto/parse1.cpp#l1005 
>>
>>
>> [2] 
>> http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/opto/escape.cpp#l1912 
>>
>>
>>> On 2020-02-18 14:01, Tobias Hartmann wrote:
>>>> On 18.02.20 13:32, Vladimir Ivanov wrote:
>>>>> In case of MemBar I assume you are handling the precedence edge 
>>>>> (MemBarNode::Precedent). Why do you
>>>>> replace it with TOP? I assume you want to eliminate the barrier, 
>>>>> but I don't see how it helps.
>>>> Actually, you might want to use MemBarNode::remove.
>>>>
>>>> Best regards,
>>>> Tobias
> 


More information about the hotspot-compiler-dev mailing list