Integrated: 8367972: ZGC: Reduce ZBarrierSet includes

Axel Boldt-Christmas aboldtch at openjdk.org
Wed Sep 24 06:31:27 UTC 2025


On Fri, 19 Sep 2025 09:49:03 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> [JDK-8365053](https://bugs.openjdk.org/browse/JDK-8365053) made a fact which is already well known to ZGC developers clear. We pull in large parts of the ZGC implementation through the access API, via `zbarrierset.inline.hpp`.
> 
> ZGC developers are well aware as touching most `.hpp` or `inline.hpp` files in `gc/z` requires rebuilding most of hotspot in incremental builds.
> 
> I propose we create a boundary between the barrier set and the implementation. The main reason being making incremental builds less painful.
> 
> I experimented with this last year, at the time I saw no real difference in full build times, nor any performance regressions from not inlining the barrier implementation into the access API.
> 
> Will reevaluate the performance implications.
> 
> I ran the `bin/update_pch.sh` script, but with the default `MIN_MS` I saw the same list both before and after this change:
> ```c++
> #include "gc/g1/g1BarrierSet.inline.hpp"
> #include "gc/shenandoah/shenandoahHeap.inline.hpp"
> #include "memory/iterator.inline.hpp"
> #include "oops/access.hpp"
> #include "oops/access.inline.hpp"
> #include "oops/oop.inline.hpp"
> #include "utilities/globalDefinitions.hpp"
> 
> However when running with `MIN_MS` reduced by an order of magnitude `#include "gc/z/zBarrier.inline.hpp"` was included without this patch, and was excluded after with this patch.
> 
> Also cross-compiled ppc64le, s390x and riscv64 (fast debug). Could not find any missing includes, have not built all configurations. 
> 
> For some reason windows slow debug failed to build because `test/hotspot/gtest/runtime/test_os_windows.cpp` was missing `os_windows.hpp`, did not investigate further, but included `runtime/os.inline.hpp` in the test as it includes all OS and OS CPU specific declarations and inline definitions.
> 
> * Testing
>   * Tier 1 + ZGC tier 1-5 on Oracle supported platforms

This pull request has now been integrated.

Changeset: 30368668
Author:    Axel Boldt-Christmas <aboldtch at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/303686684c23db465ccfb6a9b4861a673bfa5f4b
Stats:     187 lines in 10 files changed: 114 ins; 50 del; 23 mod

8367972: ZGC: Reduce ZBarrierSet includes

Reviewed-by: stefank, eosterlund

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

PR: https://git.openjdk.org/jdk/pull/27386


More information about the hotspot-dev mailing list