RFR: 8357220: Introduce a BSMAttributeEntry struct

Johan Sjölen jsjolen at openjdk.org
Tue May 20 06:36:55 UTC 2025


On Mon, 19 May 2025 17:49:59 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Hi,
>> 
>>  The constant pool currently has a lot of methods specific to extracting parts of the operands array. What this array actually is, is a sequence of bootstrap method attribute entries, where each entry has the following components:
>> 
>> ```c++
>> struct BSMAE {
>>   u2 bootstrap_method_index;
>>   u2 argument_count;
>>   u2 arguments[argument_count];
>> }
>> 
>> 
>> We can removes some of these operands array specific methods, and instead allows you to extract BSMAttributeEntrys which you can then use to extract its piece wise components. This makes for a nicer interface, and a bit easier to come into as a reader of the code, as it more closely mirrors the JVMS. 
>> 
>> Please consider!
>> 
>> Testing: Currently GHA, running tier1-tier3
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPool.java line 126:
> 
>> 124:   private static int INDY_BSM_OFFSET = 0;
>> 125:   private static int INDY_ARGC_OFFSET = 1;
>> 126:   private static int INDY_ARGV_OFFSET = 2;
> 
> Is the SA code that references these fields still correct? It seems the references are from the ClassWriter, which we don't have very good test coverage for. Probably this is a bug that is not being detected.

The references are still correct, as we haven't changed the struct layout. We're also not planning on doing so. I don't think that there is a bug here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25298#discussion_r2097067592


More information about the hotspot-dev mailing list