RFR: 8327963: C2: fix construction of memory graph around Initialize node to prevent incorrect execution if allocation is removed [v16]

Emanuel Peter epeter at openjdk.org
Tue Oct 28 17:13:03 UTC 2025


On Tue, 28 Oct 2025 16:55:39 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 57 commits:
>> 
>>  - review
>>  - Merge branch 'master' into JDK-8327963
>>  - review
>>  - Roberto's patches
>>  - review
>>  - Update src/hotspot/share/opto/macro.cpp
>>    
>>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>>  - Update src/hotspot/share/opto/macro.cpp
>>    
>>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>>  - Update src/hotspot/share/opto/graphKit.cpp
>>    
>>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>>  - Update src/hotspot/share/opto/graphKit.cpp
>>    
>>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>>  - Update src/hotspot/share/opto/multnode.hpp
>>    
>>    Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>
>>  - ... and 47 more: https://git.openjdk.org/jdk/compare/96259936...957be06e
>
> src/hotspot/share/opto/memnode.hpp line 1428:
> 
>> 1426:   template <class Callback> NarrowMemProjNode* apply_to_narrow_mem_projs(DUIterator& i, Callback callback) const {
>> 1427:     return apply_to_narrow_mem_projs_any_iterator<Callback, UsesIterator>(UsesIterator(i, this), callback);
>> 1428:   }
> 
> Is this one still needed?

It also seems that the upper two can be merged. Maybe all "overloadings" of `apply_to_narrow_mem_projs` can be merged, no? Or are there really multiple uses?

> src/hotspot/share/opto/multnode.hpp line 141:
> 
>> 139: 
>> 140:   // Same but for matching _con and _is_io_use
>> 141:   template <class Callback> ProjNode* apply_to_projs(Callback callback, uint which_proj, bool is_io_use) const;
> 
> Do these need to be `public`? Or could they be `protected`, so they are only available to subtypes?
> 
> And do we really need all the variants of `apply_to_projs`, or could we collapse them a little?

It is just a lot of boilerplate, would be nice if it was a little slicker ;)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24570#discussion_r2470349998
PR Review Comment: https://git.openjdk.org/jdk/pull/24570#discussion_r2470370657


More information about the hotspot-compiler-dev mailing list