[code-reflection] RFR: 8373572: BytecodeGenerator throws UnsupportedOperationException for JavaOp.InvokeOp when invoke kind is SUPER.

Adam Sotona asotona at openjdk.org
Mon Dec 15 17:47:47 UTC 2025


On Mon, 15 Dec 2025 17:39:47 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> We cannot generate an invokespecial as it will result in a verify error, since the owner is not assignable to generated hidden class.
> 
> This patch constructs method handle via lookup.findSpecial using the lookup's class as the specialCaller.
> Original lookup is stored in class data of the constructed hidden class.

src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeGenerator.java line 814:

> 812:                                .invokevirtual(CD_MethodHandles_Lookup,
> 813:                                               "findSpecial",
> 814:                                               MethodTypeDesc.of(CD_MethodHandle, CD_Class, CD_String, CD_MethodType, CD_Class));

Performance can be improved (if necessary) by indexing of all resolved method handles and storing them in class data as a list.
Invoke code would not perform search for the method handle, but it will receive it directly from class data.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/752#discussion_r2620295479


More information about the babylon-dev mailing list