[llvm-commits] [llvm] r48677 - in /llvm/trunk: include/llvm/System/Memory.h lib/System/Unix/Memory.inc

Owen Anderson resistor at mac.com
Fri Mar 21 19:59:55 PDT 2008


Author: resistor
Date: Fri Mar 21 21:59:54 2008
New Revision: 48677

URL: http://llvm.org/viewvc/llvm-project?rev=48677&view=rev
Log:
Add a comment, and fix a bug where AllocateRW recurred to AllocateRWX instead of itself.

Modified:
    llvm/trunk/include/llvm/System/Memory.h
    llvm/trunk/lib/System/Unix/Memory.inc

Modified: llvm/trunk/include/llvm/System/Memory.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Memory.h?rev=48677&r1=48676&r2=48677&view=diff

==============================================================================
--- llvm/trunk/include/llvm/System/Memory.h (original)
+++ llvm/trunk/include/llvm/System/Memory.h Fri Mar 21 21:59:54 2008
@@ -57,6 +57,14 @@
                                      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);

Modified: llvm/trunk/lib/System/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Memory.inc?rev=48677&r1=48676&r2=48677&view=diff

==============================================================================
--- llvm/trunk/lib/System/Unix/Memory.inc (original)
+++ llvm/trunk/lib/System/Unix/Memory.inc Fri Mar 21 21:59:54 2008
@@ -103,7 +103,7 @@
                     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();





More information about the llvm-commits mailing list