RFR: 8333893: Optimization for StringBuilder append boolean & null

Chen Liang liach at openjdk.org
Mon Jun 10 15:59:11 UTC 2024


On Mon, 10 Jun 2024 12:12:58 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.

You are right, I was thinking about the case where you have 2 short variables, you should combine them into a long explicitly for C2 to generate a 4-byte write, otherwise it would be 2 2-bytes. Omitted the constant part which already eliminates this restriction.

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

PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2158743190


More information about the core-libs-dev mailing list