RFR: 8339635: StringConcatFactory optimization for CompactStrings off
ExE Boss
duke at openjdk.org
Thu Sep 5 22:59:59 UTC 2024
On Tue, 27 Aug 2024 05:08:53 GMT, Shaojin Wen <swen at openjdk.org> wrote:
> A small optimization, when CompactStrings is turned off, the coder method is not generated, which improves the startup performance
The `JLA.stringInitCoder() != 0` check should probably be the first thing in this method, so that **C2** can reliably turn it into a `nop` when compact strings are off:
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 1204:
> 1202: * Returns null if no such parameter exists or CompactStrings is off.
> 1203: */
> 1204: private static MethodTypeDesc coderArgsIfMaybeUTF16(MethodType concatArgs) {
Suggestion:
private static MethodTypeDesc coderArgsIfMaybeUTF16(MethodType concatArgs) {
if (JLA.stringInitCoder() != 0) {
return null;
}
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 1214:
> 1212: }
> 1213:
> 1214: if (maybeUTF16Count == 0 || JLA.stringInitCoder() != 0) {
Suggestion:
if (maybeUTF16Count == 0) {
-------------
PR Review: https://git.openjdk.org/jdk/pull/20722#pullrequestreview-2262445378
PR Review Comment: https://git.openjdk.org/jdk/pull/20722#discussion_r1732390180
PR Review Comment: https://git.openjdk.org/jdk/pull/20722#discussion_r1732390401
More information about the core-libs-dev
mailing list