Re: RFR: 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp [v2]

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp [v2]

Ioi Lam-2
> 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.

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 three additional commits since the last revision:

 - @tschatzl and @stefank comments
 - Merge branch 'master' into 8260012-reduce-inclue-collectedHeap-heapInspection-hpp
 - 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2347/files
  - new: https://git.openjdk.java.net/jdk/pull/2347/files/a1bdc2f7..529e77e4

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2347&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2347&range=00-01

  Stats: 3635 lines in 268 files changed: 1458 ins; 983 del; 1194 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2347.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2347/head:pull/2347

PR: https://git.openjdk.java.net/jdk/pull/2347
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp [v2]

Ioi Lam-2
On Tue, 2 Feb 2021 12:09:22 GMT, Stefan Karlsson <[hidden email]> 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 three additional commits since the last revision:
>>
>>  - @tschatzl and @stefank comments
>>  - Merge branch 'master' into 8260012-reduce-inclue-collectedHeap-heapInspection-hpp
>>  - 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp
>
> src/hotspot/share/gc/shared/memAllocator.hpp line 30:
>
>> 28: #include "memory/memRegion.hpp"
>> 29: #include "oops/oopsHierarchy.hpp"
>> 30: #include "runtime/thread.hpp"
>
> If we want to, this could be changed to a forward declaration if we removed the default value (Thread* thread = Thread::current()) of the constructors. Not needed for this RFE though.

memAllocator.hpp is not included very often (only 65 out of ~1000 .o files), so I decided to leave it as is.

> src/hotspot/cpu/arm/frame_arm.cpp line 518:
>
>> 516:         obj = *(oop*)res_addr;
>> 517:       }
>> 518:       assert(obj == NULL || Universe::is_in_heap(obj), "sanity check");
>
> Could have been changed to is_in_heap_or_null.

Fixed

> src/hotspot/cpu/ppc/frame_ppc.cpp line 308:
>
>> 306:       case T_ARRAY: {
>> 307:         oop obj = *(oop*)tos_addr;
>> 308:         assert(obj == NULL || Universe::is_in_heap(obj), "sanity check");
>
> Could have been changed to is_in_heap_or_null.

Fixed. I also change other frame_<cpu>.cpp files to use is_in_heap_or_null.

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

PR: https://git.openjdk.java.net/jdk/pull/2347
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp [v2]

Ioi Lam-2
In reply to this post by Ioi Lam-2
On Tue, 2 Feb 2021 12:22:50 GMT, Thomas Schatzl <[hidden email]> 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 three additional commits since the last revision:
>>
>>  - @tschatzl and @stefank comments
>>  - Merge branch 'master' into 8260012-reduce-inclue-collectedHeap-heapInspection-hpp
>>  - 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp
>
> 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.

Fixed.

> 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.

Fixed.

> 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`

Fixed. Thanks for the review.

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

PR: https://git.openjdk.java.net/jdk/pull/2347
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp [v2]

Thomas Schatzl-4
In reply to this post by Ioi Lam-2
On Tue, 2 Feb 2021 12:30:51 GMT, Thomas Schatzl <[hidden email]> 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 three additional commits since the last revision:
>>
>>  - @tschatzl and @stefank comments
>>  - Merge branch 'master' into 8260012-reduce-inclue-collectedHeap-heapInspection-hpp
>>  - 8260012: Reduce inclusion of collectedHeap.hpp and heapInspection.hpp
>
> Checked a few includes for missing ones; obviously they are included transitively so add as you see fit.

Still good.

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

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