RFR: 8347555: [REDO] C2: implement optimization for series of Add of unique value [v7]

Emanuel Peter epeter at openjdk.org
Wed Apr 2 10:34:52 UTC 2025


On Tue, 25 Mar 2025 16:18:20 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:

>> This looks really interesting!
>> 
>> I see that you are doing some special pattern matching. I wonder if it might be worth generalizing the algorithm, to search through an arbitrary "tree" of additions, collect all "leaves" of (`variable * multiplier`), sort by `variable`, and compute new additions for each `variable`. What do you think?
>
> @eme64 Could you please take a look at this if you have some time? Thanks!

@tabjy One more comment: I have had bad experiences before with pattern matching that only covered a part of the cases, and where methods did sometimes do more than what they promised in their name or documentation. These things tend to get extended later, and the overview gets worse and worse until nobody has the overview and bugs creep in that are hard to discover in a review.

Can you do some experimenting and see if you can come up with a cleaner design? Maybe write down at the beginning in `convert_serial_additions` what is the general form of the patterns you cover?

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

PR Comment: https://git.openjdk.org/jdk/pull/23506#issuecomment-2772140252


More information about the hotspot-compiler-dev mailing list