numem.core.hooks

Numem Core Hooks.

This file contains all the core hooks numem calls internally to handle memory. Given that some platforms may not have a C standard library, these hooks allow you to override how numem handles memory for such platforms from an external library.

In this case, most of the hooks presented here will need to be implemented to cover all of the used internal hooks within numem.

Hooks which are prefixed nuopt_ are optional and may be omitted, they are usually for language-specific interoperability.

Members

Functions

nu_atomic_add_32
uint nu_atomic_add_32(uint dst, uint value)

Adds a 32 bit value atomically.

nu_atomic_barrier_acquire
void nu_atomic_barrier_acquire()

Inserts a memory acquire barrier.

nu_atomic_barrier_release
void nu_atomic_barrier_release()

Inserts a memory release barrier.

nu_atomic_cmpxhg_ptr
bool nu_atomic_cmpxhg_ptr(void** dst, void* oldvalue, void* value)

Compares variable at dst and swaps it if it contains oldvalue.

nu_atomic_load_32
inout(uint) nu_atomic_load_32(inout(uint) src)

Loads a 32 bit value atomically.

nu_atomic_load_ptr
inout(void)* nu_atomic_load_ptr(inout(void)** src)

Loads a pointer value atomically.

nu_atomic_store_32
void nu_atomic_store_32(uint dst, uint value)

Stores a 32 bit value atomically.

nu_atomic_store_ptr
void nu_atomic_store_ptr(void** dst, void* value)

Stores a pointer value atomically.

nu_atomic_sub_32
uint nu_atomic_sub_32(uint dst, uint value)

Subtracts a 32 bit value atomically.

nu_atomic_supported
bool nu_atomic_supported()

Gets the status of atomics support in the current numem configuration.

nu_fatal
void nu_fatal(const(char)[] errMsg)

Called internally by numem if a fatal error occured.

nu_free
void nu_free(void* data)

Frees allocated memory.

nu_malloc
void* nu_malloc(size_t bytes)

Allocates bytes worth of memory.

nu_memcpy
void* nu_memcpy(void* dst, void* src, size_t bytes)

Copies bytes worth of data from src into dst.

nu_memmove
void* nu_memmove(void* dst, void* src, size_t bytes)

Moves bytes worth of data from src into dst.

nu_memset
void* nu_memset(void* dst, ubyte value, size_t bytes)

Fills dst with bytes amount of values.

nu_realloc
void* nu_realloc(void* data, size_t newSize)

Reallocates memory prior allocated with nu_malloc or nu_alignedalloc.

Static variables

nuopt_autoreleasepool_pop
void function(void*) @(nogc) nothrow @(system) nuopt_autoreleasepool_pop;

Hooks for handling auto release pools.

nuopt_autoreleasepool_push
void* function() @(nogc) nothrow @(system) nuopt_autoreleasepool_push;

Hooks for handling auto release pools.

Meta

Authors

Luna Nielsen