[llvm-commits] CVS: llvm/lib/System/Win32/Memory.cpp
Reid Spencer
reid at x10sys.com
Mon Sep 13 15:38:24 PDT 2004
Changes in directory llvm/lib/System/Win32:
Memory.cpp updated: 1.1 -> 1.2
---
Log message:
Simplify the sys::Memory interface per Chris' request.
---
Diffs of the changes: (+9 -8)
Index: llvm/lib/System/Win32/Memory.cpp
diff -u llvm/lib/System/Win32/Memory.cpp:1.1 llvm/lib/System/Win32/Memory.cpp:1.2
--- llvm/lib/System/Win32/Memory.cpp:1.1 Fri Sep 10 23:59:30 2004
+++ llvm/lib/System/Win32/Memory.cpp Mon Sep 13 17:38:12 2004
@@ -22,8 +22,8 @@
//=== WARNING: Implementation here must contain only Win32 specific code.
//===----------------------------------------------------------------------===//
-void* Memory::AllocateRWX(Memory&M, unsigned NumBytes) {
- if (NumBytes == 0) return 0;
+MemoryBlock Memory::AllocateRWX(unsigned NumBytes) {
+ if (NumBytes == 0) return MemoryBlock();
unsigned pageSize = Process::GetPageSize();
unsigned NumPages = (NumBytes+pageSize-1)/pageSize;
@@ -33,12 +33,13 @@
throw std::string("Couldn't allocate ") + utostr(NumBytes) +
" bytes of executable memory!";
}
- M.Address = P;
- M.AllocSize = NumBytes;
- return P;
+ MemoryBlock result;
+ result.Address = P;
+ result.Size = NumBytes;
+ return result;
}
-void Memory::ReleaseRWX(Memory& M) {
- if (M.Address == 0 ) return;
- VirtualFree(M.Address, M.AllocSize, MEM_DECOMMIT, PAGE_NOACCESS);
+void Memory::ReleaseRWX(MemoryBlock& M) {
+ if (M.Address == 0 || M.Size == 0) return;
+ VirtualFree(M.Address, M.Size, MEM_DECOMMIT, PAGE_NOACCESS);
}
More information about the llvm-commits
mailing list