38 #ifndef included_mem_mheap_h 39 #define included_mem_mheap_h 53 u32 prev_n_user_data : 31;
56 #define MHEAP_N_USER_DATA_INVALID (0x7fffffff) 84 #define MHEAP_ELT_OVERHEAD_BYTES (sizeof (mheap_elt_t) - STRUCT_OFFSET_OF (mheap_elt_t, user_data)) 87 #define MHEAP_MIN_USER_DATA_BYTES MHEAP_ELT_OVERHEAD_BYTES 90 #define MHEAP_USER_DATA_WORD_BYTES STRUCT_SIZE_OF (mheap_elt_t, user_data[0]) 122 #define MHEAP_LOG2_N_SMALL_OBJECT_BINS 8 123 #define MHEAP_N_SMALL_OBJECT_BINS (1 << MHEAP_LOG2_N_SMALL_OBJECT_BINS) 125 #define MHEAP_N_BINS \ 126 (MHEAP_N_SMALL_OBJECT_BINS \ 127 + (STRUCT_BITS_OF (mheap_elt_t, user_data[0]) - MHEAP_LOG2_N_SMALL_OBJECT_BINS)) 146 #ifdef CLIB_HAVE_VEC128 147 #define MHEAP_HAVE_SMALL_OBJECT_CACHE 1 149 #define MHEAP_HAVE_SMALL_OBJECT_CACHE 0 155 #ifdef CLIB_HAVE_VEC128 179 #define MHEAP_FLAG_TRACE (1 << 0) 180 #define MHEAP_FLAG_DISABLE_VM (1 << 1) 181 #define MHEAP_FLAG_THREAD_SAFE (1 << 2) 182 #define MHEAP_FLAG_SMALL_OBJECT_CACHE (1 << 3) 183 #define MHEAP_FLAG_VALIDATE (1 << 4) 245 #define mheap_len(v,d) (mheap_data_bytes((v),(void *) (d) - (void *) (v)) / sizeof ((d)[0])) 274 uword * offset_return);
always_inline uword mheap_offset_is_valid(void *v, uword uo)
always_inline mheap_elt_t * mheap_user_pointer_to_elt(void *v)
always_inline uword mheap_elts(void *v)
always_inline uword mheap_elt_uoffset(void *v, mheap_elt_t *e)
always_inline void * mheap_elt_data(void *v, mheap_elt_t *e)
always_inline mheap_elt_t * mheap_prev_elt(mheap_elt_t *e)
#define MHEAP_ELT_OVERHEAD_BYTES
always_inline uword mheap_max_size(void *v)
uword vm_alloc_offset_from_header
always_inline uword mheap_data_bytes(void *v, uword uo)
u64 n_small_object_cache_hits
u64 n_small_object_cache_attempts
#define STRUCT_OFFSET_OF(t, f)
always_inline void * vec_aligned_header(void *v, uword header_bytes, uword align)
mheap_trace_main_t trace_main
always_inline mheap_t * mheap_header(u8 *v)
#define MHEAP_N_USER_DATA_INVALID
void mheap_put(void *v, uword offset)
always_inline uword mheap_elt_data_bytes(mheap_elt_t *e)
mheap_small_object_cache_t small_object_cache
always_inline mheap_elt_t * mheap_next_elt(mheap_elt_t *e)
void * mheap_get_aligned(void *v, uword size, uword align, uword align_offset, uword *offset_return)
always_inline mheap_elt_t * mheap_elt_at_uoffset(void *v, uword uo)
always_inline u8 * mheap_vector(mheap_t *h)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline void * vec_aligned_header_end(void *v, uword header_bytes, uword align)
Vector bootsrap header file.
uword * trace_index_by_offset