From f7948483d2dccb64f0d7afa820273946429e3304 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 13 Sep 2004 22:38:11 +0000 Subject: Simplify the sys::Memory interface per Chris' request. llvm-svn: 16318 --- llvm/lib/System/AIX/Memory.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'llvm/lib/System/AIX/Memory.cpp') diff --git a/llvm/lib/System/AIX/Memory.cpp b/llvm/lib/System/AIX/Memory.cpp index 6ba57de40a6..dc8f2d1c475 100644 --- a/llvm/lib/System/AIX/Memory.cpp +++ b/llvm/lib/System/AIX/Memory.cpp @@ -26,8 +26,8 @@ using namespace sys; //=== and must not be generic UNIX code (see ../Unix/Memory.cpp) //===----------------------------------------------------------------------===// -void* Memory::AllocateRWX(Memory& M, unsigned NumBytes) { - if (NumBytes == 0) return 0; +MemoryBlock Memory::AllocateRWX(unsigned NumBytes) { + if (NumBytes == 0) return MemoryBlock(); static const long pageSize = Process::GetPageSize(); unsigned NumPages = (NumBytes+pageSize-1)/pageSize; @@ -37,14 +37,15 @@ void* Memory::AllocateRWX(Memory& M, unsigned NumBytes) { if (pa == (void*)-1) { throw std::string("Can't allocate RWX Memory: ") + strerror(errno); } - M.Address = pa; - M.AllocSize = NumPages*pageSize; - return pa; + MemoryBlock result; + result.Address = pa; + result.Size = NumPages*pageSize; + return result; } -void Memory::ReleaseRWX(Memory& M) { - if (M.Address == 0 || M.AllocSize == 0) return; - if (0 != munmap(M.Address, M.AllocSize)) { +void Memory::ReleaseRWX(MemoryBlock& M) { + if (M.Address == 0 || M.Size == 0) return; + if (0 != munmap(M.Address, M.Size)) { throw std::string("Can't release RWX Memory: ") + strerror(errno); } } -- cgit v1.2.3