RFR: 8261868: Reduce inclusion of metaspace.hpp [v2]

Thomas Stuefe stuefe at openjdk.java.net
Wed Feb 17 07:57:40 UTC 2021


On Wed, 17 Feb 2021 07:31:12 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> metaspace.hpp is included by about 770 out of 1000 HotSpot .o files. Most of these are transitively included via array.hpp and classLoaderData.hpp.
>> 
>> - classLoaderData.hpp doesn't actually need metaspace.hpp.
>> - array.hpp can be refactored to put a function that depends on metaspace.hpp into array.inline.hpp
>> 
>> Doing the above reduces the number of .o files that include metaspace.hpp to 343. Since this is still a significant number, we should split out the rarely used classes (such as `MetaspaceGC` and `MetaspaceUtils`) into a new header file (metaspaceUtils.hpp, which is included only 30 times).
>> 
>> Also, these 3 includes can now be removed from metaspace.hpp.
>> 
>> #include "memory/memRegion.hpp"
>> #include "memory/metaspaceChunkFreeListSummary.hpp"
>> #include "memory/virtualspace.hpp"
>> 
>> Tested with mach5: tier1, builds-tier2, builds-tier3, builds-tier4 and builds-tier5. Also locally: aarch64, arm, ppc64, s390, x86, and zero.
>> 
>> (I also fixed an unrelated comment in archiveUtils.cpp when I was scanning for the word "Metaspace" in the source files -- the function `MetaspaceShared::commit_to()` no longer exists).
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed ppc/s390 builds

Hi Ioi,

this is very appreciated.

metaspace.hpp is still a bit of a mess. Its the last holdover for the old metaspace implementation and I always wanted to clean it out a bit. Splitting this header into three is a right step.

A lot of that stuff may still vanish and/or be reformed if I have the time (eg metaspaceChunkFreeListSummary).

Assuming this builds and tests fine on all our platform, including the weirder ones, I am fine with this patch. It looks good.

Thanks, Thomas

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

Marked as reviewed by stuefe (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2599


More information about the shenandoah-dev mailing list