Add a comment, and fix a bug where AllocateRW recurred to AllocateRWX instead of...
authorOwen Anderson <resistor@mac.com>
Sat, 22 Mar 2008 02:59:54 +0000 (02:59 +0000)
committerOwen Anderson <resistor@mac.com>
Sat, 22 Mar 2008 02:59:54 +0000 (02:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48677 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/System/Memory.h
lib/System/Unix/Memory.inc

index 8c1c37a07ccca477758b71b5a9f11acc6ea581f9..d692b95c271f98fb7af12e1a3e0ff92d767b07a9 100644 (file)
@@ -57,6 +57,14 @@ namespace sys {
                                      const MemoryBlock *NearBlock,
                                      std::string *ErrMsg = 0);
 
+      /// This method allocates a block of Read/Write memory.  This memory
+      /// needs to have executable permissions set before it can be used
+      /// to execute JIT'ed code.
+      ///
+      /// On success, this returns a non-null memory block, otherwise it returns
+      /// a null memory block and fills in *ErrMsg.
+      /// 
+      /// @brief Allocate Read/Write/Execute memory.
       static MemoryBlock AllocateRW(unsigned NumBytes,
                                     const MemoryBlock *NearBlock,
                                     std::string *ErrMsg = 0);
index 164988793f74b0fc9314aa5d65e9ba23f9e115be..e0bf8d8dfdf61fb34d5f2b8a75d317e0010c2385 100644 (file)
@@ -103,7 +103,7 @@ llvm::sys::Memory::AllocateRW(unsigned NumBytes, const MemoryBlock* NearBlock,
                     flags, fd, 0);
   if (pa == MAP_FAILED) {
     if (NearBlock) //Try again without a near hint
-      return AllocateRWX(NumBytes, 0);
+      return AllocateRW(NumBytes, 0);
 
     MakeErrMsg(ErrMsg, "Can't allocate RWX Memory");
     return MemoryBlock();