34 : Id_{rid}, BaseAddr_{ba}, IsMapped_{
true}, IsDeleted_{
false},
37 std::strcpy(Name_, nm);
38 initArenaAllocAddresses();
40 flushDirtyCacheLines();
60 {
return ptr >= BaseAddr_ &&
61 (
static_cast<const char*
>(ptr) + sz) <
65 { assert(index <
kNumArenas_);
return &Arena_[index]; }
68 size_t sz,
bool does_need_cache_line_alignment,
69 bool does_need_logging);
72 void freeMem(
void *ptr,
bool should_log);
86 reinterpret_cast<intptr_t>(new_root),
92 {
return reinterpret_cast<void*
>(
93 *(
static_cast<intptr_t*
>(
127 void initArenaAllocAddresses();
128 void *allocMemFromArenas(
129 size_t sz,
bool should_update_free_list,
130 bool does_need_cache_line_alignment,
bool does_need_logging);
131 void flushDirtyCacheLines();
136 uint32_t arena_index = (
reinterpret_cast<intptr_t
>(ptr) -
137 reinterpret_cast<intptr_t>(BaseAddr_))/
kArenaSize_;
141 inline void PRegion::initArenaAllocAddresses()
153 #if defined(ATLAS_ALLOC_DUMP) 154 std::cout << Name_ <<
" " << Id_ <<
" " << BaseAddr_ <<
" " <<
155 (IsMapped_ ?
"mapped " :
"unmapped ") <<
156 (IsDeleted_ ?
"deleted " :
"valid ") << std::endl;
165 #if defined(ATLAS_ALLOC_STATS) 166 uint64_t total_alloced = 0;
169 std::cout <<
"[Atlas] Total bytes allocated in region " <<
170 Name_ <<
":" << total_alloced << std::endl;
Definition: pmalloc.hpp:37
void setRoot(void *new_root)
Definition: pregion.hpp:74
PRegion & operator=(const PRegion &)=delete
const uint32_t kArenaSize_
Definition: pregion_configs.hpp:31
void set_file_desc(int fd)
Definition: pregion.hpp:50
Definition: pregion.hpp:31
region_id_t get_id() const
Definition: pregion.hpp:52
const uint32_t kMaxlen_
Definition: pregion_configs.hpp:25
#define NVM_STR2(var, val, size)
Definition: internal_api.h:262
void freeMem(void *ptr, bool should_log)
Definition: pregion.hpp:134
void initArenaTransients()
Definition: pregion.hpp:104
void set_is_deleted(bool id)
Definition: pregion.hpp:49
const char * get_name() const
Definition: pregion.hpp:57
void * reallocMem(void *, size_t)
Definition: pregion.cpp:156
const uint32_t kNumArenas_
Definition: pregion_configs.hpp:30
void * allocRoot()
Definition: pregion.hpp:97
uint32_t region_id_t
Definition: pregion_configs.hpp:22
void * allocMem(size_t sz, bool does_need_cache_line_alignment, bool does_need_logging)
Definition: pregion.cpp:26
bool is_mapped() const
Definition: pregion.hpp:54
int get_file_desc() const
Definition: pregion.hpp:56
static void * mem2ptr(void *mem)
Definition: pmalloc_util.hpp:51
const uint64_t kPRegionSize_
Definition: pregion_configs.hpp:28
#define NVM_FLUSH(p)
Definition: atlas_api.h:106
void * allocRawMem(size_t)
Definition: pmalloc.cpp:339
void initAllocAddresses(void *start_addr)
Definition: pmalloc.hpp:113
void initTransients()
Definition: pmalloc.hpp:121
void set_is_mapped(bool im)
Definition: pregion.hpp:48
uint64_t get_actual_alloced() const
Definition: pmalloc.hpp:57
PArena * getArena(uint32_t index)
Definition: pregion.hpp:64
void * get_base_addr() const
Definition: pregion.hpp:53
bool is_deleted() const
Definition: pregion.hpp:55
void dumpDebugInfo() const
Definition: pregion.hpp:151
void freeMem(void *ptr, bool should_log)
Definition: pmalloc.cpp:37
void * callocMem(size_t nmemb, size_t sz)
Definition: pregion.cpp:143
static void set_default_tl_curr_arena(region_id_t rid)
Definition: pmalloc_util.hpp:24
void * getRoot() const
Definition: pregion.hpp:91
Definition: atlas_alloc_cpp.hpp:21
void printStats()
Definition: pregion.hpp:163
PRegion(const char *nm, region_id_t rid, void *ba)
Definition: pregion.hpp:33
bool doesRangeCheck(const void *ptr, size_t sz) const
Definition: pregion.hpp:59