RFR: 8327963: C2: fix construction of memory graph around Initialize node to prevent incorrect execution if allocation is removed [v15]
    Emanuel Peter 
    epeter at openjdk.org
       
    Fri Oct 24 09:56:25 UTC 2025
    
    
  
On Fri, 24 Oct 2025 09:40:45 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> src/hotspot/share/opto/memnode.hpp line 1424:
>> 
>>> 1422:   template <class Callback> ProjNode* apply_to_narrow_mem_projs(DUIterator& i, Callback callback) const {
>>> 1423:     return apply_to_narrow_mem_projs_any_iterator<Callback, UsesIterator>(UsesIterator(i, this), callback);
>>> 1424:   }
>> 
>> Do we really need to have a `public` API where we can pass in an iterator? What if someone uses it with an iterator for the wrong node?
>> 
>> The only use for it seems to be [ConnectionGraph::split_unique_types](https://github.com/openjdk/jdk/pull/24570/files#diff-03f7ae3cf79ff61be6e4f0590b7809a87825b073341fdbfcf36143b99c304474R4467) with `DUIterator`.
>> 
>> Is there a reason you want to pass the iterator explicitly?
>
> Also: why does it return anything? What kind of callback is exected here? I think the public API deserves a bit of documentation.
The use in [ConnectionGraph::split_unique_types](https://github.com/openjdk/jdk/pull/24570/files#diff-03f7ae3cf79ff61be6e4f0590b7809a87825b073341fdbfcf36143b99c304474R4467) really does not need a return value, and also could work fine with a `callback` that return `void`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24570#discussion_r2459562042
    
    
More information about the hotspot-compiler-dev
mailing list