llvm::sys::Memory Class Reference

This class provides various memory handling functions that manipulate MemoryBlock instances. More...

#include <Memory.h>

List of all members.

Static Public Member Functions

static MemoryBlock AllocateRWX (size_t NumBytes, const MemoryBlock *NearBlock, std::string *ErrMsg=0)
 This method allocates a block of Read/Write/Execute memory that is suitable for executing dynamically generated code (e.g.
static bool ReleaseRWX (MemoryBlock &block, std::string *ErrMsg=0)
 This method releases a block of Read/Write/Execute memory that was allocated with the AllocateRWX method.
static void InvalidateInstructionCache (const void *Addr, size_t Len)
 InvalidateInstructionCache - Before the JIT can run a block of code that has been emitted it must invalidate the instruction cache on some platforms.
static bool setExecutable (MemoryBlock &M, std::string *ErrMsg=0)
 setExecutable - Before the JIT can run a block of code, it has to be given read and executable privilege.
static bool setWritable (MemoryBlock &M, std::string *ErrMsg=0)
 setWritable - When adding to a block of code, the JIT may need to mark a block of code as RW since the protections are on page boundaries, and the JIT internal allocations are not page aligned.
static bool setRangeExecutable (const void *Addr, size_t Size)
 setRangeExecutable - Mark the page containing a range of addresses as executable.
static bool setRangeWritable (const void *Addr, size_t Size)
 setRangeWritable - Mark the page containing a range of addresses as writable.

Detailed Description

This class provides various memory handling functions that manipulate MemoryBlock instances.

Since:
1.4 An abstraction for memory operations.

Member Function Documentation

static MemoryBlock llvm::sys::Memory::AllocateRWX ( size_t  NumBytes,
const MemoryBlock NearBlock,
std::string *  ErrMsg = 0 
) [static]

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 NumBytes bytes of virtual memory is made. NearBlock may point to an existing allocation in which case an attempt is made to allocate more memory near the existing block.

On success, this returns a non-null memory block, otherwise it returns a null memory block and fills in *ErrMsg.

Allocate Read/Write/Execute memory.

static void llvm::sys::Memory::InvalidateInstructionCache ( const void *  Addr,
size_t  Len 
) [static]

InvalidateInstructionCache - Before the JIT can run a block of code that has been emitted it must invalidate the instruction cache on some platforms.

static bool llvm::sys::Memory::ReleaseRWX ( MemoryBlock block,
std::string *  ErrMsg = 0 
) [static]

This method releases a block of Read/Write/Execute memory that was allocated with the AllocateRWX method.

It should not be used to release any memory block allocated any other way.

On success, this returns false, otherwise it returns true and fills in *ErrMsg. Release Read/Write/Execute memory.

static bool llvm::sys::Memory::setExecutable ( MemoryBlock M,
std::string *  ErrMsg = 0 
) [static]

setExecutable - Before the JIT can run a block of code, it has to be given read and executable privilege.

Return true if it is already r-x or the system is able to change its previlege.

static bool llvm::sys::Memory::setRangeExecutable ( const void *  Addr,
size_t  Size 
) [static]

setRangeExecutable - Mark the page containing a range of addresses as executable.

static bool llvm::sys::Memory::setRangeWritable ( const void *  Addr,
size_t  Size 
) [static]

setRangeWritable - Mark the page containing a range of addresses as writable.

static bool llvm::sys::Memory::setWritable ( MemoryBlock M,
std::string *  ErrMsg = 0 
) [static]

setWritable - When adding to a block of code, the JIT may need to mark a block of code as RW since the protections are on page boundaries, and the JIT internal allocations are not page aligned.


The documentation for this class was generated from the following file:

Generated on 2 Nov 2013 for Galois by  doxygen 1.6.1