RFR: 8333893: Optimization for StringBuilder append boolean & null [v20]
Claes Redestad
redestad at openjdk.org
Sun Oct 20 20:22:37 UTC 2024
On Fri, 18 Oct 2024 21:56:53 GMT, Shaojin Wen <swen 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 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 26 additional commits since the last revision:
>
> - Merge remote-tracking branch 'origin/optim_str_builder_append_202406' into optim_str_builder_append_202406
> - fix build error
> - 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 'origin/optim_str_builder_append_202406' 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
> - revert test
> - Merge remote-tracking branch 'upstream/master' into optim_str_builder_append_202406
> - Merge remote-tracking branch 'upstream/master' into optim_str_builder_append_202406
> - ... and 16 more: https://git.openjdk.org/jdk/compare/ea332e42...457735c9
Hmm, I would have hoped for `appendNull` the pre-existing code would have allowed for merging stores with #19970. Can you run with `+TraceMergeStores` on the #19970 branch?
Perhaps we'd need to minimally change from `count++` increments to constant offsets:
val[count] = 'n';
val[count + 1] = 'u';
val[count + 2] = 'l';
val[count + 3] = 'l';
(I think it would be good to explore if we can to trigger the optimization without resorting to `Unsafe`. Any ideas, @eme64?)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19626#issuecomment-2425202938
More information about the core-libs-dev
mailing list