JVMTI invokedynamic bytecode parsing

Alan Bateman Alan.Bateman at oracle.com
Wed Aug 17 07:13:42 UTC 2022



On 16/08/2022 23:37, Chris Plummer wrote:
> I'm no expert in this area, especially regarding invokedynamic and 
> bootstrap methods attributes. I see from the JVM spec that you are 
> referring to the constant pool BootstrapMethods attribute. Also from 
> the JVM spec I see that there are other attributes that JVMTI does not 
> provide any special access to. Some you can get with various JVMTI 
> APIs, like GetLocalVariableTable, which gives you the part of the 
> LocalVariableTable attribute that is relevant to the specified method. 
> But there are attributes that don't have any special APIs to access, 
> such as NestHost, NestMembers, Record, or PermittedSubclasses,
>
> What might work for you is to just to fetch the constant pool using 
> GetConstantPool, and get the BootstrapMethods attribute from it.

Right now, to get the class bytes you have to set a CFLH, re-run the 
transformation pipeline with RetransformClasses and have the CFLH 
capture the bytes. I think there were a requests for a GetClassfile like 
API at one point.

-Alan


More information about the serviceability-dev mailing list