RFR: 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp
Thomas Schatzl
tschatzl at openjdk.java.net
Tue Feb 2 12:33:47 UTC 2021
On Tue, 2 Feb 2021 04:18:24 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> collectedHeap.hpp is included by 477 out of 1000 .o files in HotSpot. This file in turn includes many other complex header files.
>
> In many cases, an object file only directly includes this file via:
>
> - memAllocator.hpp (which does not actually use collectedHeap.hpp)
> - oop.inline.hpp and compressedOops.inline.hpp (only use collectedHeap.hpp in asserts via `Universe::heap()->is_in()`).
>
> By refactoring the above 3 files, we can reduce the .o files that include collectedHeap.hpp to 242.
>
> This RFE also removes the unnecessary inclusion of heapInspection.hpp from collectedHeap.hpp.
>
> Build time of HotSpot is reduced for about 1%.
>
> Tested with mach5: tier1, builds-tier2, builds-tier3, builds-tier4 and builds-tier5. Also locally: aarch64, arm, ppc64, s390, x86, and zero.
Checked a few includes for missing ones; obviously they are included transitively so add as you see fit.
src/hotspot/share/gc/shared/memAllocator.hpp line 30:
> 28: #include "memory/memRegion.hpp"
> 29: #include "oops/oopsHierarchy.hpp"
> 30: #include "runtime/thread.hpp"
`utilities/globalDefinitions.hpp` for `HeapWord` is missing.
src/hotspot/share/oops/compressedOops.inline.hpp line 28:
> 26: #define SHARE_OOPS_COMPRESSEDOOPS_INLINE_HPP
> 27:
> 28: #include "gc/shared/collectedHeap.hpp"
`utilities/globalDefinitions.hpp` for `*PTR_FORMAT` and others is missing.
src/hotspot/share/oops/oop.inline.hpp line 28:
> 26: #define SHARE_OOPS_OOP_INLINE_HPP
> 27:
> 28: #include "gc/shared/collectedHeap.hpp"
`utilities/globalDefinitions.hpp` for `HeapWord` is missing.
`globals.hpp` for some globals.
`oopsHierarchy.hpp` for `narrowKlass`
`utilties/debug.hpp` for `assert`
-------------
Marked as reviewed by tschatzl (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2347
More information about the hotspot-dev
mailing list