RFR: 8309979: BootstrapMethods attribute is missing in class files recreated by SA [v2]

Ashutosh Mehra duke at openjdk.org
Wed Jun 21 13:36:08 UTC 2023


On Wed, 21 Jun 2023 12:47:10 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

>> Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review comments by plummercj
>>   
>>   Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java line 756:
> 
>> 754:                 }
>> 755:             }
>> 756:         }
> 
> Hi, it looks odd to me that we only write one short in the loop: should that be a bootstrap method ref, num arguments, and arguments?
> 
> I was comparing with: https://docs.oracle.com/javase/specs/jvms/se20/jvms20.pdf
> 4.7.23 The BootstrapMethods Attribute
> 
> We have bootstrap attribute written by other code, e.g.
> "src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java" 
> visitBootstrapMethods
> 
> "src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java" 
> writeBootstrapMethods

This is because the array returned by getBootstrapMethodAt() includes bootstrap method ref, num arguments and arguments. getBootstrapMethodAt() gets all the pieces and assembles them in the array which is then written out in this loop. There is already getBootstrapSpecifierAt() which is doing the same thing. So I just reused that implementation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14495#discussion_r1237011431


More information about the serviceability-dev mailing list