RFR: 8357220: Introduce a BSMAttributeEntry struct [v4]

Serguei Spitsyn sspitsyn at openjdk.org
Wed Jun 18 02:50:36 UTC 2025


On Mon, 9 Jun 2025 13:58:09 GMT, Johan Sjölen <jsjolen 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
>
> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Move it to public

src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 686:

> 684: 
> 685:   for (int i = 0; i < argc; i++) {
> 686:     u2 old_arg_ref_i = scratch_cp->bsm_attribute_entry(old_bs_i)->argument_index(i);

Nit: Could you, consider below for a code simplification? :

  BSMAttributeEntry* old_bsme = scratch_cp->bsm_attribute_entry(old_bs_i);
. . .
665  u2 old_ref_i = old_bsme->bootstrap_method_index();
. . .
679  u2 argc = old_bsme->argument_count();
. . .
686    u2 old_arg_ref_i = old_bsme->argument_index(i);

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

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


More information about the serviceability-dev mailing list