38 #ifndef included_mem_mheap_h 39 #define included_mem_mheap_h 55 u64 prev_n_user_data:63;
58 #define MHEAP_N_USER_DATA_INVALID (0x7fffffffffffffffULL) 59 #define MHEAP_GROUNDED (~0ULL) 72 u32 prev_n_user_data:31;
75 #define MHEAP_N_USER_DATA_INVALID (0x7fffffff) 76 #define MHEAP_GROUNDED (~0) 102 u64 next_uoffset, prev_uoffset;
122 #define MHEAP_ELT_OVERHEAD_BYTES (sizeof (mheap_elt_t) - STRUCT_OFFSET_OF (mheap_elt_t, user_data)) 125 #define MHEAP_MIN_USER_DATA_BYTES MHEAP_ELT_OVERHEAD_BYTES 128 #define MHEAP_USER_DATA_WORD_BYTES STRUCT_SIZE_OF (mheap_elt_t, user_data[0]) 164 #ifdef CLIB_HAVE_VEC128 165 #define MHEAP_HAVE_SMALL_OBJECT_CACHE 1 167 #define MHEAP_HAVE_SMALL_OBJECT_CACHE 0 173 #if MHEAP_HAVE_SMALL_OBJECT_CACHE > 0 174 #define MHEAP_LOG2_N_SMALL_OBJECT_BINS 8 175 #define MHEAP_N_SMALL_OBJECT_BINS (1 << MHEAP_LOG2_N_SMALL_OBJECT_BINS) 177 #define MHEAP_LOG2_N_SMALL_OBJECT_BINS 0 178 #define MHEAP_N_SMALL_OBJECT_BINS 0 181 #define MHEAP_N_BINS \ 182 (MHEAP_N_SMALL_OBJECT_BINS \ 183 + (STRUCT_BITS_OF (mheap_elt_t, user_data[0]) - MHEAP_LOG2_N_SMALL_OBJECT_BINS)) 208 #ifdef CLIB_HAVE_VEC128 238 #define MHEAP_FLAG_TRACE (1 << 0) 239 #define MHEAP_FLAG_DISABLE_VM (1 << 1) 240 #define MHEAP_FLAG_THREAD_SAFE (1 << 2) 241 #define MHEAP_FLAG_SMALL_OBJECT_CACHE (1 << 3) 242 #define MHEAP_FLAG_VALIDATE (1 << 4) 327 #define mheap_len(v,d) (mheap_data_bytes((v),(void *) (d) - (void *) (v)) / sizeof ((d)[0])) 364 uword * offset_return);
#define MHEAP_ELT_OVERHEAD_BYTES
uword vm_alloc_offset_from_header
static uword mheap_offset_is_valid(void *v, uword uo)
u64 n_small_object_cache_hits
u64 n_small_object_cache_attempts
static mheap_t * mheap_header(u8 *v)
#define STRUCT_OFFSET_OF(t, f)
static uword mheap_max_size(void *v)
mheap_trace_main_t trace_main
static uword mheap_elt_data_bytes(mheap_elt_t *e)
static mheap_elt_t * mheap_prev_elt(mheap_elt_t *e)
static uword mheap_elts(void *v)
#define MHEAP_N_USER_DATA_INVALID
void mheap_put(void *v, uword offset)
static uword mheap_elt_uoffset(void *v, mheap_elt_t *e)
static void * vec_aligned_header(void *v, uword header_bytes, uword align)
mheap_small_object_cache_t small_object_cache
void * mheap_get_aligned(void *v, uword size, uword align, uword align_offset, uword *offset_return)
static void * mheap_elt_data(void *v, mheap_elt_t *e)
static mheap_elt_t * mheap_elt_at_uoffset(void *v, uword uo)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static mheap_elt_t * mheap_next_elt(mheap_elt_t *e)
static void * vec_aligned_header_end(void *v, uword header_bytes, uword align)
Vector bootsrap header file.
static uword mheap_data_bytes(void *v, uword uo)
static u8 * mheap_vector(mheap_t *h)
uword * trace_index_by_offset
static mheap_elt_t * mheap_user_pointer_to_elt(void *v)