On Sat, 24 Aug 2024 06:27:26 GMT, Shaojin Wen <s...@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 with a new target base due to a > merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains 19 additional > commits since the last revision: > > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - replace unsafe with putChar > - Merge remote-tracking branch 'upstream/master' into > optim_str_builder_append_202406 > - private static final field `UNSAFE` > - Utf16 case remove `append first utf16 char` > - `delete` -> `setLength` > - copyright 2024 > - optimization for x64 > - ... and 9 more: https://git.openjdk.org/jdk/compare/381c1987...61196ecd src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 640: > 638: private AbstractStringBuilder appendNull() { > 639: ensureCapacityInternal(count + 4); > 640: int count = this.count; We should declare `count` before `ensureCapacitiyInternal`. Same for append boolean. test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java line 136: > 134: > 135: public static int putCharsAt(byte[] value, int i, char c1, char c2, > char c3, char c4) { > 136: return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4); Why do we remove the tests for UTF16? And should we add another set of test for LATIN1 too? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19626#discussion_r1769695101 PR Review Comment: https://git.openjdk.org/jdk/pull/19626#discussion_r1769694934