RFR: 8320725: C2: Add "is_associative" flag for floating-point add-reduction [v3]

Bhavana Kilambi bkilambi at openjdk.org
Wed Apr 3 11:12:25 UTC 2024


On Fri, 22 Mar 2024 05:41:01 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Hi, what is the reason to declare it as a `const`? It is declared as a `private` member variable with no "setter" function either. It is not easy to modify this value from any other part of the code anyway.
>
> Generally, it is better to declare things `const` if they can be. It tells the reader of the code that the field will never be changed. Even if things are fine now, a future contributor might misunderstand how the field is to be used, and start modifying it in a `Ideal` method for example.
> But if it is not simple to make it `const` for some reason, then don't do it.

Thanks for the explanation. I agree with you and have made the changes in the new PS.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18034#discussion_r1549500514


More information about the hotspot-compiler-dev mailing list