49 #define LP_PREALLOCATION_INITIAL_ADDRESS (void *)0x0000008000000000 50 #define MASK 0x00000001 // Mask used to check, set and unset bits 52 #define MIN_CHUNK_SIZE 128 // Size (in bytes) of the smallest chunk provideable by DyMeLoR 53 #define MAX_CHUNK_SIZE 4194304 // Size (in bytes) of the biggest one. Notice that if this number 59 #define NUM_AREAS (log2(MAX_CHUNK_SIZE) - log2(MIN_CHUNK_SIZE) + 1) // Number of initial malloc_areas available (will be increased at runtime if needed) 60 #define MAX_NUM_AREAS (NUM_AREAS * 32) // Maximum number of allocatable malloc_areas. If MAX_NUM_AREAS 63 #define MAX_LIMIT_NUM_AREAS MAX_NUM_AREAS 64 #define MIN_NUM_CHUNKS 512 // Minimum number of chunks per malloc_area 65 #define MAX_NUM_CHUNKS 4096 // Maximum number of chunks per malloc_area 67 #define MAX_LOG_THRESHOLD 1.7 // Threshold to check if a malloc_area is underused TODO: retest 68 #define MIN_LOG_THRESHOLD 1.7 // Threshold to check if a malloc_area is overused TODO: retest 70 #ifndef INCREMENTAL_GRANULARITY 71 #define INCREMENTAL_GRANULARITY 50 // Number of incremental logs before a full log is forced 75 #define LITTLE_SIZE 32 76 #define CHECK_SIZE 0.25 // Must be <= 0.25! 79 #define GET_CACHE_LINE_NUMBER(P) ((unsigned long)((P >> 4) & (CACHE_SIZE - 1))) 82 #define SET_LOG_MODE_BIT(m_area) (((malloc_area*)(m_area))->chunk_size |= (MASK << 0)) 83 #define RESET_LOG_MODE_BIT(m_area) (((malloc_area*)(m_area))->chunk_size &= ~(MASK << 0)) 84 #define CHECK_LOG_MODE_BIT(m_area) (((malloc_area*)(m_area))->chunk_size & (MASK << 0)) 86 #define SET_AREA_LOCK_BIT(m_area) (((malloc_area*)(m_area))->chunk_size |= (MASK << 1)) 87 #define RESET_AREA_LOCK_BIT(m_area) (((malloc_area*)(m_area))->chunk_size &= ~(MASK << 1)) 88 #define CHECK_AREA_LOCK_BIT(m_area) (((malloc_area*)(m_area))->chunk_size & (MASK << 1)) 90 #define UNTAGGED_CHUNK_SIZE(m_area) (((malloc_area*)(m_area))->chunk_size & ~((MASK << 0) | (MASK << 1))) 92 #define POWEROF2(x) (1UL << (1 + (63 - __builtin_clzl((x) - 1)))) 93 #define IS_POWEROF2(x) ((x) != 0 && ((x) & ((x) - 1)) == 0) 121 size_t total_log_size;
122 size_t total_inc_size;
124 size_t dirty_bitmap_size;
135 #define is_incremental(ckpt) (((malloc_state *)ckpt)->is_incremental == true) 137 #define get_top_pointer(ptr) ((unsigned long long *)((char *)ptr - sizeof(unsigned long long))) 138 #define get_area_top_pointer(ptr) ( (malloc_area **)(*get_top_pointer(ptr)) ) 139 #define get_area(ptr) ( *(get_area_top_pointer(ptr)) ) 146 extern void set_force_full(
unsigned int,
int);
148 extern size_t get_state_size(
int);
150 extern size_t get_inc_log_size(
void *);
151 extern int get_granularity(
void);
152 extern size_t dirty_size(
unsigned int,
void *,
double *);
156 extern void do_free(
struct lp_struct *,
void *ptr);
157 extern void *allocate_lp_memory(
struct lp_struct *,
size_t);
158 extern void free_lp_memory(
struct lp_struct *,
void *);
174 extern inline void *rsalloc(
size_t);
175 extern inline void rsfree(
void *);
176 extern inline void *rsrealloc(
void *,
size_t);
177 extern inline void *rscalloc(
size_t,
size_t);
179 extern void ecs_init(
void);
182 #pragma GCC poison malloc free realloc calloc void dirty_mem(void *, int)
void * log_full(struct lp_struct *)
malloc_state * malloc_state_init(void)
void * do_malloc(struct lp_struct *, size_t)
Structure for LP's state.
void * log_state(struct lp_struct *)
Core ROOT-Sim functionalities.
void log_restore(struct lp_struct *, state_t *)
void * __wrap_calloc(size_t, size_t)
void * __wrap_realloc(void *, size_t)
bool is_incremental
Tells if it is an incremental log or a full one (when used for logging)
double simtime_t
This defines the type with whom timestamps are represented.
size_t get_log_size(malloc_state *)
Definition of the memory map.
unsigned char rootsim_bitmap
This defines a generic bitmap.
void * __wrap_malloc(size_t)
This structure let DyMeLoR handle one malloc area (for serving given-size memory requests) ...