RFR: 8337282: Speed up StringConcat with more simpleConcat
Chen Liang
liach at openjdk.org
Fri Jul 26 16:04:46 UTC 2024
On Fri, 26 Jul 2024 15:56:14 GMT, Shaojin Wen <duke at openjdk.org> wrote:
> StringConcatFactory improves startup speed and running performance through simpleConcat, but simpleConcat is currently given priority and only supports the following scenarios:
>
> // x instanceof Object
> prefix + x
> x = subfix
>
> // x instanceof Object && z instanceof Object
> x + y
>
>
> This PR improves startup and running performance by supporting more scenarios including
>
> // x instanceof byte/short/int/char/boolean/float/double
> prefix + x
> x + suffix
>
> // x instanceof byte/short/int/char/boolean/float/double/Integer/Long/Object
> prefix + suffix
>
> // x instanceof Object
> x + y + suffix
>
> // x instanceof Object
> x + y + suffix
I think instead of writing all these code out explicitly, we will instead aim for an approach more like `LambdaForm.Holder` or `DirectMethodHandle.Holder`; tools like `jlink` can generate these methods via `GenerateJLIClassesHelper` generating bytecode, which can be referred to by `StringConcatFactory`.
Alternatively, we might check `VarHandles.GuardMethodGenerator`, where we have a dedicated generated file `VarHandleGuards` with "DO NOT EDIT" comments, also used the same way by MethodHandle linking.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20355#issuecomment-2253058550
More information about the core-libs-dev
mailing list