Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
unique_range.cpp File Reference
#include "precompiled.h"
#include "lib/allocators/unique_range.h"
#include "lib/bits.h"
#include "lib/sysdep/cpu.h"
#include "lib/sysdep/rtl.h"

Go to the source code of this file.

Functions

static void FreeNone (void *pointer, size_t size)
 
static void FreeAligned (void *pointer, size_t size)
 
void RegisterUniqueRangeDeleter (UniqueRangeDeleter deleter, volatile IdxDeleter *idxDeleterOut)
 register a deleter, returning its index within the table. More...
 
NOTHROW_DEFINE void CallUniqueRangeDeleter (void *pointer, size_t size, IdxDeleter idxDeleter)
 
UniqueRange AllocateAligned (size_t size, size_t alignment)
 
UniqueRange AllocateVM (size_t size, vm::PageType pageType, int prot)
 

Variables

static UniqueRangeDeleter deleters [allocationAlignment] = { FreeNone, FreeAligned }
 
static IdxDeleter numDeleters = 2
 

Function Documentation

UniqueRange AllocateAligned ( size_t  size,
size_t  alignment 
)

Definition at line 57 of file unique_range.cpp.

UniqueRange AllocateVM ( size_t  size,
vm::PageType  pageType,
int  prot 
)

Definition at line 73 of file unique_range.cpp.

NOTHROW_DEFINE void CallUniqueRangeDeleter ( void *  pointer,
size_t  size,
IdxDeleter  idxDeleter 
)

Definition at line 48 of file unique_range.cpp.

static void FreeAligned ( void *  pointer,
size_t  size 
)
static

Definition at line 15 of file unique_range.cpp.

static void FreeNone ( void *  pointer,
size_t  size 
)
static

Definition at line 9 of file unique_range.cpp.

void RegisterUniqueRangeDeleter ( UniqueRangeDeleter  deleter,
volatile IdxDeleter idxDeleter 
)

register a deleter, returning its index within the table.

Parameters
deleterfunction pointer. must be uniquely associated with the idxDeleter storage location.
idxDeleterlocation where to store the next available index. if it is already non-zero, skip the call to this function to avoid overhead.

thread-safe. idxDeleter is used for mutual exclusion between multiple callers for the same deleter. concurrent registration of different deleters is also safe due to atomic increments.

halts the program if more than allocationAlignment deleters are to be registered.

Definition at line 28 of file unique_range.cpp.

Variable Documentation

Definition at line 21 of file unique_range.cpp.

IdxDeleter numDeleters = 2
static

Definition at line 23 of file unique_range.cpp.