RFR: 8347901: C2 should remove unused leaf / pure runtime calls [v3]
Marc Chevalier
mchevalier at openjdk.org
Thu Jul 3 08:21:41 UTC 2025
On Wed, 2 Jul 2025 14:35:26 GMT, Benoît Maillard <bmaillard at openjdk.org> wrote:
>> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>>
>> mostly comments
>
> src/hotspot/share/opto/parse2.cpp line 1100:
>
>> 1098: Node* Parse::floating_point_mod(Node* a, Node* b, BasicType type) {
>> 1099: assert(type == BasicType::T_FLOAT || type == BasicType::T_DOUBLE, "only float and double are floating points");
>> 1100: CallLeafPureNode* mod = type == BasicType::T_DOUBLE ? static_cast<CallLeafPureNode*>(new ModDNode(C, a, b)) : new ModFNode(C, a, b);
>
> May I ask why we only need the `static_cast` for the `ModDNode` here?
It's C/C++ being annoying here: both branches of the ternary must have the same type, or something compatible. If I remove the cast:
error: conditional expression between distinct pointer types 'ModDNode*' and 'ModFNode*' lacks a cast
With the case, C++ can converrt the `ModFNode*` into a `CallLeafPureNode*` just fine.
I didn't invent the cast, it was here before, but good to question it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25760#discussion_r2182166387
More information about the hotspot-compiler-dev
mailing list