RFR: 8348411: C2: Remove the control input of LoadKlassNode and LoadNKlassNode

Vladimir Ivanov vlivanov at openjdk.org
Thu Jan 23 18:31:48 UTC 2025


On Thu, 23 Jan 2025 17:22:02 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

> Hi,
> 
> This patch removes the control input of `LoadKlassNode` and `LoadNKlassNode`. They can only have a control input if created inside `Parse::array_store_check()`, the reason given is:
> 
>     // We are allowed to use the constant type only if cast succeeded
> 
> But this seems incorrect, the load from the constant type can be done regardless, and it will be constant-folded. This patch only makes that more formal and cleanup `LoadKlassNode::can_remove_control`.
> 
> Please take a look and leave your reviews, thanks a lot.

src/hotspot/share/opto/parseHelper.cpp line 229:

> 227:   int element_klass_offset = in_bytes(ObjArrayKlass::element_klass_offset());
> 228:   Node* p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
> 229:   Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, immutable_memory(), p2, tak));

It looks like you are reverting the fix for JDK-8057622 here. How is it intended to work now?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23274#discussion_r1927470735


More information about the hotspot-compiler-dev mailing list