RFR: 8333893: Optimization for StringBuilder append boolean & null [v12]

Claes Redestad redestad at openjdk.org
Thu Jun 20 09:57:19 UTC 2024


On Mon, 17 Jun 2024 05:53:45 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> After PR https://github.com/openjdk/jdk/pull/16245, C2 optimizes stores into primitive arrays by combining values ​​into larger stores.
>> 
>> This PR rewrites the code of appendNull and append(boolean) methods so that these two methods can be optimized by C2.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Utf16 case remove `append first utf16 char`

src/java.base/share/classes/java/lang/StringLatin1.java line 832:

> 830:         // Don't use the putChar method, Its instrinsic will cause C2 unable to combining values into larger stores.
> 831:         long address  = Unsafe.ARRAY_BYTE_BASE_OFFSET + index;
> 832:         Unsafe UNSAFE = Unsafe.getUnsafe();

Perhaps better to put in a `private static final` field

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19626#discussion_r1647313459


More information about the hotspot-compiler-dev mailing list