Atlas Runtime
|
Functions | |
uint32_t | NVM_FindOrCreateRegion (const char *name, int flags, int *is_created) |
Create a persistent region with the provided name. More... | |
uint32_t | NVM_FindRegion (const char *name, int flags) |
Find the id of a region when it is known to exist already. More... | |
uint32_t | NVM_CreateRegion (const char *name, int flags) |
Create a named persistent region. More... | |
void | NVM_CloseRegion (uint32_t rid) |
Close a persistent region. More... | |
void | NVM_DeleteRegion (const char *name) |
Delete the region with the provided name. More... | |
void * | NVM_GetRegionRoot (uint32_t rid) |
Get the root pointer of the persistent region. More... | |
void | NVM_SetRegionRoot (uint32_t rid, void *new_root) |
Set the root pointer of an existing persistent region. More... | |
void * | nvm_alloc (size_t sz, uint32_t rid) |
Malloc style interface for allocation from a persistent region. More... | |
void * | nvm_calloc (size_t nmemb, size_t sz, uint32_t rid) |
Calloc style interface for allocation from a persistent region. More... | |
void * | nvm_realloc (void *ptr, size_t sz, uint32_t rid) |
Realloc style interface for allocation from a persistent region. More... | |
void | nvm_free (void *ptr) |
Deallocation interface for persistent data. More... | |
void | nvm_delete (void *ptr) |
int | NVM_IsInOpenPR (void *addr, size_t sz) |
int | isOnDifferentCacheLine (void *p1, void *p2) |
Determines if the addresses are on different cache lines. More... | |
int | isCacheLineAligned (void *p) |
Determines if a memory location is aligned to a cache line. More... | |
int | NVM_IsInRegion (void *ptr, size_t sz) |
Determines if a memory location is within a region. More... | |
PRegion * | NVM_GetRegion (uint32_t rid) |
Get a handle to a persistent region. More... | |
void * | operator new (size_t sz, Atlas::PRegion *rgn) noexcept |
Object allocation for C++. More... | |
void * | operator new[] (size_t sz, Atlas::PRegion *rgn) noexcept |
Array form allocation for C++, type must have explicit destructor. More... | |
int isCacheLineAligned | ( | void * | p | ) |
Determines if a memory location is aligned to a cache line.
p | Address of memory location under consideration |
int isOnDifferentCacheLine | ( | void * | p1, |
void * | p2 | ||
) |
Determines if the addresses are on different cache lines.
p1 | First address |
p2 | Second address |
The objects under consideration must not cross cache lines, otherwise this interface is inadequate.
void* nvm_alloc | ( | size_t | sz, |
uint32_t | rid | ||
) |
Malloc style interface for allocation from a persistent region.
sz | Size of location to be allocated |
rid | Id of persistent region for allocation |
void* nvm_calloc | ( | size_t | nmemb, |
size_t | sz, | ||
uint32_t | rid | ||
) |
Calloc style interface for allocation from a persistent region.
nmemb | Number of elements in the array to be allocated |
sz | Size of each element |
rid | Id of persistent region for allocation |
void NVM_CloseRegion | ( | uint32_t | rid | ) |
Close a persistent region.
rid | Region id |
After closing, it won't be available to the calling process without calling NVM_FindOrCreateRegion. The region will stay in NVM even after calling this interface. This interface allows closing a region with normal bookkeeping.
uint32_t NVM_CreateRegion | ( | const char * | name, |
int | flags | ||
) |
Create a named persistent region.
name | Name of the persistent region |
flags | access flag (one of O_RDONLY, O_WRONLY, O_RDWR) |
This interface does not check for an existing entry with the same name. If a region with the same name already exists, the behavior of the program is undefined.
void nvm_delete | ( | void * | ptr | ) |
void NVM_DeleteRegion | ( | const char * | name | ) |
Delete the region with the provided name.
name | Name of the persistent region |
Use this interface to completely destroy a region. If the region does not exist, an assertion failure will occur.
uint32_t NVM_FindOrCreateRegion | ( | const char * | name, |
int | flags, | ||
int * | is_created | ||
) |
Create a persistent region with the provided name.
name | Name of the persistent region |
flags | access flag (one of O_RDONLY, O_WRONLY, O_RDWR) |
is_created | Indicator whether the region got created as a result of the call |
If the region already exists, the existing id of the region is returned. Otherwise a region is created and its newly assigned id returned.
uint32_t NVM_FindRegion | ( | const char * | name, |
int | flags | ||
) |
Find the id of a region when it is known to exist already.
name | Name of the persistent region |
flags | access flag (one of O_RDONLY, O_WRONLY, O_RDWR) |
This interface should be used over NVM_FindOrCreateRegion for efficiency reasons if the region is known to exist. If a region with the provided name does not exist, an assertion failure will occur.
void nvm_free | ( | void * | ptr | ) |
Deallocation interface for persistent data.
ptr | Address of memory location to be freed. |
Though the usual use case would be for the location to be in persistent memory, this interface will also work for transient data. The implementation is required to transparently handle this case as well.
PRegion* NVM_GetRegion | ( | uint32_t | rid | ) |
Get a handle to a persistent region.
rid | Region identifier |
Currently, this interface is to be used by a client only for the placement new operations
void* NVM_GetRegionRoot | ( | uint32_t | rid | ) |
Get the root pointer of the persistent region.
rid | Region id |
The region must have been created already. Currently, only one root is implemented for a given region. The idea is that anything within a region that is not reachable from the root after program termination is assumed to be garbage and can be recycled. During execution, anything within a region that is not reachable from the root or from other roots (in the GC sense) is assumed to be garbage as well.
int NVM_IsInOpenPR | ( | void * | addr, |
size_t | sz | ||
) |
Is the following address with associated size within an open persistent region?
int NVM_IsInRegion | ( | void * | ptr, |
size_t | sz | ||
) |
Determines if a memory location is within a region.
ptr | Queried address |
sz | Size of the location in bytes |
void* nvm_realloc | ( | void * | ptr, |
size_t | sz, | ||
uint32_t | rid | ||
) |
Realloc style interface for allocation from a persistent region.
ptr | Address of memory block provided |
sz | New size of allocation |
rid | Id of persistent region for allocation |
void NVM_SetRegionRoot | ( | uint32_t | rid, |
void * | root | ||
) |
Set the root pointer of an existing persistent region.
rid | Region id |
root | The new root of the region |
|
noexcept |
Object allocation for C++.
sz | Allocation size |
rgn | Pointer to the region to serve the allocation from |
This interface overloads the C++ placement new operator. The corresponding delete operation is NVM_Destroy.
|
noexcept |
Array form allocation for C++, type must have explicit destructor.
sz | Allocation size |
rgn | Pointer to the region to serve the allocation from |
This interface overloads the array form C++ placement new operator. The type of the array elements must have an explicit destructor. The corresponding delete operation is NVM_Destroy_Array.