[llvm-branch-commits] [llvm-branch] r142095 - in /llvm/branches/release_30: ./ lib/Support/Windows/Memory.inc
Bill Wendling
isanbard at gmail.com
Sat Oct 15 18:49:31 PDT 2011
Author: void
Date: Sat Oct 15 20:49:31 2011
New Revision: 142095
URL: http://llvm.org/viewvc/llvm-project?rev=142095&view=rev
Log:
Merging r142039:
------------------------------------------------------------------------
r142039 | chapuni | 2011-10-14 18:58:16 -0700 (Fri, 14 Oct 2011) | 3 lines
Windows/Memory.inc: Support the ability to allocate memory "near" another block of memory on Win32. It has fixed FIXME.
Thanks to Aaron Ballman!
------------------------------------------------------------------------
Modified:
llvm/branches/release_30/ (props changed)
llvm/branches/release_30/lib/Support/Windows/Memory.inc
Propchange: llvm/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Oct 15 20:49:31 2011
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:142058
+/llvm/trunk:142039,142058
Modified: llvm/branches/release_30/lib/Support/Windows/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_30/lib/Support/Windows/Memory.inc?rev=142095&r1=142094&r2=142095&view=diff
==============================================================================
--- llvm/branches/release_30/lib/Support/Windows/Memory.inc (original)
+++ llvm/branches/release_30/lib/Support/Windows/Memory.inc Sat Oct 15 20:49:31 2011
@@ -32,11 +32,16 @@
static const size_t pageSize = Process::GetPageSize();
size_t NumPages = (NumBytes+pageSize-1)/pageSize;
- //FIXME: support NearBlock if ever needed on Win64.
+ PVOID start = NearBlock ? static_cast<unsigned char *>(NearBlock->base()) +
+ NearBlock->size() : NULL;
- void *pa = VirtualAlloc(NULL, NumPages*pageSize, MEM_COMMIT,
+ void *pa = VirtualAlloc(start, NumPages*pageSize, MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE);
if (pa == NULL) {
+ if (NearBlock) {
+ // Try again without the NearBlock hint
+ return AllocateRWX(NumBytes, NULL, ErrMsg);
+ }
MakeErrMsg(ErrMsg, "Can't allocate RWX Memory: ");
return MemoryBlock();
}
More information about the llvm-branch-commits
mailing list