summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2019-05-20 20:53:05 +0000
committerLang Hames <lhames@gmail.com>2019-05-20 20:53:05 +0000
commit93d2bdda6bfe287de7825cfac9224dcfe051b1c5 (patch)
tree7b876090b9f6357dc81e5c09f63addfe0993e528 /llvm/lib/Support/Windows
parent52fa90a348c1bed5ecbcc0965c57d67e5ec45d5a (diff)
downloadbcm5719-llvm-93d2bdda6bfe287de7825cfac9224dcfe051b1c5.tar.gz
bcm5719-llvm-93d2bdda6bfe287de7825cfac9224dcfe051b1c5.zip
[Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and OwningMemoryBlock.
Rename member 'Size' to 'AllocatedSize' in order to provide a hint that the allocated size may be different than the requested size. Comments are added to clarify this point. Updated the InMemoryBuffer in FileOutputBuffer.cpp to track the requested buffer size. Patch by Machiel van Hooren. Thanks Machiel! https://reviews.llvm.org/D61599 llvm-svn: 361195
Diffstat (limited to 'llvm/lib/Support/Windows')
-rw-r--r--llvm/lib/Support/Windows/Memory.inc14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/Support/Windows/Memory.inc b/llvm/lib/Support/Windows/Memory.inc
index b1d68596f5c..a67f9c7d0f3 100644
--- a/llvm/lib/Support/Windows/Memory.inc
+++ b/llvm/lib/Support/Windows/Memory.inc
@@ -125,7 +125,7 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes,
size_t NumBlocks = (NumBytes + Granularity - 1) / Granularity;
uintptr_t Start = NearBlock ? reinterpret_cast<uintptr_t>(NearBlock->base()) +
- NearBlock->size()
+ NearBlock->allocatedSize()
: 0;
// If the requested address is not aligned to the allocation granularity,
@@ -149,7 +149,7 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes,
MemoryBlock Result;
Result.Address = PA;
- Result.Size = NumBytes;
+ Result.AllocatedSize = AllocSize;
Result.Flags = (Flags & ~MF_HUGE_HINT) | (HugePages ? MF_HUGE_HINT : 0);
if (Flags & MF_EXEC)
@@ -159,31 +159,31 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes,
}
std::error_code Memory::releaseMappedMemory(MemoryBlock &M) {
- if (M.Address == 0 || M.Size == 0)
+ if (M.Address == 0 || M.AllocatedSize == 0)
return std::error_code();
if (!VirtualFree(M.Address, 0, MEM_RELEASE))
return mapWindowsError(::GetLastError());
M.Address = 0;
- M.Size = 0;
+ M.AllocatedSize = 0;
return std::error_code();
}
std::error_code Memory::protectMappedMemory(const MemoryBlock &M,
unsigned Flags) {
- if (M.Address == 0 || M.Size == 0)
+ if (M.Address == 0 || M.AllocatedSize == 0)
return std::error_code();
DWORD Protect = getWindowsProtectionFlags(Flags);
DWORD OldFlags;
- if (!VirtualProtect(M.Address, M.Size, Protect, &OldFlags))
+ if (!VirtualProtect(M.Address, M.AllocatedSize, Protect, &OldFlags))
return mapWindowsError(::GetLastError());
if (Flags & MF_EXEC)
- Memory::InvalidateInstructionCache(M.Address, M.Size);
+ Memory::InvalidateInstructionCache(M.Address, M.AllocatedSize);
return std::error_code();
}
OpenPOWER on IntegriCloud