Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,24 @@

// Included in runtime/prefetch.inline.hpp

#include <intrin.h>

// __prefetch2(addr, prfop) emits a PRFM instruction.
// The prfop encoding is: <type><target><policy>
// type: PLD = 00, PLI = 01, PST = 10
// target: L1 = 00, L2 = 01, L3 = 10
// policy: KEEP = 0, STRM = 1

inline void Prefetch::read (const void *loc, intx interval) {
if (interval >= 0) {
__prefetch2((const char*) loc + interval, /* PLD + L1 + KEEP */ 0);
Copy link
Copy Markdown
Author

@raneashay raneashay Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm whether loc and interval should be added and whether this initiates the prefetch or ensures that it is completed before the call returns.

}
}

inline void Prefetch::write(void *loc, intx interval) {
if (interval >= 0) {
__prefetch2((char*) loc + interval, /* PST + L1 + KEEP */ 16);
}
}

#endif // OS_CPU_WINDOWS_AARCH64_PREFETCH_WINDOWS_AARCH64_INLINE_HPP
11 changes: 9 additions & 2 deletions src/hotspot/os_cpu/windows_x86/prefetch_windows_x86.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@

// Included in runtime/prefetch.inline.hpp

inline void Prefetch::read (const void *loc, intx interval) {}
inline void Prefetch::write(void *loc, intx interval) {}
#include <xmmintrin.h>

inline void Prefetch::read (const void *loc, intx interval) {
_mm_prefetch((const char*) loc + interval, _MM_HINT_T0);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding the condition interval >= 0.

}

inline void Prefetch::write(void *loc, intx interval) {
_mm_prefetch((const char*) loc + interval, _MM_HINT_T0);
}

#endif // OS_CPU_WINDOWS_X86_PREFETCH_WINDOWS_X86_INLINE_HPP