RFR: 8365245: Move size reducing operations to GrowableArrayWithAllocator

Kim Barrett kbarrett at openjdk.org
Sun Aug 17 12:57:11 UTC 2025


On Fri, 15 Aug 2025 13:58:57 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Please review this change to GrowableArray to move size reducing operations
>> from GrowableArrayBase and GrowableArrayView to GrowableArrayWithAllocator.
>> See JBS for rationale for this move.
>> 
>> This is mostly just a simple code motion change, with the moved functions
>> being updated to account for different name lookup rules now that they are in
>> a class with a class template base class. For the most part this refactoring
>> didn't require any client code changes. All but one use of one moved function
>> was with a GrowableArrayWithAllocator-derived class, so not affected by moving
>> the functions. The one exception was a test of ZArraySlice that was modified
>> to no longer use GA::pop().
>> 
>> Testing: mach5 tier1.
>
> As I've understood, the need for moving len-reducing operations to the GAWA class comes from the (future) need to be able to destruct elements when they go out of range.
> 
> In other words, when an element is popped in the future it should be destructed and freed by the allocator. This PR is a stepping stone to that kind of change.
> 
> Considering that, I think that it's correct to move these methods to GAWA and so I'm approving this PR.
> 
> Thanks!

Thanks for reviews @jdksjolen and @stefank

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

PR Comment: https://git.openjdk.org/jdk/pull/26726#issuecomment-3194369302


More information about the hotspot-dev mailing list