RFR: 8372040: Remove Prefetch header vs inline header separation

Kim Barrett kbarrett at openjdk.org
Wed Jan 7 18:54:39 UTC 2026


On Wed, 7 Jan 2026 17:47:47 GMT, jonghoonpark <duke at openjdk.org> wrote:

> related jira issue: https://bugs.openjdk.org/browse/JDK-8372040
> 
> ---
> 
> ## Changes
> 
> - Merged `prefetch.hpp` into `prefetch.inline.hpp` and removed the redundant `prefetch.hpp`. Updated all call sites accordingly.
> - Removed `runtime/prefetch.inline.hpp` from `generation.hpp` to adhere to the rule that standard headers should not include inline headers.
>     - Added the inclusion of `runtime/prefetch.inline.hpp` to `cardTableRS.cpp` instead.
> - Removed `runtime/prefetch.hpp` from `g1YoungGCPostEvacuateTasks.cpp` as it is already included via `g1HeapRegion.inline.hpp`.
> 
> ---
> 
> Verified with tier1 testing; no regressions found.

Changes requested by kbarrett (Reviewer).

src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp line 49:

> 47: #include "oops/compressedOops.inline.hpp"
> 48: #include "oops/oop.inline.hpp"
> 49: #include "runtime/prefetch.hpp"

This file uses Prefetch, so should be including the inline header.

[from the PR description]
> Removed runtime/prefetch.hpp from g1YoungGCPostEvacuateTasks.cpp as it is already included via g1HeapRegion.inline.hpp.

We prefer being explicit about inclusions ("Include What You Use") rather than depending on
indirect inclusions like that, that break things when one refactors the indirect source of the
include.  There's an open JBS issue for updating the HotSpot Style Guide for this:
https://bugs.openjdk.org/browse/JDK-8252896.
Lots of violations, but please don't knowingly add them.  It would help a lot if we had tooling
support.

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

PR Review: https://git.openjdk.org/jdk/pull/29096#pullrequestreview-3636287122
PR Review Comment: https://git.openjdk.org/jdk/pull/29096#discussion_r2669656101


More information about the hotspot-dev mailing list