On Tue, 16 Sep 2025 10:11:09 GMT, Johan Sjölen <[email protected]> wrote:
>> Hi,
>>
>> This is a refactoring of the way that we store the Bootstrap method
>> attribute in the ConstantPool class. We used to have a single `Array<u2>`
>> which was divided into a section of `u4` offsets and a section which was the
>> actual data. In this refactoring we make this split more clear, by actually
>> allocating an `Array<u4>` to store the offsets in and an `Array<u2>` to
>> store the data in. These arrays are then put into a `BSMAttributeEntries`
>> class, which allows us to separate out the API from that of the rest of the
>> `ConstantPool`.
>>
>> We had multiple instances of the code knowing the layout of the operands
>> array and using this to do 'clever' ways of copying and inserting data into
>> it. See `ConstantPool::copy_operands` and `ConstantPool::resize_operands`. I
>> felt like we could do things in a simpler way, so I added the
>> `start_/end_extension` protocol and added the `InsertionIterator` for this.
>> See `ClassFileParser::parse_classfile_bootstrap_methods_attribute` for how
>> this works. I put several relevant definitions into the inline file in hopes
>> of encouraging the compiler to optimize these appropriately.
>>
>> For the Java SA code, I had to add a `U4Array` class. I also had to fix the
>> vmstructs definitions, etc.
>>
>> On the whole, while this code is a bit less terse, I think it's a good API
>> improvement and the underlying implementation of splitting up the operands
>> array is also an improvement.
>>
>> Testing: Oracle Tier1-Tier5 has been run succesfully multiple times. Before
>> integration, I will merge with master and run these tiers again.
>
> Johan Sjölen has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Fix type name
Updates look good - thanks. A couple of follow on nits and comments.
Still need to take full second pass through the code.
src/hotspot/share/oops/constantPool.cpp line 1830:
> 1828: bool ConstantPool::compare_bootstrap_entry_to(int idx1, const
> constantPoolHandle& cp2, int idx2) {
> 1829: const BSMAttributeEntry* const bsmae1 = bsm_attribute_entry(idx1);
> 1830: const BSMAttributeEntry* const bsmae2 =
> cp2->bsm_attribute_entry(idx2);
Suggestion:
const BSMAttributeEntry* const e1 = bsm_attribute_entry(idx1);
const BSMAttributeEntry* const e2 = cp2->bsm_attribute_entry(idx2);
Simple names can be used throughout.
src/hotspot/share/prims/jvmtiRedefineClasses.hpp line 371:
> 369: intArray * _bsm_index_map_p;
> 370:
> 371: // After merge_constant_pools pass 0, the BSMAttribute entries of
> merge_cp_p will have been expanded to fit
Suggestion:
// After merge_constant_pools "Pass 0", the BSMAttribute entries of
merge_cp_p will have been expanded to fit
-------------
PR Review: https://git.openjdk.org/jdk/pull/27198#pullrequestreview-3232321618
PR Review Comment: https://git.openjdk.org/jdk/pull/27198#discussion_r2354096048
PR Review Comment: https://git.openjdk.org/jdk/pull/27198#discussion_r2354103465