RFR: 8374549: Extend MetaspaceClosure to cover non-MetaspaceObj types [v2]
Ioi Lam
iklam at openjdk.org
Mon Jan 26 18:43:39 UTC 2026
On Fri, 23 Jan 2026 19:52:23 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:
>> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 19 additional commits since the last revision:
>>
>> - @ashu-mehra review comment -- make data_addr() function protected
>> - Merge branch 'master' into 8374549-extend-MetaspaceClosure-to-cover-non-MetaspaceObj-types
>> - More clean up -- MetaspaceObj::Type -> MetaspaceClosureType
>> - clean up
>> - Remove test code inside HotSpot for OtherCArrayRef and MSOCArrayRef
>> - Added OtherCArrayRef and MSOCArrayRef
>> - Removed old code that explicitly convert between GrowableArray and Array
>> - Finished copying and clean up of PackageEntry, ModuleEntry and their growable arrays. These are not actually used by the production run yet
>> - clean up
>> - rename size() to size_in_heapwords() for types that are not MetaspaceObj
>> - ... and 9 more: https://git.openjdk.org/jdk/compare/a349f96e...5dd8b690
>
> src/hotspot/share/utilities/growableArray.hpp line 302:
>
>> 300:
>> 301: // MetaspaceClosure support.
>> 302: E** data_addr() {
>
> My only concern is that it is marked public which breaks encapsulation. I think we can mark it as protected if only `AOTGrowableArray` is accessing it but gtest also uses it so I am not sure if anything can be done here.
I moved the `data_addr()` function to `protected`. I had to modify the gtests a little to avoid using this function (as I didn't want to add messy `friend class` declarations), but I think we are still able to test all the relevant behaviors.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29049#discussion_r2728796185
More information about the hotspot-dev
mailing list