RFR: 8341696: C2: Non-fluid StringBuilder pattern bails out in OptoStringConcat [v3]

Emanuel Peter epeter at openjdk.org
Wed Dec 11 07:22:39 UTC 2024


On Wed, 4 Dec 2024 09:15:37 GMT, theoweidmannoracle <duke at openjdk.org> wrote:

>> Extends stringopts to also recognize non-fluid uses of StringBuilder and optimize them the same way.
>> 
>> For example, this basic case was not optimized before and is optimized with this PR:
>> 
>> 
>> StringBuilder sb = new StringBuilder();
>> sb.append("a");
>> sb.append(a);
>> return sb.toString();
>
> theoweidmannoracle has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Move test

test/hotspot/jtreg/compiler/stringopts/TestFluidAndNonFluid.java line 68:

> 66:     public static String fluidNoParam() {
> 67:         return new StringBuilder("0").append("a").append("c").toString();
> 68:     }

Drive by comment: you seem to only have negative `failOn` tests here. You could consider adding a test where you have a positive rule, just to make sure you are matching the correct IR nodes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22537#discussion_r1879474618


More information about the hotspot-compiler-dev mailing list