RFR: 8372040: Remove Prefetch header vs inline header separation
Stefan Karlsson
stefank at openjdk.org
Wed Jan 7 20:34:33 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.
While looking at this one thing strikes me: with this change the platform-dependent .inline.hpp now stops being compilable stand-alone. That makes those files more obscure to read.
If we take a look at what the file looked like before this PR:
#ifndef OS_CPU_LINUX_X86_PREFETCH_LINUX_X86_INLINE_HPP
#define OS_CPU_LINUX_X86_PREFETCH_LINUX_X86_INLINE_HPP
include "runtime/prefetch.hpp"
inline void Prefetch::read (const void *loc, intx interval) {
...
}
inline void Prefetch::write(void *loc, intx interval) {
...
}
#endif // OS_CPU_LINUX_X86_PREFETCH_LINUX_X86_INLINE_HPP
Then a newcomer could read this and see that the structure made sense and that the class Prefetch came from the include of prefetch.hpp.
If we now look at the code after the PR:
#ifndef OS_CPU_LINUX_X86_PREFETCH_LINUX_X86_INLINE_HPP
#define OS_CPU_LINUX_X86_PREFETCH_LINUX_X86_INLINE_HPP
inline void Prefetch::read (const void *loc, intx interval) {
...
}
inline void Prefetch::write(void *loc, intx interval) {
...
}
#endif // OS_CPU_LINUX_X86_PREFETCH_LINUX_X86_INLINE_HPP
then I wouldn't be surprised if the casual reader would go "wait, what, where does the class Prefetch come from?".
I'm not convinced (yet) that this is a change that we want. I read the RFE report for this, but I'm not sure I understand the real motivation for this change. From the RFE it sounds like just removing the errant include in generation.hpp would be good enough.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29096#issuecomment-3720659662
More information about the hotspot-dev
mailing list