[llvm] r355067 - Fix SupportTests.exe/AllocationTests/MappedMemoryTest.AllocAndReleaseHuge when the machine doesn't have large pages enabled.
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 27 19:42:07 PST 2019
Author: aganea
Date: Wed Feb 27 19:42:07 2019
New Revision: 355067
URL: http://llvm.org/viewvc/llvm-project?rev=355067&view=rev
Log:
Fix SupportTests.exe/AllocationTests/MappedMemoryTest.AllocAndReleaseHuge when the machine doesn't have large pages enabled.
Modified:
llvm/trunk/lib/Support/Windows/Memory.inc
Modified: llvm/trunk/lib/Support/Windows/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Memory.inc?rev=355067&r1=355066&r2=355067&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Memory.inc (original)
+++ llvm/trunk/lib/Support/Windows/Memory.inc Wed Feb 27 19:42:07 2019
@@ -110,16 +110,16 @@ MemoryBlock Memory::allocateMappedMemory
return MemoryBlock();
static size_t DefaultGranularity = getAllocationGranularity();
- static Optional<size_t> LargePageGranularity = enableProcessLargePages();
+ static size_t LargePageGranularity = enableProcessLargePages();
DWORD AllocType = MEM_RESERVE | MEM_COMMIT;
bool HugePages = false;
size_t Granularity = DefaultGranularity;
- if ((Flags & MF_HUGE_HINT) && LargePageGranularity.hasValue()) {
+ if ((Flags & MF_HUGE_HINT) && LargePageGranularity > 0) {
AllocType |= MEM_LARGE_PAGES;
HugePages = true;
- Granularity = *LargePageGranularity;
+ Granularity = LargePageGranularity;
}
size_t NumBlocks = (NumBytes + Granularity - 1) / Granularity;
More information about the llvm-commits
mailing list