[lworld] RFR: 8228361: [lworld] Optimize the substitutability check in C2 [v2]

Tobias Hartmann thartmann at openjdk.org
Thu Dec 18 15:25:18 UTC 2025


On Thu, 18 Dec 2025 13:51:35 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:

>> Tobias Hartmann has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 21 commits:
>> 
>>  - Merge branch 'lworld' into JDK-8228361
>>  - More refactoring, better comments
>>  - More comments, removing workaround
>>  - Merge
>>  - v5
>>  - Refactoring v4
>>  - Refactoring v3
>>  - Refactoring, more checks, new test
>>  - Merge branch 'lworld' into JDK-8228362
>>  - All tests pass
>>  - ... and 11 more: https://git.openjdk.org/valhalla/compare/3c41c2aa...4f8556c7
>
> src/hotspot/share/opto/inlinetypenode.cpp line 659:
> 
>> 657:     assert(is_reference_type(bt), "must be");
>> 658:     cmp = igvn->register_new_node_with_optimizer(new CmpPNode(val1, val2));
>> 659:   }
> 
> The following might be a bit cleaner and self-explanatory.
> Suggestion:
> 
>   if (is_single_word_type(bt)) {
>     if (bt == T_FLOAT) {
>       val1 = igvn->register_new_node_with_optimizer(new MoveF2INode(val1));
>       val2 = igvn->register_new_node_with_optimizer(new MoveF2INode(val2));
>     }
>     cmp = igvn->register_new_node_with_optimizer(new CmpINode(val1, val2));
>   } else if (is_double_word_type(bt)) {
>     if (bt == T_DOUBLE) {
>       val1 = igvn->register_new_node_with_optimizer(new MoveD2LNode(val1));
>       val2 = igvn->register_new_node_with_optimizer(new MoveD2LNode(val2));
>     }
>     cmp = igvn->register_new_node_with_optimizer(new CmpLNode(val1, val2));
>   } else {
>     assert(is_reference_type(bt), "must be");
>     cmp = igvn->register_new_node_with_optimizer(new CmpPNode(val1, val2));
>   }
> 
>  Note, this still needs an appropriate implementation for `is_single_word_type()` in `gobal_definitions.hpp`:
> ```c++
> inline bool is_integral_type(BasicType t) {
>   return is_subword_type(t) || t == T_INT || t == T_FLOAT;
> }

That's a good suggestion. I'll update the code accordingly!

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1823#discussion_r2631521349


More information about the valhalla-dev mailing list