RFR: 8336831: Optimize StringConcatHelper.simpleConcat [v5]

Chen Liang liach at openjdk.org
Sat Jul 20 06:44:34 UTC 2024


On Sat, 20 Jul 2024 06:28:12 GMT, Shaojin Wen <duke at openjdk.org> wrote:

> If code is generated through ClassFile, how to access the private methods of classes such as String/StringConcatHelper?

In that case, you have to encode those methods as live `MethodHandle` objects, passed to the generated class with `defineHiddenClassWithClassData` (just pass the class data object)
They can be retrieved in generated code with a CONDY using `MethodHandles.classData`. (This is how the MethodHandle LambdaForm classes referred to other MethodHandles)

----

You don't really need to worry about experimenting with bytecode generation right now. This patch as is is very good, and tier 1-3 tests pass. Bytecode gen is aimed at more complex scenarios with multiple constants and various types of arguments instead of this simple concat case.

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

PR Comment: https://git.openjdk.org/jdk/pull/20253#issuecomment-2240961431


More information about the core-libs-dev mailing list