[llvm-commits] CVS: llvm/include/llvm/System/Memory.h
Chris Lattner
sabre at nondot.org
Mon Aug 1 12:13:04 PDT 2005
On Fri, 29 Jul 2005, Reid Spencer wrote:
>> support near allocations for the JIT
>> /// This method allocates a block of Read/Write/Execute memory that is
>> /// suitable for executing dynamically generated code (e.g. JIT). An
>> /// attempt to allocate \p NumBytes bytes of virtual memory is made.
>> + /// \p NearBlock may point to an existing allocation in which case
>> + /// an attempt is made to allocate more memory near the existing block.
>> /// @throws std::string if an error occurred.
>> /// @brief Allocate Read/Write/Execute memory.
>> - static MemoryBlock AllocateRWX(unsigned NumBytes);
>> + static MemoryBlock AllocateRWX(unsigned NumBytes, const MemoryBlock* NearBlock);
>
> What if one does NOT want to allocate something near another block?
> Shouldn't the second argument be initialized to zero in order to retain
> the existing API? A zero value would indicate that the "NearBlock"
> constraint should be ignored and the function is permitted to allocate
> memory anywhere available. Furthermore, this needs to be "hint" as is
> done with the mmap(2) system call.
The implementation already does this (treats it as a hint, and ignores the
argument if it's not 0). If you want, it would be easy to make the second
argument default to zero if not specified.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-commits
mailing list