RFR: 8368966: Remove spurious VMStructs friends
Stefan Karlsson
stefank at openjdk.org
Wed Oct 1 07:36:49 UTC 2025
On Tue, 30 Sep 2025 16:35:36 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:
> In this PR I propose a small clean up to remove several spurious friends of `VMStructs`. Either I could not find any reference to them in `vmStructs*`, or no private symbols is mentioned.
>
> Passes tier1 and tier2 (fastdebug).
src/hotspot/share/utilities/growableArray.hpp line 715:
> 713: template <typename E>
> 714: class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E>> {
> 715: friend class VMStructs;
I was a bit surprised to see that you added a friend declaration. Was this done because you removed the one in the parent class?
I see that vmStructs.cpp has GrowableArray listed:
nonstatic_field(GrowableArrayBase, _len, int) \
nonstatic_field(GrowableArrayBase, _capacity, int) \
nonstatic_field(GrowableArray<int>, _data, int*)
So, I guess it makes sense to move it here. OTOH, the exposed `_data` field is inside GrowableArrayView, so maybe it would work to put the friend declaration there instead?
I guess either way is fine but there's a risk that there will be some churn about where to put the friend declaration if someone wants add one of the classes between (and including) GrowableArrayView and GrowableArray.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27583#discussion_r2393707385
More information about the hotspot-dev
mailing list