RFR: 8372040: Remove Prefetch header vs inline header separation

jonghoonpark duke at openjdk.org
Wed Jan 7 19:04:19 UTC 2026


On Wed, 7 Jan 2026 18:37:08 GMT, Kim Barrett <kbarrett 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.
>
> 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.

@kimbarrett Thank you for your feedback.

Understood.

Since `prefetch.hpp` has been merged into `prefetch.inline.hpp`, I will update to explicitly include `prefetch.inline.hpp`

Does this approach align with what you have in mind?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29096#discussion_r2669731103


More information about the hotspot-dev mailing list