@@ -1024,26 +1024,24 @@ void mapped_file_region::unmapImpl() {
10241024void mapped_file_region::dontNeedImpl () {}
10251025
10261026void mapped_file_region::willNeedImpl () {
1027- #if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
1028- typedef struct _WIN32_MEMORY_RANGE_ENTRY {
1029- PVOID VirtualAddress;
1030- SIZE_T NumberOfBytes;
1031- } WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY;
1032- #endif
1033-
10341027 HMODULE kernelM = llvm::sys::windows::loadSystemModuleSecure (L" kernel32.dll" );
10351028 if (kernelM) {
1029+ struct MEMORY_RANGE_ENTRY {
1030+ PVOID VirtualAddress;
1031+ SIZE_T NumberOfBytes;
1032+ };
1033+
10361034 // PrefetchVirtualMemory is only available on Windows 8 and later. Since we
10371035 // still support compilation on Windows 7, we load the function dynamically.
10381036 typedef BOOL (WINAPI * PrefetchVirtualMemory_t)(
10391037 HANDLE hProcess, ULONG_PTR NumberOfEntries,
1040- _In_reads_ (NumberOfEntries) PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses,
1038+ _In_reads_ (NumberOfEntries) MEMORY_RANGE_ENTRY * VirtualAddresses,
10411039 ULONG Flags);
10421040 static const auto pfnPrefetchVirtualMemory =
10431041 (PrefetchVirtualMemory_t)::GetProcAddress (kernelM,
10441042 " PrefetchVirtualMemory" );
10451043 if (pfnPrefetchVirtualMemory) {
1046- WIN32_MEMORY_RANGE_ENTRY Range{Mapping, Size};
1044+ MEMORY_RANGE_ENTRY Range{Mapping, Size};
10471045 pfnPrefetchVirtualMemory (::GetCurrentProcess (), 1 , &Range, 0 );
10481046 }
10491047 }
0 commit comments