RFR: 8367972: ZGC: Reduce ZBarrierSet includes
Axel Boldt-Christmas
aboldtch at openjdk.org
Fri Sep 19 09:56:43 UTC 2025
[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
-------------
Commit messages:
- 8367972: ZGC: Reduce ZBarrierSet includes
Changes: https://git.openjdk.org/jdk/pull/27386/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27386&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8367972
Stats: 187 lines in 10 files changed: 114 ins; 50 del; 23 mod
Patch: https://git.openjdk.org/jdk/pull/27386.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27386/head:pull/27386
PR: https://git.openjdk.org/jdk/pull/27386
More information about the hotspot-dev
mailing list