43 #if defined(_USE_TABLE_FLUSH) 44 void AsyncDataFlush(
void *p);
45 void AsyncMemOpDataFlush(
void *dst,
size_t sz);
54 static inline uint64_t atlas_rdtsc() {
56 __asm__ __volatile__(
"rdtsc" :
"=a"(lo),
"=d"(hi));
57 return lo | ((uint64_t)hi << 32);
60 #define NVM_LOG(var, size) { \ 61 nvm_store((void*)&(var), (size)); \ 64 #define NVM_LOCK(lock) { \ 65 pthread_mutex_lock(&(lock)); \ 66 nvm_acquire((void*)&(lock)); \ 69 #define NVM_UNLOCK(lock) { \ 70 nvm_release((void*)&(lock)); \ 71 pthread_mutex_unlock(&(lock)); \ 74 #define NVM_RWLOCK_RDLOCK(rwlock) { \ 75 pthread_rwlock_rdlock(&(rwlock)); \ 76 nvm_rwlock_rdlock((void *)&(rwlock)); \ 79 #define NVM_RWLOCK_WRLOCK(rwlock) { \ 80 pthread_rwlock_wrlock(&(rwlock)); \ 81 nvm_rwlock_wrlock((void *)&(rwlock)); \ 84 #define NVM_RWLOCK_UNLOCK(rwlock) { \ 85 nvm_rwlock_unlock((void *)&(rwlock)); \ 86 pthread_rwlock_unlock(&(rwlock)); \ 89 #if defined(_FLUSH_LOCAL_COMMIT) || defined(_FLUSH_GLOBAL_COMMIT) 91 #define NVM_STR(var,val,size) { \ 92 nvm_store((void*)&(var),((size)*8)); \ 96 #define NVM_STR2(var,val,size) { \ 97 nvm_store((void*)&(var),(size)); \ 101 #define NVM_MEMSET(s,c,n) { \ 102 nvm_memset((void *)(s), (size_t)(n)); \ 106 #define NVM_MEMCPY(dst, src, n) { \ 107 nvm_memcpy((void *)(dst), (size_t)(n)); \ 108 memcpy(dst, src, n); \ 111 #define NVM_MEMMOVE(dst, src, n) { \ 112 nvm_memmove((void *)(dst), (size_t)(n)); \ 113 memmove(dst, src, n); \ 116 #define NVM_STRCPY(dst, src) { \ 117 size_t sz=nvm_strlen(dst); \ 118 nvm_strcpy((void *)(dst),(size_t)(sz)); \ 122 #define NVM_STRNCPY(dst, src, n) { \ 123 nvm_strcpy((void *)(dst),(size_t)(n)); \ 124 strncpy(dst, src, n); \ 127 #define NVM_STRCAT(dst, src) { \ 128 size_t sz=nvm_strlen(dst); \ 129 nvm_strcat((void *)(dst),(size_t)(sz)); \ 133 #define NVM_STRNCAT(dst, src, n) { \ 134 size_t sz=nvm_strlen(dst); \ 135 nvm_strcat((void *)(dst),(size_t)(sz)); \ 136 strncat(dst, src, n); \ 140 #elif defined(_DISABLE_DATA_FLUSH) 142 #define NVM_STR(var,val,size) { \ 143 nvm_store((void*)&(var),((size)*8)); \ 147 #define NVM_STR2(var,val,size) { \ 148 nvm_store((void*)&(var),(size)); \ 152 #define NVM_MEMSET(s,c,n) { \ 153 nvm_memset((void *)(s), (size_t)(n)); \ 157 #define NVM_MEMCPY(dst, src, n) { \ 158 nvm_memcpy((void *)(dst), (size_t)(n)); \ 159 memcpy(dst, src, n); \ 162 #define NVM_MEMMOVE(dst, src, n) { \ 163 nvm_memmove((void *)(dst), (size_t)(n)); \ 164 memmove(dst, src, n); \ 167 #define NVM_STRCPY(dst, src) { \ 168 size_t sz=nvm_strlen(dst); \ 169 nvm_strcpy((void *)(dst),(size_t)(sz)); \ 173 #define NVM_STRNCPY(dst, src, n) { \ 174 nvm_strcpy((void *)(dst),(size_t)(n)); \ 175 strncpy(dst, src, n); \ 178 #define NVM_STRCAT(dst, src) { \ 179 size_t sz=nvm_strlen(dst); \ 180 nvm_strcat((void *)(dst),(size_t)(sz)); \ 184 #define NVM_STRNCAT(dst, src, n) { \ 185 size_t sz=nvm_strlen(dst); \ 186 nvm_strcat((void *)(dst),(size_t)(sz)); \ 187 strncat(dst, src, n); \ 190 #elif defined(_USE_TABLE_FLUSH) 192 #define NVM_STR(var,val,size) { \ 193 nvm_store((void*)&(var),((size)*8)); \ 195 AsyncDataFlush((void*)&(var)); \ 198 #define NVM_STR2(var,val,size) { \ 199 nvm_store((void*)&(var),(size)); \ 201 AsyncDataFlush((void*)&(var)); \ 204 #define NVM_MEMSET(s,c,n) { \ 205 nvm_memset((void *)(s), (size_t)(n)); \ 207 AsyncMemOpDataFlush((void*)(s), n); \ 210 #define NVM_MEMCPY(dst, src, n) { \ 211 nvm_memcpy((void *)(dst), (size_t)(n)); \ 212 memcpy(dst, src, n); \ 213 AsyncMemOpDataFlush((void*)(dst), n); \ 216 #define NVM_MEMMOVE(dst, src, n) { \ 217 nvm_memmove((void *)(dst), (size_t)(n)); \ 218 memmove(dst, src, n); \ 219 AsyncMemOpDataFlush((void*)(dst), n); \ 222 #define NVM_STRCPY(dst, src) { \ 223 size_t sz=nvm_strlen(dst); \ 224 nvm_strcpy((dst),(size_t)(sz)); \ 226 AsyncMemOpDataFlush((void*)(dst), sz); \ 229 #define NVM_STRNCPY(dst, src, n) { \ 230 nvm_strcpy((dst),(size_t)(n)); \ 231 strncpy(dst, src, n); \ 232 AsyncMemOpDataFlush((void*)(dst), n); \ 235 #define NVM_STRCAT(dst, src) { \ 236 size_t sz=nvm_strlen(dst); \ 237 nvm_strcat((dst),(size_t)(sz)); \ 239 AsyncMemOpDataFlush((void*)(dst), sz); \ 242 #define NVM_STRNCAT(dst, src, n) { \ 243 size_t sz=nvm_strlen(dst); \ 244 nvm_strcat((dst),(size_t)(sz)); \ 245 strncat(dst, src, n); \ 246 AsyncMemOpDataFlush((void*)(dst), sz); \ 256 #define NVM_STR(var,val,size) { \ 257 nvm_store((void*)&(var),((size)*8)); \ 259 NVM_FLUSH_ACQ_COND(&var); \ 262 #define NVM_STR2(var,val,size) { \ 263 nvm_store((void*)&(var),(size)); \ 265 NVM_FLUSH_ACQ_COND(&var); \ 268 #define NVM_MEMSET(s,c,n) { \ 269 nvm_memset((void *)(s), (size_t)(n)); \ 271 NVM_PSYNC_ACQ_COND(s, n); \ 274 #define NVM_MEMCPY(dst, src, n) { \ 275 nvm_memcpy((void *)(dst), (size_t)(n)); \ 276 memcpy(dst, src, n); \ 277 NVM_PSYNC_ACQ_COND(dst, n); \ 280 #define NVM_MEMMOVE(dst, src, n) { \ 281 nvm_memmove((void *)(dst), (size_t)(n)); \ 282 memmove(dst, src, n); \ 283 NVM_PSYNC_ACQ_COND(dst, n); \ 286 #define NVM_STRCPY(dst, src) { \ 287 size_t sz=nvm_strlen(dst); \ 288 nvm_strcpy((void *)(dst),(size_t)(sz)); \ 290 NVM_PSYNC_ACQ_COND(dst, sz); \ 293 #define NVM_STRNCPY(dst, src, n) { \ 294 nvm_strcpy((void *)(dst),(size_t)(n)); \ 295 strncpy(dst, src, n); \ 296 NVM_PSYNC_ACQ_COND(dst, n); \ 299 #define NVM_STRCAT(dst, src) { \ 300 size_t sz=nvm_strlen(dst); \ 301 nvm_strcat((void *)(dst),(size_t)(sz)); \ 303 NVM_PSYNC_ACQ_COND(dst, sz); \ 306 #define NVM_STRNCAT(dst, src, n) { \ 307 size_t sz=nvm_strlen(dst); \ 308 nvm_strcat((void *)(dst),(size_t)(sz)); \ 309 strncat(dst, src, n); \ 310 NVM_PSYNC_ACQ_COND(dst, sz); \ void nvm_rwlock_unlock(void *lock_address)
Definition: log_mgr_api.cpp:66
void nvm_rwlock_rdlock(void *lock_address)
Definition: log_mgr_api.cpp:54
void nvm_log_free(void *addr)
Definition: log_mgr_api.cpp:133
void nvm_rwlock_wrlock(void *lock_address)
Definition: log_mgr_api.cpp:60
void nvm_acquire(void *lock_address)
Definition: log_mgr_api.cpp:42
void nvm_log_alloc(void *addr)
Definition: log_mgr_api.cpp:127
size_t nvm_strlen(char *dst)
Definition: log_mgr_api.cpp:110
void nvm_memset(void *addr, size_t sz)
Definition: log_mgr_api.cpp:92
void nvm_memcpy(void *dst, size_t sz)
Definition: log_mgr_api.cpp:98
void nvm_memmove(void *dst, size_t sz)
Definition: log_mgr_api.cpp:104
void nvm_store(void *addr, size_t size)
Definition: log_mgr_api.cpp:86
void nvm_release(void *lock_address)
Definition: log_mgr_api.cpp:48
int size(COW_AL *cal)
Definition: cow_array_list.c:183
void nvm_strcat(char *dst, size_t sz)
Definition: log_mgr_api.cpp:121
void nvm_strcpy(char *dst, size_t sz)
Definition: log_mgr_api.cpp:115
void nvm_barrier(void *)
Definition: log_mgr_api.cpp:139