summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/Windows/Memory.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/Windows/Memory.inc b/llvm/lib/Support/Windows/Memory.inc
index 0e961fdeaad..b1d68596f5c 100644
--- a/llvm/lib/Support/Windows/Memory.inc
+++ b/llvm/lib/Support/Windows/Memory.inc
@@ -135,8 +135,9 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes,
DWORD Protect = getWindowsProtectionFlags(Flags);
+ size_t AllocSize = NumBlocks * Granularity;
void *PA = ::VirtualAlloc(reinterpret_cast<void *>(Start),
- NumBlocks * Granularity, AllocType, Protect);
+ AllocSize, AllocType, Protect);
if (PA == NULL) {
if (NearBlock || HugePages) {
// Try again without the NearBlock hint and without large memory pages
@@ -148,11 +149,11 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes,
MemoryBlock Result;
Result.Address = PA;
- Result.Size = NumBlocks*Granularity;
+ Result.Size = NumBytes;
Result.Flags = (Flags & ~MF_HUGE_HINT) | (HugePages ? MF_HUGE_HINT : 0);
if (Flags & MF_EXEC)
- Memory::InvalidateInstructionCache(Result.Address, Result.Size);
+ Memory::InvalidateInstructionCache(Result.Address, AllocSize);
return Result;
}
OpenPOWER on IntegriCloud