[PATCH] D59663: [Support] MemoryBlock size should reflect the requested size

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 03:25:14 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL357058: [Support] MemoryBlock size should reflect the requested size (authored by anng, committed by ).
Herald added a subscriber: kristina.
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D59663?vs=191760&id=192422#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59663/new/

https://reviews.llvm.org/D59663

Files:
  llvm/trunk/lib/Support/Windows/Memory.inc


Index: llvm/trunk/lib/Support/Windows/Memory.inc
===================================================================
--- llvm/trunk/lib/Support/Windows/Memory.inc
+++ llvm/trunk/lib/Support/Windows/Memory.inc
@@ -135,8 +135,9 @@
 
   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 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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59663.192422.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190327/0f6fb656/attachment.bin>


More information about the llvm-commits mailing list