On Mon, 22 Jul 2024 07:24:08 GMT, Shaojin Wen <d...@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.
>
>> > 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.
> 
> @liach  Can you give a sample code?

@wenshao Answered at 
https://github.com/openjdk/jdk/pull/20273#issuecomment-2243101199 since this 
question is more closely related to that patch.

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

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

Reply via email to