RFR: 8370220: C2: rename methods and improve documentation around get_ctrl and idom lazy updating/forwarding of ctrl and idom via dead ctrl nodes [v9]

Emanuel Peter epeter at openjdk.org
Wed Oct 22 06:49:05 UTC 2025


On Wed, 22 Oct 2025 06:33:54 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> When working on https://github.com/openjdk/jdk/pull/27889, I was irritated by the lack of documentation and suboptimal naming.
>> 
>> Here, I'm doing the following:
>> - Add more documentation, and improve it in other cases.
>> - Rename "lazy" methods: "lazy" could indicate that we delay it somehow until later, but it is unclear what is delayed.
>>   - `lazy_replace` -> `replace_ctrl_node_and_forward_ctrl_and_idom`
>>   - `lazy_update` -> `install_lazy_ctrl_and_idom_forwarding`
>> - Made some methods private, and added some additional asserts.
>> 
>> I'd be more than happy for even better names, and suggestions how to improve the documentation further :)
>> 
>> Related issues:
>> https://github.com/openjdk/jdk/pull/27889
>> https://github.com/openjdk/jdk/pull/15720
>
> Emanuel Peter has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Merge branch 'JDK-8370220-get-ctrl-documentation' of https://github.com/eme64/jdk into JDK-8370220-get-ctrl-documentation
>  - fix shenandoah replace for phis

src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp line 1780:

> 1778:             fix_memory_uses(u, n, n, c);
> 1779:           } else if (_phase->C->get_alias_index(u->adr_type()) == _alias) {
> 1780:             _phase->igvn().replace_node(u, n);

As far as I can see, the `lazy_replace` only did `igvn.replace_node` for non-ctrl nodes anyway. Since we are dealing with `PhiNode`s here, we might as well only use `igvn.replace_node`.

I discovered this, because it hit my `!old_node->is_CFG()` check.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27892#discussion_r2450605644


More information about the shenandoah-dev mailing list